diff -Nru libinput-1.10.3/aclocal.m4 libinput-0.21.0/aclocal.m4 --- libinput-1.10.3/aclocal.m4 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/aclocal.m4 2015-08-04 00:58:30.000000000 +0000 @@ -0,0 +1,1372 @@ +# generated automatically by aclocal 1.15 -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. + +# This file 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. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, +[m4_warning([this file was generated for autoconf 2.69. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])# PKG_CHECK_MODULES + + +# PKG_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable pkgconfigdir as the location where a module +# should install pkg-config .pc files. By default the directory is +# $libdir/pkgconfig, but the default can be changed by passing +# DIRECTORY. The user can override through the --with-pkgconfigdir +# parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_INSTALLDIR + + +# PKG_NOARCH_INSTALLDIR(DIRECTORY) +# ------------------------- +# Substitutes the variable noarch_pkgconfigdir as the location where a +# module should install arch-independent pkg-config .pc files. By +# default the directory is $datadir/pkgconfig, but the default can be +# changed by passing DIRECTORY. The user can override through the +# --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +]) dnl PKG_NOARCH_INSTALLDIR + + +# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------- +# Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])# PKG_CHECK_VAR + +# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# +# This file 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. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.15' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.15], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.15])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file 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. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# +# This file 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. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# +# This file 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. + + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# +# This file 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. + + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named 'Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running 'make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "$am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each '.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# +# This file 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 macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file 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. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2014 Free Software Foundation, Inc. +# +# This file 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. + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file 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. + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# +# This file 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. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file 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. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# +# This file 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. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file 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. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# +# This file 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. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# +# This file 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. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# +# This file 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. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2014 Free Software Foundation, Inc. +# +# This file 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. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2014 Free Software Foundation, Inc. +# +# This file 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. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/libtool.m4]) +m4_include([m4/ltoptions.m4]) +m4_include([m4/ltsugar.m4]) +m4_include([m4/ltversion.m4]) +m4_include([m4/lt~obsolete.m4]) diff -Nru libinput-1.10.3/circle.yml libinput-0.21.0/circle.yml --- libinput-1.10.3/circle.yml 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/circle.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,144 +0,0 @@ -# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0: - -libinput_jobs: - default_settings: &default_settings - working_directory: ~/libinput - # Define a couple of standardized build targets - # that we call from every build container - build_and_test_default: &build_and_test_default - name: Build - command: | - rm -rf build - meson build ${MESON_PARAMS} - meson configure build - ninja -v -C build ${NINJA_ARGS} - environment: - MESON_PARAMS: --prefix=/opt/libinput - build_and_test: &build_and_test - run: - <<: *build_and_test_default - build_no_libwacom: &build_no_libwacom - run: - <<: *build_and_test_default - name: Build - No libwacom - environment: - MESON_PARAMS: -Dlibwacom=false - build_no_debug_gui: &build_no_debug_gui - run: - <<: *build_and_test_default - name: Build - No debug-gui - environment: - MESON_PARAMS: -Ddebug-gui=false - build_no_tests: &build_no_tests - run: - <<: *build_and_test_default - name: Build - No tests - environment: - MESON_PARAMS: -Dtests=false - build_no_docs: &build_no_docs - run: - <<: *build_and_test_default - name: Build - No docs - environment: - MESON_PARAMS: -Ddocumentation=false - build_dist: &build_dist - run: - <<: *build_and_test_default - name: Build - ninja dist - environment: - NINJA_ARGS: dist - ninja_scan_build: &ninja_scan_build - run: - <<: *build_and_test_default - name: Ninja scan-build - environment: - NINJA_ARGS: scan-build - install: &install - run: - name: Installing - command: ninja -v -C build install - export_logs: &export_logs - store_artifacts: - path: ~/libinput/build/meson-logs - -fedora_install: &fedora_install - run: - name: Install prerequisites - command: | - dnf upgrade -y libsolv - dnf install -y git gcc gcc-c++ meson check-devel libudev-devel libevdev-devel doxygen graphviz valgrind binutils libwacom-devel cairo-devel gtk3-devel glib2-devel mtdev-devel - -fedora_build_all: &fedora_build_all - <<: *default_settings - steps: - - *fedora_install - - checkout - - *build_and_test - - *install - - *export_logs - - *build_no_libwacom - - *build_no_debug_gui - - *build_no_tests - - *build_no_docs - - *build_dist - -ubuntu_install: &ubuntu_install - run: - name: Install prerequisites - command: | - apt-get update - apt-get install -y software-properties-common - add-apt-repository universe - apt-get update - apt-get install -y git gcc g++ meson check libudev-dev libevdev-dev doxygen graphviz valgrind binutils libwacom-dev libcairo2-dev libgtk-3-dev libglib2.0-dev libmtdev-dev - -ubuntu_build_all: &ubuntu_build_all - <<: *default_settings - steps: - - *ubuntu_install - - checkout - - *build_and_test - - *install - - *export_logs - - *build_no_libwacom - - *build_no_debug_gui - - *build_no_tests - - *build_no_docs - - *build_dist - -scan_build_run: &scan_build_run - <<: *default_settings - steps: - - *fedora_install - - run: - name: Install clang and find - command: dnf install -y clang-analyzer findutils - - checkout - - *ninja_scan_build - - *export_logs - - run: - name: Check scan-build results - command: test ! -d ~/libinput/build/meson-logs/scanbuild || test $(find ~/libinput/build/meson-logs/scanbuild -maxdepth 0 ! -empty -exec echo "not empty" \; | wc -l) -eq 0 || (echo "Check scan-build results" && false) - -version: 2 -jobs: - fedora_latest: - <<: *fedora_build_all - docker: - - image: fedora:latest - ubuntu_17_10: - <<: *ubuntu_build_all - docker: - - image: ubuntu:artful - scan_build: - <<: *scan_build_run - docker: - - image: fedora:latest - -workflows: - version: 2 - compile: - jobs: - - fedora_latest - - scan_build - - ubuntu_17_10 diff -Nru libinput-1.10.3/CODING_STYLE libinput-0.21.0/CODING_STYLE --- libinput-1.10.3/CODING_STYLE 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/CODING_STYLE 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -- Indentation in tabs, 8 characters wide, spaces after the tabs where - vertical alignment is required (see below) - -- Max line width 80ch, do not break up printed strings though - -- Break up long lines at logical groupings, one line for each logical group - - int a = somelongname() + - someotherlongname(); - - if (a < 0 && - (b > 20 & d < 10) && - d != 0.0) - - - somelongfunctioncall(arg1, - arg2, - arg3); - -- Function declarations: return type on separate line, {} on separate line, - arguments broken up as above. - - static inline int - foobar(int a, int b) - { - - } - - void - somenamethatiswaytoolong(int a, - int b, - int c) - { - } - -- /* comments only */, no // comments - -- variable_name, not VariableName or variableName. same for functions. - -- no typedefs of structs, enums, unions - -- if it generates a compiler warning, it needs to be fixed -- if it generates a static checker warning, it needs to be fixed or - commented - -- declare variables at the top, try to keep them as local as possible. - Exception: if the same variable is re-used in multiple blocks, declare it - at the top. - - int a; - int c; - - if (foo) { - int b; - - c = get_value(); - usevalue(c); - } - - if (bar) { - c = get_value(); - useit(c); - } - -- do not mix function invocations and variable definitions. - - wrong: - - { - int a = foo(); - int b = 7; - } - - right: - { - int a; - int b = 7; - - a = foo(); - } - - There are exceptions here, e.g. tp_libinput_context(), - litest_current_device() - -- if/else: { on the same line, no curly braces if both blocks are a single - statement. If either if or else block are multiple statements, both must - have curly braces. - - if (foo) { - blah(); - bar(); - } else { - a = 10; - } - -- public functions MUST be doxygen-commented, use doxygen's @foo rather than - \foo notation - -- include "config.h" comes first, followed by system headers, followed by - external library headers, followed by internal headers. - sort alphabetically where it makes sense (specifically system headers) - - #include "config.h" - - #include - #include - - #include - - #include "libinput-private.h" - -- goto jumps only to the end of the function, and only for good reasons - (usually cleanup). goto never jumps backwards - -- Use stdbool.h's bool for booleans within the library (instead of 'int'). - Exception: the public API uses int, not bool. diff -Nru libinput-1.10.3/compile libinput-0.21.0/compile --- libinput-1.10.3/compile 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/compile 2015-08-04 00:31:39.000000000 +0000 @@ -0,0 +1,347 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-10-14.11; # UTC + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru libinput-1.10.3/config.guess libinput-0.21.0/config.guess --- libinput-1.10.3/config.guess 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/config.guess 2015-08-04 00:31:39.000000000 +0000 @@ -0,0 +1,1421 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2015 Free Software Foundation, Inc. + +timestamp='2015-01-01' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# +# Please send patches to . + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2015 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case ${UNAME_PROCESSOR} in + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW64*:*) + echo ${UNAME_MACHINE}-pc-mingw64 + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + *:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + aarch64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi + else + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + cris:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + crisv32:Linux:*:*) + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + frv:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + hexagon:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:Linux:*:*) + echo ${UNAME_MACHINE}-pc-linux-${LIBC} + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } + ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-${LIBC} + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-${LIBC} + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + tile*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-${LIBC} + exit ;; + x86_64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo ${UNAME_MACHINE}-unknown-esx + exit ;; +esac + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Nru libinput-1.10.3/config.h.in libinput-0.21.0/config.h.in --- libinput-1.10.3/config.h.in 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/config.h.in 2015-08-04 00:58:33.000000000 +0000 @@ -0,0 +1,109 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Path to addr2line */ +#undef ADDR2LINE + +/* addr2line found */ +#undef HAVE_ADDR2LINE + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `rt' library (-lrt). */ +#undef HAVE_LIBRT + +/* Have libunwind support */ +#undef HAVE_LIBUNWIND + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE diff -Nru libinput-1.10.3/config.sub libinput-0.21.0/config.sub --- libinput-1.10.3/config.sub 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/config.sub 2015-08-04 00:31:39.000000000 +0000 @@ -0,0 +1,1807 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2015 Free Software Foundation, Inc. + +timestamp='2015-01-01' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2015 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + android-linux) + os=-linux-android + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze*) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*178) + os=-lynxos178 + ;; + -lynx*5) + os=-lynxos5 + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | be32 | be64 \ + | bfin \ + | c4x | c8051 | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | epiphany \ + | fido | fr30 | frv | ft32 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | le32 | le64 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nios | nios2 | nios2eb | nios2el \ + | ns16k | ns32k \ + | open8 | or1k | or1knd | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pyramid \ + | riscv32 | riscv64 \ + | rl78 | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu \ + | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ + | we32k \ + | x86 | xc16x | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + c54x) + basic_machine=tic54x-unknown + ;; + c55x) + basic_machine=tic55x-unknown + ;; + c6x) + basic_machine=tic6x-unknown + ;; + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + strongarm | thumb | xscale) + basic_machine=arm-unknown + ;; + xgate) + basic_machine=$basic_machine-unknown + os=-none + ;; + xscaleeb) + basic_machine=armeb-unknown + ;; + + xscaleel) + basic_machine=armel-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | aarch64-* | aarch64_be-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | be32-* | be64-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | hexagon-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | k1om-* \ + | le32-* | le64-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nds32-* | nds32le-* | nds32be-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | open8-* \ + | or1k*-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pyramid-* \ + | rl78-* | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | tahoe-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tile*-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ + | vax-* \ + | visium-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c54x-*) + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c55x-*) + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c6x-*) + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16 | cr16-*) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze*) + basic_machine=microblaze-xilinx + ;; + mingw64) + basic_machine=x86_64-pc + os=-mingw64 + ;; + mingw32) + basic_machine=i686-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + msys) + basic_machine=i686-pc + os=-msys + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + nacl) + basic_machine=le32-unknown + os=-nacl + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + neo-tandem) + basic_machine=neo-tandem + ;; + nse-tandem) + basic_machine=nse-tandem + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc | ppcbe) basic_machine=powerpc-unknown + ;; + ppc-* | ppcbe-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-* | ppc64p7-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + strongarm-* | thumb-*) + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tile*) + basic_machine=$basic_machine-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + xscale-* | xscalee[bl]-*) + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* | -plan9* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -bitrig* | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-musl* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -nacl*) + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + c8051-*) + os=-elf + ;; + hexagon-*) + os=-elf + ;; + tic54x-*) + os=-coff + ;; + tic55x-*) + os=-coff + ;; + tic6x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff -Nru libinput-1.10.3/configure libinput-0.21.0/configure --- libinput-1.10.3/configure 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/configure 2015-08-04 00:58:30.000000000 +0000 @@ -0,0 +1,19672 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.69 for libinput 0.21.0. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=libinput&version=0.21.0 +$0: about your system, including any error possibly output +$0: before this message. Then install a modern shell, or +$0: manually run the script under such a shell if you do +$0: have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + +as_awk_strverscmp=' + # Use only awk features that work with 7th edition Unix awk (1978). + # My, what an old awk you have, Mr. Solaris! + END { + while (length(v1) && length(v2)) { + # Set d1 to be the next thing to compare from v1, and likewise for d2. + # Normally this is a single character, but if v1 and v2 contain digits, + # compare them as integers and fractions as strverscmp does. + if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) { + # Split v1 and v2 into their leading digit string components d1 and d2, + # and advance v1 and v2 past the leading digit strings. + for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue + for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue + d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1) + d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1) + if (d1 ~ /^0/) { + if (d2 ~ /^0/) { + # Compare two fractions. + while (d1 ~ /^0/ && d2 ~ /^0/) { + d1 = substr(d1, 2); len1-- + d2 = substr(d2, 2); len2-- + } + if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) { + # The two components differ in length, and the common prefix + # contains only leading zeros. Consider the longer to be less. + d1 = -len1 + d2 = -len2 + } else { + # Otherwise, compare as strings. + d1 = "x" d1 + d2 = "x" d2 + } + } else { + # A fraction is less than an integer. + exit 1 + } + } else { + if (d2 ~ /^0/) { + # An integer is greater than a fraction. + exit 2 + } else { + # Compare two integers. + d1 += 0 + d2 += 0 + } + } + } else { + # The normal case, without worrying about digits. + d1 = substr(v1, 1, 1); v1 = substr(v1, 2) + d2 = substr(v2, 1, 1); v2 = substr(v2, 2) + } + if (d1 < d2) exit 1 + if (d1 > d2) exit 2 + } + # Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10), + # which mishandles some comparisons of empty strings to integers. + if (length(v2)) exit 1 + if (length(v1)) exit 2 + } +' + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='libinput' +PACKAGE_TARNAME='libinput' +PACKAGE_VERSION='0.21.0' +PACKAGE_STRING='libinput 0.21.0' +PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=libinput&version=0.21.0' +PACKAGE_URL='http://www.freedesktop.org/wiki/Software/libinput/' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +UDEV_TEST_PATH +BUILD_DOCS_FALSE +BUILD_DOCS_TRUE +BUILD_TESTS_FALSE +BUILD_TESTS_TRUE +HAVE_VALGRIND_FALSE +HAVE_VALGRIND_TRUE +VALGRIND +CHECK_LIBS +CHECK_CFLAGS +BUILD_EVENTGUI_FALSE +BUILD_EVENTGUI_TRUE +GTK_LIBS +GTK_CFLAGS +CAIRO_LIBS +CAIRO_CFLAGS +DOT +DOXYGEN +UDEV_DIR +GCC_CXXFLAGS +GCC_CFLAGS +ADDR2LINE +HAVE_LIBUNWIND_FALSE +HAVE_LIBUNWIND_TRUE +LIBUNWIND_LIBS +LIBUNWIND_CFLAGS +LIBEVDEV_LIBS +LIBEVDEV_CFLAGS +LIBUDEV_LIBS +LIBUDEV_CFLAGS +MTDEV_LIBS +MTDEV_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +CXXCPP +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +ac_ct_AR +AR +DLLTOOL +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +SED +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +LIBTOOL +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +ac_ct_CXX +CXXFLAGS +CXX +EGREP +GREP +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +LIBINPUT_LT_VERSION +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +LIBINPUT_VERSION +LIBINPUT_VERSION_MICRO +LIBINPUT_VERSION_MINOR +LIBINPUT_VERSION_MAJOR +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_dependency_tracking +enable_shared +enable_static +with_pic +enable_fast_install +with_gnu_ld +with_sysroot +enable_libtool_lock +with_udev_dir +enable_documentation +enable_event_gui +enable_tests +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CXX +CXXFLAGS +CCC +CXXCPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +MTDEV_CFLAGS +MTDEV_LIBS +LIBUDEV_CFLAGS +LIBUDEV_LIBS +LIBEVDEV_CFLAGS +LIBEVDEV_LIBS +LIBUNWIND_CFLAGS +LIBUNWIND_LIBS +CAIRO_CFLAGS +CAIRO_LIBS +GTK_CFLAGS +GTK_LIBS +CHECK_CFLAGS +CHECK_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures libinput 0.21.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/libinput] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of libinput 0.21.0:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-documentation Enable building the documentation (default=auto) + --enable-event-gui Build the GUI event viewer (default=auto) + --enable-tests Build the tests (default=auto) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). + --with-udev-dir=DIR udev base directory [[default=$udev_dir_default]] + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CXXCPP C++ preprocessor + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + MTDEV_CFLAGS + C compiler flags for MTDEV, overriding pkg-config + MTDEV_LIBS linker flags for MTDEV, overriding pkg-config + LIBUDEV_CFLAGS + C compiler flags for LIBUDEV, overriding pkg-config + LIBUDEV_LIBS + linker flags for LIBUDEV, overriding pkg-config + LIBEVDEV_CFLAGS + C compiler flags for LIBEVDEV, overriding pkg-config + LIBEVDEV_LIBS + linker flags for LIBEVDEV, overriding pkg-config + LIBUNWIND_CFLAGS + C compiler flags for LIBUNWIND, overriding pkg-config + LIBUNWIND_LIBS + linker flags for LIBUNWIND, overriding pkg-config + CAIRO_CFLAGS + C compiler flags for CAIRO, overriding pkg-config + CAIRO_LIBS linker flags for CAIRO, overriding pkg-config + GTK_CFLAGS C compiler flags for GTK, overriding pkg-config + GTK_LIBS linker flags for GTK, overriding pkg-config + CHECK_CFLAGS + C compiler flags for CHECK, overriding pkg-config + CHECK_LIBS linker flags for CHECK, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +libinput home page: . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +libinput configure 0.21.0 +generated by GNU Autoconf 2.69 + +Copyright (C) 2012 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ----------------------------------------------------------------------------------------------------------- ## +## Report this to https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=libinput&version=0.21.0 ## +## ----------------------------------------------------------------------------------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_cxx_try_cpp LINENO +# ------------------------ +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_cpp + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by libinput $as_me 0.21.0, which was +generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +LIBINPUT_VERSION_MAJOR=0 + +LIBINPUT_VERSION_MINOR=21 + +LIBINPUT_VERSION_MICRO=0 + +LIBINPUT_VERSION=0.21.0 + + +ac_config_headers="$ac_config_headers config.h" + + + +am__api_version='1.15' + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='libinput' + VERSION='0.21.0' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + + +# Before making a release, the LIBINPUT_LT_VERSION string should be +# modified. +# The string is of the form C:R:A. +# a) If binary compatibility has been broken (eg removed or changed interfaces) +# change to C+1:0:0. DO NOT DO THIS! Use symbol versioning instead and +# do b) instead. +# b) If interfaces have been changed or added, but binary compatibility has +# been preserved, change to C+1:0:A+1 +# c) If the interface is the same as the previous version, change to C:R+1:A +LIBINPUT_LT_VERSION=15:0:5 + + +# Check whether --enable-silent-rules was given. +if test "${enable_silent_rules+set}" = set; then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=0;; +esac +am_make=${MAKE-make} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +$as_echo_n "checking whether $am_make supports nested variables... " >&6; } +if ${am_cv_make_support_nested_variables+:} false; then : + $as_echo_n "(cached) " >&6 +else + if $as_echo 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +$as_echo "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from 'make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } +if ${am_cv_prog_cc_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +$as_echo "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" +if test "x$ac_cv_header_minix_config_h" = xyes; then : + MINIX=yes +else + MINIX= +fi + + + if test "$MINIX" = yes; then + +$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h + + +$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h + + +$as_echo "#define _MINIX 1" >>confdefs.h + + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if ${ac_cv_safe_to_define___extensions__+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_define___extensions__=yes +else + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h + + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + + $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h + + + +# Check for programs + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 +$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } +if ${ac_cv_prog_cc_c99+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +#include + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static void +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str; + int number; + float fnumber; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); +} + +int +main () +{ + + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); + + ; + return 0; +} +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c99" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c99" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c99" != xno; then : + +fi + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if ${ac_cv_cxx_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if ${ac_cv_prog_cxx_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CXX" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CXX_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + # Only used by build C++ test +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + + +# Initialize libtool + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.2' +macro_revision='1.3337' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf + + + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +$as_echo_n "checking how to run the C++ preprocessor... " >&6; } +if test -z "$CXXCPP"; then + if ${ac_cv_prog_CXXCPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +$as_echo "$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +else + _lt_caught_CXX_error=yes +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +compiler_needs_object_CXX=no +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_direct_absolute_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_shlibpath_var_CXX=unsupported +hardcode_automatic_CXX=no +inherit_rpath_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +reload_flag_CXX=$reload_flag +reload_cmds_CXX=$reload_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + + # save warnings/boilerplate of simple test code + ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + + ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + compiler_CXX=$CC + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' + else + lt_prog_compiler_no_builtin_flag_CXX= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + ld_shlibs_CXX=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + file_list_spec_CXX='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec_CXX='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + always_export_symbols_CXX=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag_CXX='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath__CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath__CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + fi + archive_cmds_need_lc_CXX=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_CXX=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs_CXX=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_CXX=' ' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=yes + file_list_spec_CXX='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' + enable_shared_with_static_runtimes_CXX=yes + # Don't use ranlib + old_postinstall_cmds_CXX='chmod 644 $oldlib' + postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_CXX=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + + + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec_CXX='' + fi + link_all_deplibs_CXX=yes + allow_undefined_flag_CXX="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "$lt_cv_apple_cc_single_mod" != "yes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi + + else + ld_shlibs_CXX=no + fi + + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + ld_shlibs_CXX=no + ;; + + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + + gnu*) + ;; + + haiku*) + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs_CXX=yes + ;; + + hpux9*) + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='${wl}-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + export_dynamic_flag_spec_CXX='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + *) + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + interix[3-9]*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + inherit_rpath_CXX=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [1-5].* | *pgcpp\ [1-5].*) + prelink_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + old_archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object_CXX=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + ld_shlibs_CXX=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + hardcode_direct_absolute_CXX=yes + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + ld_shlibs_CXX=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + case $host in + osf3*) + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + ;; + *) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + ;; + esac + + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + archive_cmds_need_lc_CXX=yes + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_CXX='${wl}-z,text' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_CXX='${wl}-z,text' + allow_undefined_flag_CXX='${wl}-z,nodefs' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + export_dynamic_flag_spec_CXX='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ + '"$old_archive_cmds_CXX" + reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ + '"$reload_cmds_CXX" + ;; + *) + archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +$as_echo "$ld_shlibs_CXX" >&6; } + test "$ld_shlibs_CXX" = no && can_build_shared=no + + GCC_CXX="$GXX" + LD_CXX="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + # Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF + + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case ${prev}${p} in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test "$pre_test_object_deps_done" = no; then + case ${prev} in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX="${prev}${p}" + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX="${prev}${p}" + else + postdeps_CXX="${postdeps_CXX} ${prev}${p}" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX="$p" + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX="$p" + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +case $host_os in +interix[3-9]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + predep_objects_CXX= + postdep_objects_CXX= + postdeps_CXX= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC* | sunCC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac + + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + compiler_lib_search_dirs_CXX= +if test -n "${compiler_lib_search_path_CXX}"; then + compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + + + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic_CXX='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static_CXX= + ;; + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix[4-9]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-qpic' + lt_prog_compiler_static_CXX='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } +lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } +if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_CXX=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works_CXX=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_CXX=yes + fi + else + lt_cv_prog_compiler_static_works_CXX=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } + +if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then + : +else + lt_prog_compiler_static_CXX= +fi + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + case $host_os in + aix[4-9]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + ;; + esac + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +$as_echo "$ld_shlibs_CXX" >&6; } +test "$ld_shlibs_CXX" = no && can_build_shared=no + +with_gnu_ld_CXX=$with_gnu_ld + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc_CXX=no + else + lt_cv_archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } + archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || + test -n "$runpath_var_CXX" || + test "X$hardcode_automatic_CXX" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct_CXX" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 +$as_echo "$hardcode_action_CXX" >&6; } + +if test "$hardcode_action_CXX" = relink || + test "$inherit_rpath_CXX" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + +ac_fn_c_check_decl "$LINENO" "EPOLL_CLOEXEC" "ac_cv_have_decl_EPOLL_CLOEXEC" "#include +" +if test "x$ac_cv_have_decl_EPOLL_CLOEXEC" = xyes; then : + +else + as_fn_error $? "\"EPOLL_CLOEXEC is needed to compile libinput\"" "$LINENO" 5 +fi + +ac_fn_c_check_decl "$LINENO" "TFD_CLOEXEC" "ac_cv_have_decl_TFD_CLOEXEC" "#include +" +if test "x$ac_cv_have_decl_TFD_CLOEXEC" = xyes; then : + +else + as_fn_error $? "\"TFD_CLOEXEC is needed to compile libinput\"" "$LINENO" 5 +fi + +ac_fn_c_check_decl "$LINENO" "CLOCK_MONOTONIC" "ac_cv_have_decl_CLOCK_MONOTONIC" "#include +" +if test "x$ac_cv_have_decl_CLOCK_MONOTONIC" = xyes; then : + +else + as_fn_error $? "\"CLOCK_MONOTONIC is needed to compile libinput\"" "$LINENO" 5 +fi + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MTDEV" >&5 +$as_echo_n "checking for MTDEV... " >&6; } + +if test -n "$MTDEV_CFLAGS"; then + pkg_cv_MTDEV_CFLAGS="$MTDEV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mtdev >= 1.1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "mtdev >= 1.1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_MTDEV_CFLAGS=`$PKG_CONFIG --cflags "mtdev >= 1.1.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$MTDEV_LIBS"; then + pkg_cv_MTDEV_LIBS="$MTDEV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mtdev >= 1.1.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "mtdev >= 1.1.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_MTDEV_LIBS=`$PKG_CONFIG --libs "mtdev >= 1.1.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + MTDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "mtdev >= 1.1.0" 2>&1` + else + MTDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "mtdev >= 1.1.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$MTDEV_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (mtdev >= 1.1.0) were not met: + +$MTDEV_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables MTDEV_CFLAGS +and MTDEV_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables MTDEV_CFLAGS +and MTDEV_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + MTDEV_CFLAGS=$pkg_cv_MTDEV_CFLAGS + MTDEV_LIBS=$pkg_cv_MTDEV_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUDEV" >&5 +$as_echo_n "checking for LIBUDEV... " >&6; } + +if test -n "$LIBUDEV_CFLAGS"; then + pkg_cv_LIBUDEV_CFLAGS="$LIBUDEV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libudev\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libudev") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUDEV_CFLAGS=`$PKG_CONFIG --cflags "libudev" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBUDEV_LIBS"; then + pkg_cv_LIBUDEV_LIBS="$LIBUDEV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libudev\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libudev") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUDEV_LIBS=`$PKG_CONFIG --libs "libudev" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBUDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libudev" 2>&1` + else + LIBUDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libudev" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBUDEV_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libudev) were not met: + +$LIBUDEV_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables LIBUDEV_CFLAGS +and LIBUDEV_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables LIBUDEV_CFLAGS +and LIBUDEV_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + LIBUDEV_CFLAGS=$pkg_cv_LIBUDEV_CFLAGS + LIBUDEV_LIBS=$pkg_cv_LIBUDEV_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBEVDEV" >&5 +$as_echo_n "checking for LIBEVDEV... " >&6; } + +if test -n "$LIBEVDEV_CFLAGS"; then + pkg_cv_LIBEVDEV_CFLAGS="$LIBEVDEV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libevdev >= 0.4\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libevdev >= 0.4") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBEVDEV_CFLAGS=`$PKG_CONFIG --cflags "libevdev >= 0.4" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBEVDEV_LIBS"; then + pkg_cv_LIBEVDEV_LIBS="$LIBEVDEV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libevdev >= 0.4\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libevdev >= 0.4") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBEVDEV_LIBS=`$PKG_CONFIG --libs "libevdev >= 0.4" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBEVDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libevdev >= 0.4" 2>&1` + else + LIBEVDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libevdev >= 0.4" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBEVDEV_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libevdev >= 0.4) were not met: + +$LIBEVDEV_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables LIBEVDEV_CFLAGS +and LIBEVDEV_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables LIBEVDEV_CFLAGS +and LIBEVDEV_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + LIBEVDEV_CFLAGS=$pkg_cv_LIBEVDEV_CFLAGS + LIBEVDEV_LIBS=$pkg_cv_LIBEVDEV_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBUNWIND" >&5 +$as_echo_n "checking for LIBUNWIND... " >&6; } + +if test -n "$LIBUNWIND_CFLAGS"; then + pkg_cv_LIBUNWIND_CFLAGS="$LIBUNWIND_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libunwind") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUNWIND_CFLAGS=`$PKG_CONFIG --cflags "libunwind" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBUNWIND_LIBS"; then + pkg_cv_LIBUNWIND_LIBS="$LIBUNWIND_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libunwind\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libunwind") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBUNWIND_LIBS=`$PKG_CONFIG --libs "libunwind" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBUNWIND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libunwind" 2>&1` + else + LIBUNWIND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libunwind" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBUNWIND_PKG_ERRORS" >&5 + + HAVE_LIBUNWIND=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + HAVE_LIBUNWIND=no +else + LIBUNWIND_CFLAGS=$pkg_cv_LIBUNWIND_CFLAGS + LIBUNWIND_LIBS=$pkg_cv_LIBUNWIND_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_LIBUNWIND=yes +fi +if test "x$HAVE_LIBUNWIND" = "xyes"; then + +$as_echo "#define HAVE_LIBUNWIND 1" >>confdefs.h + +fi + if test "x$HAVE_LIBUNWIND" = xyes; then + HAVE_LIBUNWIND_TRUE= + HAVE_LIBUNWIND_FALSE='#' +else + HAVE_LIBUNWIND_TRUE='#' + HAVE_LIBUNWIND_FALSE= +fi + +# Extract the first word of "addr2line", so it can be a program name with args. +set dummy addr2line; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ADDR2LINE+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ADDR2LINE in + [\\/]* | ?:[\\/]*) + ac_cv_path_ADDR2LINE="$ADDR2LINE" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ADDR2LINE="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ADDR2LINE=$ac_cv_path_ADDR2LINE +if test -n "$ADDR2LINE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ADDR2LINE" >&5 +$as_echo "$ADDR2LINE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +if test "x$ADDR2LINE" != "x"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_ADDR2LINE 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define ADDR2LINE "$ADDR2LINE" +_ACEOF + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for atan2 in -lm" >&5 +$as_echo_n "checking for atan2 in -lm... " >&6; } +if ${ac_cv_lib_m_atan2+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char atan2 (); +int +main () +{ +return atan2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_m_atan2=yes +else + ac_cv_lib_m_atan2=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_atan2" >&5 +$as_echo "$ac_cv_lib_m_atan2" >&6; } +if test "x$ac_cv_lib_m_atan2" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBM 1 +_ACEOF + + LIBS="-lm $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 +$as_echo_n "checking for clock_gettime in -lrt... " >&6; } +if ${ac_cv_lib_rt_clock_gettime+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_clock_gettime=yes +else + ac_cv_lib_rt_clock_gettime=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 +$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } +if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBRT 1 +_ACEOF + + LIBS="-lrt $LIBS" + +fi + + +if test "x$GCC" = "xyes"; then + GCC_CXXFLAGS="-Wall -Wextra -Wno-unused-parameter -g -fvisibility=hidden" + GCC_CFLAGS="$GCC_CXXFLAGS -Wmissing-prototypes -Wstrict-prototypes" +fi + + + +udev_dir_default="$libdir/udev" + +# Check whether --with-udev-dir was given. +if test "${with_udev_dir+set}" = set; then : + withval=$with_udev_dir; +else + with_udev_dir="yes" +fi + +case $with_udev_dir in #( + no|"") : + as_fn_error $? "You must define a udev base directory" "$LINENO" 5 ;; #( + yes) : + udevdir="$udev_dir_default" ;; #( + *) : + udevdir="$with_udev_dir" ;; +esac +UDEV_DIR=${udevdir} + + +# Check whether --enable-documentation was given. +if test "${enable_documentation+set}" = set; then : + enableval=$enable_documentation; build_documentation="$enableval" +else + build_documentation="auto" +fi + + +if test "x$build_documentation" = "xyes" -o "x$build_documentation" = "xauto"; then + # Extract the first word of "doxygen", so it can be a program name with args. +set dummy doxygen; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DOXYGEN+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DOXYGEN in + [\\/]* | ?:[\\/]*) + ac_cv_path_DOXYGEN="$DOXYGEN" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_DOXYGEN="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +DOXYGEN=$ac_cv_path_DOXYGEN +if test -n "$DOXYGEN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOXYGEN" >&5 +$as_echo "$DOXYGEN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$DOXYGEN" = "x"; then + if test "x$build_documentation" = "xyes"; then + as_fn_error $? "Documentation build requested but doxygen not found. Install doxygen or disable the documentation using --disable-documentation" "$LINENO" 5 + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compatible doxygen version" >&5 +$as_echo_n "checking for compatible doxygen version... " >&6; } + doxygen_version=`$DOXYGEN --version` + as_arg_v1=$doxygen_version +as_arg_v2=1.6.0 +awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null +case $? in #( + 1) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + DOXYGEN="" ;; #( + 0) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } ;; #( + 2) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } ;; #( + *) : + ;; +esac + if test "x$DOXYGEN" = "x" -a "x$build_documentation" = "xyes"; then + as_fn_error $? "Doxygen $doxygen_version too old. Doxygen 1.6+ required for documentation build. Install required doxygen version or disable the documentation using --disable-documentation" "$LINENO" 5 + fi + fi + + # Extract the first word of "dot", so it can be a program name with args. +set dummy dot; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_DOT+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $DOT in + [\\/]* | ?:[\\/]*) + ac_cv_path_DOT="$DOT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_DOT="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +DOT=$ac_cv_path_DOT +if test -n "$DOT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5 +$as_echo "$DOT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$DOT" = "x"; then + if test "x$build_documentation" = "xyes"; then + as_fn_error $? "Documentation build requested but graphviz's dot not found. Install graphviz or disable the documentation using --disable-documentation" "$LINENO" 5 + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compatible dot version" >&5 +$as_echo_n "checking for compatible dot version... " >&6; } + dot_version=`$DOT -V 2>&1|$GREP -oP '(?<=version\W)[0-9.]*(?=\W(.*))'` + as_arg_v1=$dot_version +as_arg_v2=2.26.0 +awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null +case $? in #( + 1) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + DOT="" ;; #( + 0) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } ;; #( + 2) : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } ;; #( + *) : + ;; +esac + if test "x$DOT" = "x" -a "x$build_documentation" = "xyes"; then + as_fn_error $? "Graphviz dot $dot_version too old. Graphviz 2.26+ required for documentation build. Install required graphviz version or disable the documentation using --disable-documentation" "$LINENO" 5 + fi + fi + + if test "x$DOXYGEN" != "x" -a "x$DOT" != "x"; then + build_documentation="yes" + else + build_documentation="no" + fi +fi + +# Check whether --enable-event-gui was given. +if test "${enable_event_gui+set}" = set; then : + enableval=$enable_event_gui; build_eventgui="$enableval" +else + build_eventgui="auto" +fi + +if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo glib-2.0 gtk+-3.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "cairo glib-2.0 gtk+-3.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + HAVE_GUILIBS="yes" +else + HAVE_GUILIBS="no" +fi + +if test "x$build_eventgui" = "xauto"; then + build_eventgui="$HAVE_GUILIBS" +fi +if test "x$build_eventgui" = "xyes"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CAIRO" >&5 +$as_echo_n "checking for CAIRO... " >&6; } + +if test -n "$CAIRO_CFLAGS"; then + pkg_cv_CAIRO_CFLAGS="$CAIRO_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo\""; } >&5 + ($PKG_CONFIG --exists --print-errors "cairo") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CAIRO_CFLAGS=`$PKG_CONFIG --cflags "cairo" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$CAIRO_LIBS"; then + pkg_cv_CAIRO_LIBS="$CAIRO_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cairo\""; } >&5 + ($PKG_CONFIG --exists --print-errors "cairo") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CAIRO_LIBS=`$PKG_CONFIG --libs "cairo" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + CAIRO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "cairo" 2>&1` + else + CAIRO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "cairo" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$CAIRO_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (cairo) were not met: + +$CAIRO_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables CAIRO_CFLAGS +and CAIRO_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables CAIRO_CFLAGS +and CAIRO_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + CAIRO_CFLAGS=$pkg_cv_CAIRO_CFLAGS + CAIRO_LIBS=$pkg_cv_CAIRO_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK" >&5 +$as_echo_n "checking for GTK... " >&6; } + +if test -n "$GTK_CFLAGS"; then + pkg_cv_GTK_CFLAGS="$GTK_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 gtk+-3.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 gtk+-3.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GTK_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 gtk+-3.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GTK_LIBS"; then + pkg_cv_GTK_LIBS="$GTK_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 gtk+-3.0\""; } >&5 + ($PKG_CONFIG --exists --print-errors "glib-2.0 gtk+-3.0") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GTK_LIBS=`$PKG_CONFIG --libs "glib-2.0 gtk+-3.0" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GTK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 gtk+-3.0" 2>&1` + else + GTK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 gtk+-3.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GTK_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (glib-2.0 gtk+-3.0) were not met: + +$GTK_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GTK_CFLAGS +and GTK_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables GTK_CFLAGS +and GTK_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + GTK_CFLAGS=$pkg_cv_GTK_CFLAGS + GTK_LIBS=$pkg_cv_GTK_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi +fi + if test "x$build_eventgui" = "xyes"; then + BUILD_EVENTGUI_TRUE= + BUILD_EVENTGUI_FALSE='#' +else + BUILD_EVENTGUI_TRUE='#' + BUILD_EVENTGUI_FALSE= +fi + + +# Check whether --enable-tests was given. +if test "${enable_tests+set}" = set; then : + enableval=$enable_tests; build_tests="$enableval" +else + build_tests="auto" +fi + + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CHECK" >&5 +$as_echo_n "checking for CHECK... " >&6; } + +if test -n "$CHECK_CFLAGS"; then + pkg_cv_CHECK_CFLAGS="$CHECK_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"check >= 0.9.10\""; } >&5 + ($PKG_CONFIG --exists --print-errors "check >= 0.9.10") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CHECK_CFLAGS=`$PKG_CONFIG --cflags "check >= 0.9.10" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$CHECK_LIBS"; then + pkg_cv_CHECK_LIBS="$CHECK_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"check >= 0.9.10\""; } >&5 + ($PKG_CONFIG --exists --print-errors "check >= 0.9.10") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CHECK_LIBS=`$PKG_CONFIG --libs "check >= 0.9.10" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + CHECK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "check >= 0.9.10" 2>&1` + else + CHECK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "check >= 0.9.10" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$CHECK_PKG_ERRORS" >&5 + + HAVE_CHECK="no" +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + HAVE_CHECK="no" +else + CHECK_CFLAGS=$pkg_cv_CHECK_CFLAGS + CHECK_LIBS=$pkg_cv_CHECK_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_CHECK="yes" +fi + +if test "x$build_tests" = "xauto"; then + build_tests="$HAVE_CHECK" +fi +if test "x$build_tests" = "xyes"; then + if test "x$HAVE_CHECK" = "xno"; then + as_fn_error $? "Cannot build tests, check is missing" "$LINENO" 5 + fi + + # Extract the first word of "valgrind", so it can be a program name with args. +set dummy valgrind; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_VALGRIND+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $VALGRIND in + [\\/]* | ?:[\\/]*) + ac_cv_path_VALGRIND="$VALGRIND" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_VALGRIND="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +VALGRIND=$ac_cv_path_VALGRIND +if test -n "$VALGRIND"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VALGRIND" >&5 +$as_echo "$VALGRIND" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi + + if test "x$VALGRIND" != "x"; then + HAVE_VALGRIND_TRUE= + HAVE_VALGRIND_FALSE='#' +else + HAVE_VALGRIND_TRUE='#' + HAVE_VALGRIND_FALSE= +fi + + if test "x$build_tests" = "xyes"; then + BUILD_TESTS_TRUE= + BUILD_TESTS_FALSE='#' +else + BUILD_TESTS_TRUE='#' + BUILD_TESTS_FALSE= +fi + + if test "x$build_documentation" = "xyes"; then + BUILD_DOCS_TRUE= + BUILD_DOCS_FALSE='#' +else + BUILD_DOCS_TRUE='#' + BUILD_DOCS_FALSE= +fi + + +# Used by the udev rules so we can use callouts during testing without +# installing everything first. Default is the empty string so the installed +# rule will use udev's default path. Override is in udev/Makefile.am +UDEV_TEST_PATH="" + +# Extract the first word of "sed", so it can be a program name with args. +set dummy sed; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $SED in + [\\/]* | ?:[\\/]*) + ac_cv_path_SED="$SED" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +SED=$ac_cv_path_SED +if test -n "$SED"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 +$as_echo "$SED" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +ac_config_files="$ac_config_files Makefile doc/Makefile doc/libinput.doxygen src/Makefile src/libinput.pc src/libinput-version.h test/Makefile tools/Makefile udev/Makefile udev/80-libinput-device-groups.rules udev/90-libinput-model-quirks.rules" + +ac_config_files="$ac_config_files test/symbols-leak-test" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +$as_echo_n "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 +$as_echo "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_LIBUNWIND_TRUE}" && test -z "${HAVE_LIBUNWIND_FALSE}"; then + as_fn_error $? "conditional \"HAVE_LIBUNWIND\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_EVENTGUI_TRUE}" && test -z "${BUILD_EVENTGUI_FALSE}"; then + as_fn_error $? "conditional \"BUILD_EVENTGUI\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${HAVE_VALGRIND_TRUE}" && test -z "${HAVE_VALGRIND_FALSE}"; then + as_fn_error $? "conditional \"HAVE_VALGRIND\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_TESTS_TRUE}" && test -z "${BUILD_TESTS_FALSE}"; then + as_fn_error $? "conditional \"BUILD_TESTS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${BUILD_DOCS_TRUE}" && test -z "${BUILD_DOCS_FALSE}"; then + as_fn_error $? "conditional \"BUILD_DOCS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by libinput $as_me 0.21.0, which was +generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to . +libinput home page: ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +libinput config.status 0.21.0 +configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2012 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' +predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' +postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' +predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' +postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' +LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' +reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' +reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' +GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' +inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' +always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' +predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' +postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' +predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' +postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +nm_file_list_spec \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib \ +compiler_lib_search_dirs \ +predep_objects \ +postdep_objects \ +predeps \ +postdeps \ +compiler_lib_search_path \ +LD_CXX \ +reload_flag_CXX \ +compiler_CXX \ +lt_prog_compiler_no_builtin_flag_CXX \ +lt_prog_compiler_pic_CXX \ +lt_prog_compiler_wl_CXX \ +lt_prog_compiler_static_CXX \ +lt_cv_prog_compiler_c_o_CXX \ +export_dynamic_flag_spec_CXX \ +whole_archive_flag_spec_CXX \ +compiler_needs_object_CXX \ +with_gnu_ld_CXX \ +allow_undefined_flag_CXX \ +no_undefined_flag_CXX \ +hardcode_libdir_flag_spec_CXX \ +hardcode_libdir_separator_CXX \ +exclude_expsyms_CXX \ +include_expsyms_CXX \ +file_list_spec_CXX \ +compiler_lib_search_dirs_CXX \ +predep_objects_CXX \ +postdep_objects_CXX \ +predeps_CXX \ +postdeps_CXX \ +compiler_lib_search_path_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec \ +reload_cmds_CXX \ +old_archive_cmds_CXX \ +old_archive_from_new_cmds_CXX \ +old_archive_from_expsyms_cmds_CXX \ +archive_cmds_CXX \ +archive_expsym_cmds_CXX \ +module_cmds_CXX \ +module_expsym_cmds_CXX \ +export_symbols_cmds_CXX \ +prelink_cmds_CXX \ +postlink_cmds_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "doc/libinput.doxygen") CONFIG_FILES="$CONFIG_FILES doc/libinput.doxygen" ;; + "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "src/libinput.pc") CONFIG_FILES="$CONFIG_FILES src/libinput.pc" ;; + "src/libinput-version.h") CONFIG_FILES="$CONFIG_FILES src/libinput-version.h" ;; + "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; + "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; + "udev/Makefile") CONFIG_FILES="$CONFIG_FILES udev/Makefile" ;; + "udev/80-libinput-device-groups.rules") CONFIG_FILES="$CONFIG_FILES udev/80-libinput-device-groups.rules" ;; + "udev/90-libinput-model-quirks.rules") CONFIG_FILES="$CONFIG_FILES udev/90-libinput-model-quirks.rules" ;; + "test/symbols-leak-test") CONFIG_FILES="$CONFIG_FILES test/symbols-leak-test" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named 'Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running 'make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "$am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="CXX " + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects +postdep_objects=$lt_postdep_objects +predeps=$lt_predeps +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_CXX +reload_cmds=$lt_reload_cmds_CXX + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_CXX + +# A language specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU compiler? +with_gcc=$GCC_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_CXX + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_CXX + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute_CXX + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_CXX + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_CXX + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_CXX + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_CXX + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects_CXX +postdep_objects=$lt_postdep_objects_CXX +predeps=$lt_predeps_CXX +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# ### END LIBTOOL TAG CONFIG: CXX +_LT_EOF + + ;; + "test/symbols-leak-test":F) chmod +x test/symbols-leak-test ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: + Prefix ${prefix} + udev base dir ${UDEV_DIR} + + Build documentation ${build_documentation} + Build tests ${build_tests} + Tests use valgrind ${VALGRIND} + Tests use libunwind ${HAVE_LIBUNWIND} + Build GUI event tool ${build_eventgui} + " >&5 +$as_echo " + Prefix ${prefix} + udev base dir ${UDEV_DIR} + + Build documentation ${build_documentation} + Build tests ${build_tests} + Tests use valgrind ${VALGRIND} + Tests use libunwind ${HAVE_LIBUNWIND} + Build GUI event tool ${build_eventgui} + " >&6; } diff -Nru libinput-1.10.3/configure.ac libinput-0.21.0/configure.ac --- libinput-1.10.3/configure.ac 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/configure.ac 2015-08-04 00:33:56.000000000 +0000 @@ -0,0 +1,217 @@ +AC_PREREQ([2.64]) + +m4_define([libinput_major_version], [0]) +m4_define([libinput_minor_version], [21]) +m4_define([libinput_micro_version], [0]) +m4_define([libinput_version], + [libinput_major_version.libinput_minor_version.libinput_micro_version]) + +AC_INIT([libinput], + [libinput_version], + [https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=libinput&version=libinput_version], + [libinput], + [http://www.freedesktop.org/wiki/Software/libinput/]) + +AC_SUBST([LIBINPUT_VERSION_MAJOR], [libinput_major_version]) +AC_SUBST([LIBINPUT_VERSION_MINOR], [libinput_minor_version]) +AC_SUBST([LIBINPUT_VERSION_MICRO], [libinput_micro_version]) +AC_SUBST([LIBINPUT_VERSION], [libinput_version]) + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) + +AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz]) + +# Before making a release, the LIBINPUT_LT_VERSION string should be +# modified. +# The string is of the form C:R:A. +# a) If binary compatibility has been broken (eg removed or changed interfaces) +# change to C+1:0:0. DO NOT DO THIS! Use symbol versioning instead and +# do b) instead. +# b) If interfaces have been changed or added, but binary compatibility has +# been preserved, change to C+1:0:A+1 +# c) If the interface is the same as the previous version, change to C:R+1:A +LIBINPUT_LT_VERSION=15:0:5 +AC_SUBST(LIBINPUT_LT_VERSION) + +AM_SILENT_RULES([yes]) +AC_USE_SYSTEM_EXTENSIONS + +# Check for programs +AC_PROG_CC_C99 +AC_PROG_CXX # Only used by build C++ test +AC_PROG_GREP + +# Initialize libtool +LT_PREREQ([2.2]) +LT_INIT + +AC_CHECK_DECL(EPOLL_CLOEXEC, [], + [AC_MSG_ERROR("EPOLL_CLOEXEC is needed to compile libinput")], + [[#include ]]) +AC_CHECK_DECL(TFD_CLOEXEC,[], + [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile libinput")], + [[#include ]]) +AC_CHECK_DECL(CLOCK_MONOTONIC,[], + [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile libinput")], + [[#include ]]) + +PKG_PROG_PKG_CONFIG() +PKG_CHECK_MODULES(MTDEV, [mtdev >= 1.1.0]) +PKG_CHECK_MODULES(LIBUDEV, [libudev]) +PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4]) +PKG_CHECK_MODULES(LIBUNWIND, + [libunwind], + [HAVE_LIBUNWIND=yes], + [HAVE_LIBUNWIND=no]) +if test "x$HAVE_LIBUNWIND" = "xyes"; then + AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support]) +fi +AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$HAVE_LIBUNWIND" = xyes]) +AC_PATH_PROG(ADDR2LINE, [addr2line]) +if test "x$ADDR2LINE" != "x"; then + AC_DEFINE_UNQUOTED(HAVE_ADDR2LINE, 1, [addr2line found]) + AC_DEFINE_UNQUOTED(ADDR2LINE, ["$ADDR2LINE"], [Path to addr2line]) +fi + +AC_CHECK_LIB([m], [atan2]) +AC_CHECK_LIB([rt], [clock_gettime]) + +if test "x$GCC" = "xyes"; then + GCC_CXXFLAGS="-Wall -Wextra -Wno-unused-parameter -g -fvisibility=hidden" + GCC_CFLAGS="$GCC_CXXFLAGS -Wmissing-prototypes -Wstrict-prototypes" +fi +AC_SUBST(GCC_CFLAGS) +AC_SUBST(GCC_CXXFLAGS) + +udev_dir_default="$libdir/udev" +AC_ARG_WITH(udev-dir, + AS_HELP_STRING([--with-udev-dir=DIR], + [udev base directory [[default=$udev_dir_default]]]), + [], + [with_udev_dir="yes"]) +AS_CASE($with_udev_dir, + [no|""], [AC_MSG_ERROR([You must define a udev base directory])], + [yes], [udevdir="$udev_dir_default"], + [udevdir="$with_udev_dir"]) +UDEV_DIR=${udevdir} +AC_SUBST(UDEV_DIR) + +AC_ARG_ENABLE([documentation], + [AC_HELP_STRING([--enable-documentation], + [Enable building the documentation (default=auto)])], + [build_documentation="$enableval"], + [build_documentation="auto"]) + +if test "x$build_documentation" = "xyes" -o "x$build_documentation" = "xauto"; then + AC_PATH_PROG(DOXYGEN, doxygen) + if test "x$DOXYGEN" = "x"; then + if test "x$build_documentation" = "xyes"; then + AC_MSG_ERROR([Documentation build requested but doxygen not found. Install doxygen or disable the documentation using --disable-documentation]) + fi + else + AC_MSG_CHECKING([for compatible doxygen version]) + doxygen_version=`$DOXYGEN --version` + AS_VERSION_COMPARE([$doxygen_version], [1.6.0], + [AC_MSG_RESULT([no]) + DOXYGEN=""], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([yes])]) + if test "x$DOXYGEN" = "x" -a "x$build_documentation" = "xyes"; then + AC_MSG_ERROR([Doxygen $doxygen_version too old. Doxygen 1.6+ required for documentation build. Install required doxygen version or disable the documentation using --disable-documentation]) + fi + fi + + AC_PATH_PROG(DOT, dot) + if test "x$DOT" = "x"; then + if test "x$build_documentation" = "xyes"; then + AC_MSG_ERROR([Documentation build requested but graphviz's dot not found. Install graphviz or disable the documentation using --disable-documentation]) + fi + else + AC_MSG_CHECKING([for compatible dot version]) + dot_version=`$DOT -V 2>&1|$GREP -oP '(?<=version\W)@<:@0-9.@:>@*(?=\W(.*))'` + AS_VERSION_COMPARE([$dot_version], [2.26.0], + [AC_MSG_RESULT([no]) + DOT=""], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([yes])]) + if test "x$DOT" = "x" -a "x$build_documentation" = "xyes"; then + AC_MSG_ERROR([Graphviz dot $dot_version too old. Graphviz 2.26+ required for documentation build. Install required graphviz version or disable the documentation using --disable-documentation]) + fi + fi + + if test "x$DOXYGEN" != "x" -a "x$DOT" != "x"; then + build_documentation="yes" + else + build_documentation="no" + fi +fi + +AC_ARG_ENABLE(event-gui, + AS_HELP_STRING([--enable-event-gui], [Build the GUI event viewer (default=auto)]), + [build_eventgui="$enableval"], + [build_eventgui="auto"]) +PKG_CHECK_EXISTS([cairo glib-2.0 gtk+-3.0], [HAVE_GUILIBS="yes"], [HAVE_GUILIBS="no"]) + +if test "x$build_eventgui" = "xauto"; then + build_eventgui="$HAVE_GUILIBS" +fi +if test "x$build_eventgui" = "xyes"; then + PKG_CHECK_MODULES(CAIRO, [cairo]) + PKG_CHECK_MODULES(GTK, [glib-2.0 gtk+-3.0]) +fi +AM_CONDITIONAL(BUILD_EVENTGUI, [test "x$build_eventgui" = "xyes"]) + +AC_ARG_ENABLE(tests, + AS_HELP_STRING([--enable-tests], [Build the tests (default=auto)]), + [build_tests="$enableval"], + [build_tests="auto"]) + +PKG_CHECK_MODULES(CHECK, [check >= 0.9.10], [HAVE_CHECK="yes"], [HAVE_CHECK="no"]) + +if test "x$build_tests" = "xauto"; then + build_tests="$HAVE_CHECK" +fi +if test "x$build_tests" = "xyes"; then + if test "x$HAVE_CHECK" = "xno"; then + AC_MSG_ERROR([Cannot build tests, check is missing]) + fi + + AC_PATH_PROG(VALGRIND, [valgrind]) +fi + +AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"]) +AM_CONDITIONAL(BUILD_TESTS, [test "x$build_tests" = "xyes"]) +AM_CONDITIONAL(BUILD_DOCS, [test "x$build_documentation" = "xyes"]) + +# Used by the udev rules so we can use callouts during testing without +# installing everything first. Default is the empty string so the installed +# rule will use udev's default path. Override is in udev/Makefile.am +AC_SUBST(UDEV_TEST_PATH, "") +AC_PATH_PROG(SED, [sed]) + +AC_CONFIG_FILES([Makefile + doc/Makefile + doc/libinput.doxygen + src/Makefile + src/libinput.pc + src/libinput-version.h + test/Makefile + tools/Makefile + udev/Makefile + udev/80-libinput-device-groups.rules + udev/90-libinput-model-quirks.rules]) +AC_CONFIG_FILES([test/symbols-leak-test], + [chmod +x test/symbols-leak-test]) +AC_OUTPUT + +AC_MSG_RESULT([ + Prefix ${prefix} + udev base dir ${UDEV_DIR} + + Build documentation ${build_documentation} + Build tests ${build_tests} + Tests use valgrind ${VALGRIND} + Tests use libunwind ${HAVE_LIBUNWIND} + Build GUI event tool ${build_eventgui} + ]) diff -Nru libinput-1.10.3/debian/changelog libinput-0.21.0/debian/changelog --- libinput-1.10.3/debian/changelog 2018-03-18 13:39:44.000000000 +0000 +++ libinput-0.21.0/debian/changelog 2018-04-02 22:49:02.000000000 +0000 @@ -1,287 +1,18 @@ -libinput (1.10.3-2) unstable; urgency=medium +libinput (0.21.0-1ubuntu1~ppa1404+1) trusty; urgency=medium - [ Jeremy Bicha ] - * control: Update VCS urls. - * control: Add more packages to libinput-dev Depends as a workaround for - buggy meson/pkg-config. (Closes: #893067) + * Upload to trusty PPA - -- Timo Aaltonen Sun, 18 Mar 2018 15:39:44 +0200 + -- Thorsten Glaser Tue, 03 Apr 2018 00:49:02 +0200 -libinput (1.10.3-1) unstable; urgency=medium +libinput (0.21.0-1ubuntu1) wily; urgency=medium - * New upstream release. (Closes: #892714) + * debian/patches/touch-point-orientation-size.patch: + * debian/patches/fix-litest.patch: + - Add support for touchscreen contact properties (LP: #1488064) + * debian/libinput10.symbols: + - Updated - -- Timo Aaltonen Wed, 14 Mar 2018 11:04:22 +0200 - -libinput (1.10.2-1) unstable; urgency=medium - - * New upstream release. - - touchpad fixes (LP: #1751190) - - -- Timo Aaltonen Wed, 07 Mar 2018 17:51:58 +0200 - -libinput (1.10.1-1) unstable; urgency=medium - - * New upstream release. - - fix crashers (Closes: #891579) (LP: #1750664) - - -- Timo Aaltonen Wed, 28 Feb 2018 18:20:21 +0200 - -libinput (1.10.0-1) unstable; urgency=medium - - * New upstream release. (LP: #1749340) - - -- Timo Aaltonen Thu, 15 Feb 2018 22:14:47 +0200 - -libinput (1.9.4-2) unstable; urgency=medium - - * Drop the patch, it doesn't work well enough detecting when to - disable hysteresis. (Closes: #884599) - - -- Timo Aaltonen Mon, 18 Dec 2017 00:22:44 +0200 - -libinput (1.9.4-1) unstable; urgency=medium - - * New upstream release. - * Add fix-lp1696929.patch to fix unresponsive/laggy touchpad behaviour - caused by inappropriate use of software hysteresis (LP: #1696929). - Thanks, Daniel van Vugt! - - -- Timo Aaltonen Thu, 14 Dec 2017 12:40:25 +0200 - -libinput (1.9.3-1) unstable; urgency=medium - - * New upstream release. - - -- Emilio Pozuelo Monfort Thu, 30 Nov 2017 20:05:41 +0100 - -libinput (1.9.2-1) unstable; urgency=medium - - * New upstream release. - * Switch to meson. - * Add new symbols. - * Move libinput-{dev,tools} to priority optional. - * Add python3 dependencies for new python scripts. - - -- Emilio Pozuelo Monfort Sat, 18 Nov 2017 18:47:56 +0100 - -libinput (1.8.3-1) unstable; urgency=medium - - * New upstream release. - * Bump Standards-Version to 4.1.1; no changes needed. - - -- Emilio Pozuelo Monfort Tue, 10 Oct 2017 20:18:13 +0200 - -libinput (1.8.2-1) unstable; urgency=medium - - * New upstream release. - * local-options: Add circle.yml to extend-diff-ignore. - * Bump Standards-Version to 4.1.0; no changes needed. - * Bump debhelper compat to 10. - + dh-autoreconf is enabled by default in compat 10. - - -- Emilio Pozuelo Monfort Sat, 09 Sep 2017 14:20:15 +0200 - -libinput (1.8.0-1) unstable; urgency=medium - - * New upstream release. - * rules: Explicitly disable building debug-gui, documentation and - tests. - * tools: Add debug tools. - - -- Timo Aaltonen Thu, 06 Jul 2017 00:56:56 +0300 - -libinput (1.7.3-1) unstable; urgency=medium - - * New upstream release. - - -- Timo Aaltonen Tue, 20 Jun 2017 19:18:50 +0300 - -libinput (1.7.2-1) experimental; urgency=medium - - * New upstream release. - * local-options: Add test/generate-gcov-report.sh to extend-diff- - ignore. - * Update symbols file. - - -- Timo Aaltonen Wed, 17 May 2017 15:53:14 +0300 - -libinput (1.6.3-1) unstable; urgency=medium - - * New upstream release. - - -- Timo Aaltonen Tue, 14 Mar 2017 13:36:36 +0200 - -libinput (1.6.2-1) unstable; urgency=medium - - * New upstream release. - + Fixes slow tap timeout. Closes: #853869. - * Bump libwacom-dev requirement to 0.20. - - -- Emilio Pozuelo Monfort Mon, 27 Feb 2017 20:23:59 +0100 - -libinput (1.6.0-1) unstable; urgency=medium - - * New upstream release. - - -- Emilio Pozuelo Monfort Wed, 25 Jan 2017 00:24:53 +0100 - -libinput (1.5.4-1) unstable; urgency=medium - - * New upstream release. - - -- Emilio Pozuelo Monfort Tue, 17 Jan 2017 20:21:47 +0100 - -libinput (1.5.3-1) unstable; urgency=medium - - * New upstream release. - - -- Timo Aaltonen Thu, 08 Dec 2016 16:18:19 +0200 - -libinput (1.5.2-1) unstable; urgency=medium - - * New upstream release. - * control: Add libudev-dev to libinput-dev depends. (Closes: #846506) - - -- Timo Aaltonen Fri, 02 Dec 2016 10:07:40 +0200 - -libinput (1.5.1-1) unstable; urgency=medium - - * New upstream release. - * watch: Let uscan verify tarball signatures. - - -- Timo Aaltonen Fri, 18 Nov 2016 15:58:09 +0200 - -libinput (1.5.0-1) unstable; urgency=medium - - * New upstream release. - * debian/libinput10.symbols: add new symbols. - - -- Emilio Pozuelo Monfort Wed, 14 Sep 2016 11:45:02 +0200 - -libinput (1.4.1-1) unstable; urgency=medium - - * New upstream release - - -- Héctor Orón Martínez Fri, 19 Aug 2016 08:56:04 +0200 - -libinput (1.4.0-1) unstable; urgency=medium - - * New upstream release. - * debian/libinput10.symbols: add new symbols. - - -- Emilio Pozuelo Monfort Mon, 01 Aug 2016 17:54:58 +0200 - -libinput (1.3.3-1) unstable; urgency=medium - - * New upstream release. - - -- Emilio Pozuelo Monfort Sun, 17 Jul 2016 18:56:44 +0200 - -libinput (1.3.1-1) unstable; urgency=medium - - * New upstream release. - - Fixes 'libinput is very choppy with ELAN1000 touchpads' - (Closes: #825784) - - -- Héctor Orón Martínez Mon, 30 May 2016 12:29:50 +0200 - -libinput (1.3.0-2) unstable; urgency=medium - - * rules: Use --fail-missing for dh_install. - * rules: Use proper udev base dir. - * rules: Purge .la files. - * Install udev quirks and helpers in libinput-bin. (Closes: #822872) - * Drop manual -dbg package. - * control: Fix Vcs-Git url. - * copyright: Update license, copyrights. - - -- Timo Aaltonen Fri, 13 May 2016 14:24:09 +0300 - -libinput (1.3.0-1) unstable; urgency=medium - - * New upstream release. - * symbols: Updated. - * control: Use https vcs urls. - - -- Timo Aaltonen Tue, 10 May 2016 11:01:43 +0300 - -libinput (1.2.4-1) unstable; urgency=medium - - * New upstream release. - * copyright: Drop trailing / from Files-Excluded. - - -- Timo Aaltonen Tue, 19 Apr 2016 11:36:37 +0300 - -libinput (1.2.3-1) unstable; urgency=medium - - * New upstream release. - - -- Timo Aaltonen Tue, 12 Apr 2016 23:41:40 +0300 - -libinput (1.2.2-1) unstable; urgency=medium - - * New upstream release. - - -- Timo Aaltonen Thu, 17 Mar 2016 10:49:19 +0200 - -libinput (1.2.0-1) unstable; urgency=medium - - * New upstream release. - * control: Add libwacom-dev to build-depends. - * symbols: Updated. - - -- Timo Aaltonen Tue, 23 Feb 2016 16:23:11 +0200 - -libinput (1.1.7-1) unstable; urgency=medium - - * New upstream release - - -- Héctor Orón Martínez Wed, 10 Feb 2016 17:19:28 +0100 - -libinput (1.1.6-1) unstable; urgency=medium - - * New upstream release. - - -- Héctor Orón Martínez Fri, 05 Feb 2016 10:37:55 +0100 - -libinput (1.1.4-1) unstable; urgency=medium - - * New upstream release. - - -- Timo Aaltonen Thu, 14 Jan 2016 14:13:45 +0200 - -libinput (1.1.3-1) unstable; urgency=medium - - [ Andreas Boll ] - * Change maintainer to Debian X Strike Force. - - [ Timo Aaltonen ] - * New upstream release. - - -- Timo Aaltonen Thu, 17 Dec 2015 14:54:35 +0200 - -libinput (1.1.2-1) unstable; urgency=medium - - * New upstream release. - * control: Add a package for libinput-tools, thanks Alessio Treglia! - (Closes: #806985) - * control: Update long descriptions. - - -- Timo Aaltonen Thu, 10 Dec 2015 08:34:16 +0200 - -libinput (1.1.0-1) unstable; urgency=medium - - * New upstream release. - * symbols: Updated. - - -- Timo Aaltonen Tue, 27 Oct 2015 14:54:45 +0200 - -libinput (1.0.1-1) unstable; urgency=medium - - * New upstream release. - - -- Timo Aaltonen Thu, 03 Sep 2015 11:52:08 +0300 + -- Robert Ancell Mon, 24 Aug 2015 13:13:32 +0100 libinput (0.21.0-1) unstable; urgency=medium diff -Nru libinput-1.10.3/debian/compat libinput-0.21.0/debian/compat --- libinput-1.10.3/debian/compat 2018-03-14 08:51:30.000000000 +0000 +++ libinput-0.21.0/debian/compat 2015-08-05 06:34:07.000000000 +0000 @@ -1 +1 @@ -10 +9 diff -Nru libinput-1.10.3/debian/control libinput-0.21.0/debian/control --- libinput-1.10.3/debian/control 2018-03-18 13:38:29.000000000 +0000 +++ libinput-0.21.0/debian/control 2015-08-07 05:47:51.000000000 +0000 @@ -1,19 +1,18 @@ Source: libinput Section: libs Priority: optional -Maintainer: Debian X Strike Force -Uploaders: Emilio Pozuelo Monfort , Héctor Orón Martínez +Maintainer: Emilio Pozuelo Monfort +Uploaders: Hector Oron Build-Depends: - debhelper (>= 10), - meson, + debhelper (>= 9), + dh-autoreconf, pkg-config, libmtdev-dev (>= 1.1.0), libudev-dev, libevdev-dev (>= 0.4), - libwacom-dev (>= 0.20), -Standards-Version: 4.1.1 -Vcs-Git: https://salsa.debian.org/xorg-team/lib/libinput.git -Vcs-Browser: https://salsa.debian.org/xorg-team/lib/libinput +Standards-Version: 3.9.6 +Vcs-Git: git://anonscm.debian.org/pkg-xorg/lib/libinput.git +Vcs-Browser: http://anonscm.debian.org/cgit/pkg-xorg/lib/libinput.git Homepage: http://www.freedesktop.org/wiki/Software/libinput/ Package: libinput10 @@ -23,7 +22,6 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, - libinput-bin (>= ${binary:Version}), Description: input device management and event handling library - shared library libinput is a library that handles input devices for display servers and other applications that need to directly deal with input devices. @@ -32,26 +30,6 @@ processing and abstraction so minimize the amount of custom input code the user of libinput need to provide the common set of functionality that users expect. - . - This package includes the shared library. - -Package: libinput-bin -Architecture: any -Pre-Depends: ${misc:Pre-Depends} -Multi-Arch: foreign -Depends: - ${shlibs:Depends}, - ${misc:Depends}, -Description: input device management and event handling library - udev quirks - libinput is a library that handles input devices for display servers and - other applications that need to directly deal with input devices. - . - It provides device detection, device handling, input device event - processing and abstraction so minimize the amount of custom input - code the user of libinput need to provide the common set of - functionality that users expect. - . - This package includes the udev quirks database and helpers. Package: libinput10-udeb XC-Package-Type: udeb @@ -63,19 +41,16 @@ Description: input device management and event handling library - shared library This is a udeb, or a microdeb, for the debian-installer. -Package: libinput-dev -Section: libdevel +Package: libinput10-dbg +Section: debug +Priority: extra Architecture: any Multi-Arch: same Depends: libinput10 (= ${binary:Version}), - libmtdev-dev (>= 1.1.0), - libudev-dev, - libevdev-dev (>= 0.4), - libwacom-dev (>= 0.20), ${shlibs:Depends}, ${misc:Depends}, -Description: input device management and event handling library - development files +Description: input device management and event handling library - debugging symbols libinput is a library that handles input devices for display servers and other applications that need to directly deal with input devices. . @@ -83,21 +58,17 @@ processing and abstraction so minimize the amount of custom input code the user of libinput need to provide the common set of functionality that users expect. - . - This package includes the development headers. -Package: libinput-tools +Package: libinput-dev Section: libdevel +Priority: extra Architecture: any -Multi-Arch: allowed +Multi-Arch: same Depends: libinput10 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}, - python3, - python3-evdev, - python3-pyudev, -Description: input device management and event handling library - command line tools +Description: input device management and event handling library - development files libinput is a library that handles input devices for display servers and other applications that need to directly deal with input devices. . @@ -105,5 +76,3 @@ processing and abstraction so minimize the amount of custom input code the user of libinput need to provide the common set of functionality that users expect. - . - This package includes the command line tools. diff -Nru libinput-1.10.3/debian/copyright libinput-0.21.0/debian/copyright --- libinput-1.10.3/debian/copyright 2018-03-14 08:51:30.000000000 +0000 +++ libinput-0.21.0/debian/copyright 2015-08-05 06:34:07.000000000 +0000 @@ -4,46 +4,43 @@ Peter Hutterer Source: http://www.freedesktop.org/software/libinput/ Files-Excluded: - doc/html + doc/html/ Files: debian/* Copyright: Copyright © 2014 Emilio Pozuelo Monfort -License: Expat +License: X11 Files: * -Copyright: Copyright © 2006-2009 Simon Thum - Copyright © 2008-2012 Kristian Høgsberg +Copyright: Copyright © 2008-2012 Kristian Høgsberg Copyright © 2010-2012 Intel Corporation Copyright © 2010-2011 Benjamin Franzke Copyright © 2011-2012 Collabora, Ltd. - Copyright © 2012-2014 Jonas Ådahl - Copyright © 2013-2016 Red Hat, Inc. - Copyright © 2015 Canonical, Ltd. -License: Expat + Copyright © 2013-2014 Jonas Ådahl + Copyright © 2013-2014 Red Hat, Inc. +License: X11 Files: include/linux/input.h Copyright: Copyright © 1999-2002 Vojtech Pavlik License: GPL-2 -License: Expat - 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: +License: X11 + Permission to use, copy, modify, distribute, and sell this software and its + documentation for any purpose is hereby granted without fee, provided that + the above copyright notice appear in all copies and that both that copyright + notice and this permission notice appear in supporting documentation, and + that the name of the copyright holders not be used in advertising or + publicity pertaining to distribution of the software without specific, + written prior permission. The copyright holders make no representations + about the suitability of this software for any purpose. It is provided "as + is" without express or implied warranty. . - The above copyright notice and this permission notice (including the next - paragraph) 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 OR COPYRIGHT HOLDERS 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. + THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + OF THIS SOFTWARE. License: GPL-2 This program is free software; you can redistribute it and/or modify it diff -Nru libinput-1.10.3/debian/libinput10.symbols libinput-0.21.0/debian/libinput10.symbols --- libinput-1.10.3/debian/libinput10.symbols 2018-03-14 08:51:30.000000000 +0000 +++ libinput-0.21.0/debian/libinput10.symbols 2015-08-24 14:46:53.000000000 +0000 @@ -6,21 +6,11 @@ LIBINPUT_0.19.0@LIBINPUT_0.19.0 0.21.0 LIBINPUT_0.20.0@LIBINPUT_0.20.0 0.21.0 LIBINPUT_0.21.0@LIBINPUT_0.21.0 0.21.0 - LIBINPUT_1.1@LIBINPUT_1.1 1.1.0 - LIBINPUT_1.2@LIBINPUT_1.2 1.2.0 - LIBINPUT_1.3@LIBINPUT_1.3 1.3.0 - LIBINPUT_1.4@LIBINPUT_1.4 1.4.0 - LIBINPUT_1.5@LIBINPUT_1.5 1.5.0 - LIBINPUT_1.7@LIBINPUT_1.7 1.7.2 - LIBINPUT_1.9@LIBINPUT_1.9 1.9.2 + LIBINPUT_0.22.0@LIBINPUT_0.22.0 0.21.0-1ubuntu1 libinput_config_status_to_str@LIBINPUT_0.12.0 0.15.0 - libinput_device_config_accel_get_default_profile@LIBINPUT_1.1 1.1.0 libinput_device_config_accel_get_default_speed@LIBINPUT_0.12.0 0.15.0 - libinput_device_config_accel_get_profile@LIBINPUT_1.1 1.1.0 - libinput_device_config_accel_get_profiles@LIBINPUT_1.1 1.1.0 libinput_device_config_accel_get_speed@LIBINPUT_0.12.0 0.15.0 libinput_device_config_accel_is_available@LIBINPUT_0.12.0 0.15.0 - libinput_device_config_accel_set_profile@LIBINPUT_1.1 1.1.0 libinput_device_config_accel_set_speed@LIBINPUT_0.12.0 0.15.0 libinput_device_config_calibration_get_default_matrix@LIBINPUT_0.12.0 0.15.0 libinput_device_config_calibration_get_matrix@LIBINPUT_0.12.0 0.15.0 @@ -42,10 +32,6 @@ libinput_device_config_middle_emulation_get_enabled@LIBINPUT_0.14.0 0.15.0 libinput_device_config_middle_emulation_is_available@LIBINPUT_0.14.0 0.15.0 libinput_device_config_middle_emulation_set_enabled@LIBINPUT_0.14.0 0.15.0 - libinput_device_config_rotation_get_angle@LIBINPUT_1.4 1.4.0 - libinput_device_config_rotation_get_default_angle@LIBINPUT_1.4 1.4.0 - libinput_device_config_rotation_is_available@LIBINPUT_1.4 1.4.0 - libinput_device_config_rotation_set_angle@LIBINPUT_1.4 1.4.0 libinput_device_config_scroll_get_button@LIBINPUT_0.12.0 0.15.0 libinput_device_config_scroll_get_default_button@LIBINPUT_0.12.0 0.15.0 libinput_device_config_scroll_get_default_method@LIBINPUT_0.12.0 0.15.0 @@ -61,17 +47,11 @@ libinput_device_config_send_events_get_mode@LIBINPUT_0.12.0 0.15.0 libinput_device_config_send_events_get_modes@LIBINPUT_0.12.0 0.15.0 libinput_device_config_send_events_set_mode@LIBINPUT_0.12.0 0.15.0 - libinput_device_config_tap_get_button_map@LIBINPUT_1.5 1.5.0 - libinput_device_config_tap_get_default_button_map@LIBINPUT_1.5 1.5.0 - libinput_device_config_tap_get_default_drag_enabled@LIBINPUT_1.2 1.2.0 libinput_device_config_tap_get_default_drag_lock_enabled@LIBINPUT_0.19.0 0.21.0 libinput_device_config_tap_get_default_enabled@LIBINPUT_0.12.0 0.15.0 libinput_device_config_tap_get_enabled@LIBINPUT_0.12.0 0.15.0 - libinput_device_config_tap_get_drag_enabled@LIBINPUT_1.2 1.2.0 libinput_device_config_tap_get_drag_lock_enabled@LIBINPUT_0.19.0 0.21.0 libinput_device_config_tap_get_finger_count@LIBINPUT_0.12.0 0.15.0 - libinput_device_config_tap_set_button_map@LIBINPUT_1.5 1.5.0 - libinput_device_config_tap_set_drag_enabled@LIBINPUT_1.2 1.2.0 libinput_device_config_tap_set_drag_lock_enabled@LIBINPUT_0.19.0 0.21.0 libinput_device_config_tap_set_enabled@LIBINPUT_0.12.0 0.15.0 libinput_device_get_context@LIBINPUT_0.12.0 0.15.0 @@ -96,12 +76,6 @@ libinput_device_ref@LIBINPUT_0.12.0 0.15.0 libinput_device_set_seat_logical_name@LIBINPUT_0.12.0 0.15.0 libinput_device_set_user_data@LIBINPUT_0.12.0 0.15.0 - libinput_device_switch_has_switch@LIBINPUT_1.9 1.9.2 - libinput_device_tablet_pad_get_mode_group@LIBINPUT_1.4 1.4.0 - libinput_device_tablet_pad_get_num_buttons@LIBINPUT_1.3 1.3.0 - libinput_device_tablet_pad_get_num_mode_groups@LIBINPUT_1.4 1.4.0 - libinput_device_tablet_pad_get_num_rings@LIBINPUT_1.3 1.3.0 - libinput_device_tablet_pad_get_num_strips@LIBINPUT_1.3 1.3.0 libinput_device_unref@LIBINPUT_0.12.0 0.15.0 libinput_dispatch@LIBINPUT_0.12.0 0.15.0 libinput_event_destroy@LIBINPUT_0.12.0 0.15.0 @@ -123,9 +97,6 @@ libinput_event_get_gesture_event@LIBINPUT_0.20.0 0.21.0 libinput_event_get_keyboard_event@LIBINPUT_0.12.0 0.15.0 libinput_event_get_pointer_event@LIBINPUT_0.12.0 0.15.0 - libinput_event_get_switch_event@LIBINPUT_1.7 1.7.2 - libinput_event_get_tablet_pad_event@LIBINPUT_1.3 1.3.0 - libinput_event_get_tablet_tool_event@LIBINPUT_1.2 1.2.0 libinput_event_get_touch_event@LIBINPUT_0.12.0 0.15.0 libinput_event_get_type@LIBINPUT_0.12.0 0.15.0 libinput_event_keyboard_get_base_event@LIBINPUT_0.12.0 0.15.0 @@ -152,57 +123,13 @@ libinput_event_pointer_get_time@LIBINPUT_0.12.0 0.15.0 libinput_event_pointer_get_time_usec@LIBINPUT_0.21.0 0.21.0 libinput_event_pointer_has_axis@LIBINPUT_0.12.0 0.15.0 - libinput_event_switch_get_base_event@LIBINPUT_1.7 1.7.2 - libinput_event_switch_get_switch@LIBINPUT_1.7 1.7.2 - libinput_event_switch_get_switch_state@LIBINPUT_1.7 1.7.2 - libinput_event_switch_get_time@LIBINPUT_1.7 1.7.2 - libinput_event_switch_get_time_usec@LIBINPUT_1.7 1.7.2 - libinput_event_tablet_pad_get_base_event@LIBINPUT_1.3 1.3.0 - libinput_event_tablet_pad_get_button_number@LIBINPUT_1.3 1.3.0 - libinput_event_tablet_pad_get_button_state@LIBINPUT_1.3 1.3.0 - libinput_event_tablet_pad_get_mode@LIBINPUT_1.4 1.4.0 - libinput_event_tablet_pad_get_mode_group@LIBINPUT_1.4 1.4.0 - libinput_event_tablet_pad_get_ring_number@LIBINPUT_1.3 1.3.0 - libinput_event_tablet_pad_get_ring_position@LIBINPUT_1.3 1.3.0 - libinput_event_tablet_pad_get_ring_source@LIBINPUT_1.3 1.3.0 - libinput_event_tablet_pad_get_strip_number@LIBINPUT_1.3 1.3.0 - libinput_event_tablet_pad_get_strip_position@LIBINPUT_1.3 1.3.0 - libinput_event_tablet_pad_get_strip_source@LIBINPUT_1.3 1.3.0 - libinput_event_tablet_pad_get_time@LIBINPUT_1.3 1.3.0 - libinput_event_tablet_pad_get_time_usec@LIBINPUT_1.3 1.3.0 - libinput_event_tablet_tool_distance_has_changed@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_base_event@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_button@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_button_state@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_distance@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_dx@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_dy@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_pressure@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_proximity_state@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_rotation@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_seat_button_count@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_slider_position@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_tilt_x@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_tilt_y@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_time@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_time_usec@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_tip_state@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_tool@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_wheel_delta@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_wheel_delta_discrete@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_x@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_x_transformed@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_y@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_get_y_transformed@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_pressure_has_changed@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_rotation_has_changed@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_slider_has_changed@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_tilt_x_has_changed@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_tilt_y_has_changed@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_wheel_has_changed@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_x_has_changed@LIBINPUT_1.2 1.2.0 - libinput_event_tablet_tool_y_has_changed@LIBINPUT_1.2 1.2.0 libinput_event_touch_get_base_event@LIBINPUT_0.12.0 0.15.0 + libinput_event_touch_get_major@LIBINPUT_0.22.0 0.21.0-1ubuntu1 + libinput_event_touch_get_major_transformed@LIBINPUT_0.22.0 0.21.0-1ubuntu1 + libinput_event_touch_get_minor@LIBINPUT_0.22.0 0.21.0-1ubuntu1 + libinput_event_touch_get_minor_transformed@LIBINPUT_0.22.0 0.21.0-1ubuntu1 + libinput_event_touch_get_orientation@LIBINPUT_0.22.0 0.21.0-1ubuntu1 + libinput_event_touch_get_pressure@LIBINPUT_0.22.0 0.21.0-1ubuntu1 libinput_event_touch_get_seat_slot@LIBINPUT_0.12.0 0.15.0 libinput_event_touch_get_slot@LIBINPUT_0.12.0 0.15.0 libinput_event_touch_get_time@LIBINPUT_0.12.0 0.15.0 @@ -211,6 +138,10 @@ libinput_event_touch_get_x_transformed@LIBINPUT_0.12.0 0.15.0 libinput_event_touch_get_y@LIBINPUT_0.12.0 0.15.0 libinput_event_touch_get_y_transformed@LIBINPUT_0.12.0 0.15.0 + libinput_event_touch_has_major@LIBINPUT_0.22.0 0.21.0-1ubuntu1 + libinput_event_touch_has_minor@LIBINPUT_0.22.0 0.21.0-1ubuntu1 + libinput_event_touch_has_orientation@LIBINPUT_0.22.0 0.21.0-1ubuntu1 + libinput_event_touch_has_pressure@LIBINPUT_0.22.0 0.21.0-1ubuntu1 libinput_get_event@LIBINPUT_0.12.0 0.15.0 libinput_get_fd@LIBINPUT_0.12.0 0.15.0 libinput_get_user_data@LIBINPUT_0.12.0 0.15.0 @@ -232,32 +163,6 @@ libinput_seat_unref@LIBINPUT_0.12.0 0.15.0 libinput_set_user_data@LIBINPUT_0.12.0 0.15.0 libinput_suspend@LIBINPUT_0.12.0 0.15.0 - libinput_tablet_pad_mode_group_button_is_toggle@LIBINPUT_1.4 1.4.0 - libinput_tablet_pad_mode_group_get_index@LIBINPUT_1.4 1.4.0 - libinput_tablet_pad_mode_group_get_mode@LIBINPUT_1.4 1.4.0 - libinput_tablet_pad_mode_group_get_num_modes@LIBINPUT_1.4 1.4.0 - libinput_tablet_pad_mode_group_get_user_data@LIBINPUT_1.4 1.4.0 - libinput_tablet_pad_mode_group_has_button@LIBINPUT_1.4 1.4.0 - libinput_tablet_pad_mode_group_has_ring@LIBINPUT_1.4 1.4.0 - libinput_tablet_pad_mode_group_has_strip@LIBINPUT_1.4 1.4.0 - libinput_tablet_pad_mode_group_ref@LIBINPUT_1.4 1.4.0 - libinput_tablet_pad_mode_group_set_user_data@LIBINPUT_1.4 1.4.0 - libinput_tablet_pad_mode_group_unref@LIBINPUT_1.4 1.4.0 - libinput_tablet_tool_get_serial@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_get_tool_id@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_get_type@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_get_user_data@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_has_button@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_has_distance@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_has_pressure@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_has_rotation@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_has_slider@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_has_tilt@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_has_wheel@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_is_unique@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_ref@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_set_user_data@LIBINPUT_1.2 1.2.0 - libinput_tablet_tool_unref@LIBINPUT_1.2 1.2.0 libinput_udev_assign_seat@LIBINPUT_0.12.0 0.15.0 libinput_udev_create_context@LIBINPUT_0.12.0 0.15.0 libinput_unref@LIBINPUT_0.12.0 0.15.0 diff -Nru libinput-1.10.3/debian/libinput10-udeb.install libinput-0.21.0/debian/libinput10-udeb.install --- libinput-1.10.3/debian/libinput10-udeb.install 2018-03-14 08:51:30.000000000 +0000 +++ libinput-0.21.0/debian/libinput10-udeb.install 2015-08-07 05:31:21.000000000 +0000 @@ -1,2 +1 @@ -lib/udev usr/lib/*/libinput.so.10* diff -Nru libinput-1.10.3/debian/libinput-bin.install libinput-0.21.0/debian/libinput-bin.install --- libinput-1.10.3/debian/libinput-bin.install 2018-03-14 08:51:30.000000000 +0000 +++ libinput-0.21.0/debian/libinput-bin.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -lib/udev diff -Nru libinput-1.10.3/debian/libinput-tools.install libinput-0.21.0/debian/libinput-tools.install --- libinput-1.10.3/debian/libinput-tools.install 2018-03-14 08:51:30.000000000 +0000 +++ libinput-0.21.0/debian/libinput-tools.install 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -usr/bin/* -usr/lib/*/libinput/* -usr/share/man/man1/* diff -Nru libinput-1.10.3/debian/patches/fix-litest.patch libinput-0.21.0/debian/patches/fix-litest.patch --- libinput-1.10.3/debian/patches/fix-litest.patch 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/debian/patches/fix-litest.patch 2015-08-24 12:13:16.000000000 +0000 @@ -0,0 +1,44 @@ +With this change auto assign events will be skipped if no replacement value +is provided. This behavior is practical when emitting mt events, as those +only contain the axis values that changed. + +Signed-off-by: Andreas Pokorny +--- + test/litest.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/test/litest.c b/test/litest.c +index 26c5e43..8fc7bca 100644 +--- a/test/litest.c ++++ b/test/litest.c +@@ -1292,7 +1292,6 @@ litest_auto_assign_value(struct litest_device *d, + value = touching ? 0 : 1; + break; + default: +- value = -1; + if (!axis_replacement_value(axes, ev->code, &value) && + d->interface->get_axis_default) + d->interface->get_axis_default(d, ev->code, &value); +@@ -1342,8 +1341,8 @@ litest_slot_start(struct litest_device *d, + y, + axes, + touching); +- +- litest_event(d, ev->type, ev->code, value); ++ if (value != LITEST_AUTO_ASSIGN) ++ litest_event(d, ev->type, ev->code, value); + ev++; + } + } +@@ -1428,7 +1427,8 @@ litest_slot_move(struct litest_device *d, + y, + axes, + touching); +- litest_event(d, ev->type, ev->code, value); ++ if (value != LITEST_AUTO_ASSIGN) ++ litest_event(d, ev->type, ev->code, value); + ev++; + } + } +-- +2.1.4 diff -Nru libinput-1.10.3/debian/patches/series libinput-0.21.0/debian/patches/series --- libinput-1.10.3/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/debian/patches/series 2015-08-24 12:17:29.000000000 +0000 @@ -0,0 +1,2 @@ +fix-litest.patch +touch-point-orientation-size.patch diff -Nru libinput-1.10.3/debian/patches/touch-point-orientation-size.patch libinput-0.21.0/debian/patches/touch-point-orientation-size.patch --- libinput-1.10.3/debian/patches/touch-point-orientation-size.patch 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/debian/patches/touch-point-orientation-size.patch 2015-08-24 12:11:53.000000000 +0000 @@ -0,0 +1,1675 @@ +This change adds four new properties to touch events: +* major: diameter of the touch ellipse along the major axis +* minor: diameter perpendicular to major axis +* pressure: a pressure value mapped into the range [0, 1] +* orientation: the angle between major and the x axis [0, 360] + +Those values are optionally supported by multi-touch drivers, so default values +are used if the information is missing. The existance of each of the properties +can be querried at the event using another set of libinput_event_touch_has_* +functions. + +Explanation of those values was added to the touch screen page. + +Signed-off-by: Andreas Pokorny +--- + doc/Makefile.am | 2 + + doc/page-hierarchy.dox | 1 + + doc/svg/touchscreen-touch-event-properties.svg | 347 +++++++++++++++++++++++++ + doc/touch-event-properties.dox | 42 +++ + src/evdev.c | 218 ++++++++++++++-- + src/evdev.h | 25 ++ + src/libinput-private.h | 25 +- + src/libinput-util.h | 6 + + src/libinput.c | 205 ++++++++++++++- + src/libinput.h | 222 ++++++++++++++++ + src/libinput.sym | 13 + + test/touch.c | 239 +++++++++++++++++ + 12 files changed, 1313 insertions(+), 32 deletions(-) + create mode 100644 doc/svg/touchscreen-touch-event-properties.svg + create mode 100644 doc/touch-event-properties.dox + +diff --git a/doc/Makefile.am b/doc/Makefile.am +index a8d4182..da21283 100644 +--- a/doc/Makefile.am ++++ b/doc/Makefile.am +@@ -26,6 +26,7 @@ header_files = \ + $(srcdir)/tapping.dox \ + $(srcdir)/test-suite.dox \ + $(srcdir)/tools.dox \ ++ $(srcdir)/touch-event-properties.dox \ + $(srcdir)/touchpads.dox + + diagram_files = \ +@@ -49,6 +50,7 @@ diagram_files = \ + $(srcdir)/svg/thumb-detection.svg \ + $(srcdir)/svg/top-software-buttons.svg \ + $(srcdir)/svg/touchscreen-gestures.svg \ ++ $(srcdir)/svg/touchscreen-touch-event-properties.svg \ + $(srcdir)/svg/twofinger-scrolling.svg + + style_files = \ +diff --git a/doc/page-hierarchy.dox b/doc/page-hierarchy.dox +index 3fdb1f7..72765e2 100644 +--- a/doc/page-hierarchy.dox ++++ b/doc/page-hierarchy.dox +@@ -11,6 +11,7 @@ + @page touchscreens Touchscreens + + - @subpage absolute_axes ++- @subpage touch_event_properties + + @page pointers Mice, Trackballs, etc. + +diff --git a/doc/svg/touchscreen-touch-event-properties.svg b/doc/svg/touchscreen-touch-event-properties.svg +new file mode 100644 +index 0000000..b728f40 +--- /dev/null ++++ b/doc/svg/touchscreen-touch-event-properties.svg +@@ -0,0 +1,347 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ image/svg+xml ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ minor axis ++ major axis ++ ++ pointing direction ++ y axis ++ ++ orientation ++ ++ +diff --git a/doc/touch-event-properties.dox b/doc/touch-event-properties.dox +new file mode 100644 +index 0000000..75fc072 +--- /dev/null ++++ b/doc/touch-event-properties.dox +@@ -0,0 +1,42 @@ ++/** ++ at page touch_event_properties Properties of a touch event ++ ++This page gives some overview on touchscreen events. With libinput touchscreens ++provide the event types @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_UP, ++ at ref LIBINPUT_EVENT_TOUCH_MOTION and @ref LIBINPUT_EVENT_TOUCH_CANCEL. The ++touchscreen events @ref LIBINPUT_EVENT_TOUCH_DOWN and ++ at ref LIBINPUT_EVENT_TOUCH_MOTION provide alongside the actual state change and ++the absolute coordinates (@ref absolute_axes_handling) additional information ++about the touch contact. ++ ++ at image html touchscreen-touch-event-properties.svg "Properties of a touch screen contact" ++ ++Assuming the interaction of fingers with a touch screen, touch contacts are ++approximated with an ellipse. The major axis of the ellipse describes the ++pointing direction of the finger. The minor axis is the perpendicular ++extent of the touching shape. The orientation angle is the clockwise rotation of ++the pointing direction against the y-axis of the touchscreen. ++ ++Additionally to the values shown in the drawing above, most touchscreens also ++provide a pressure value to indicate the force applied with the contact point. ++ ++The support for those contact properties varies between the different ++available touchscreens. In the case of pressure libinput will return the ++maximum pressure value, which is 1.0. If only the major axis but no minor axis ++is present, libinput will assume a circular shape and return the major axis ++value for convenience. If also no major axis value is known 0.0 is returned. ++If the orientation is not available libinput will return 0.0 degrees. ++ ++For querying the touch properties see: ++- @ref libinput_event_touch_get_major_transformed ++- @ref libinput_event_touch_get_minor_transformed ++- @ref libinput_event_touch_get_orientation ++- @ref libinput_event_touch_get_pressure ++ ++For testing which of the touch properties are available see: ++- @ref libinput_event_touch_has_major ++- @ref libinput_event_touch_has_minor ++- @ref libinput_event_touch_has_orientation ++- @ref libinput_event_touch_has_pressure ++ ++*/ +diff --git a/src/evdev.c b/src/evdev.c +index 303e447..29303f8 100644 +--- a/src/evdev.c ++++ b/src/evdev.c +@@ -45,6 +45,10 @@ + + #define DEFAULT_WHEEL_CLICK_ANGLE 15 + #define DEFAULT_MIDDLE_BUTTON_SCROLL_TIMEOUT ms2us(200) ++#define DEFAULT_TOUCH_PRESSURE 1 ++#define DEFAULT_TOUCH_ORIENTATION 0 ++#define DEFAULT_TOUCH_MAJOR 0 ++#define DEFAULT_TOUCH_MINOR 0 + + enum evdev_key_type { + EVDEV_KEY_TYPE_NONE, +@@ -245,6 +249,100 @@ evdev_device_transform_y(struct evdev_device *device, + return scale_axis(device->abs.absinfo_y, y, height); + } + ++double ++evdev_device_transform_ellipse_diameter_to_mm(struct evdev_device *device, ++ int diameter, ++ double axis_angle) ++{ ++ double x_res = device->abs.absinfo_x->resolution; ++ double y_res = device->abs.absinfo_y->resolution; ++ ++ if (x_res == y_res) ++ return diameter / x_res; ++ ++ /* resolution differs but no orientation available ++ * -> estimate resolution using the average */ ++ if (device->abs.absinfo_orientation == NULL) { ++ return diameter * 2.0 / (x_res + y_res); ++ } else { ++ /* Why scale x using sine of angle? ++ * axis_angle = 0 indicates that the given diameter ++ * is aligned with the y-axis. */ ++ double x_scaling_ratio = fabs(sin(deg2rad(axis_angle))); ++ double y_scaling_ratio = fabs(cos(deg2rad(axis_angle))); ++ ++ return diameter / (y_res * y_scaling_ratio + ++ x_res * x_scaling_ratio); ++ } ++} ++ ++double ++evdev_device_transform_ellipse_diameter(struct evdev_device *device, ++ int diameter, ++ double axis_angle, ++ uint32_t width, ++ uint32_t height) ++{ ++ double x_res = device->abs.absinfo_x->resolution; ++ double y_res = device->abs.absinfo_y->resolution; ++ double x_scale = width / (device->abs.dimensions.x + 1.0); ++ double y_scale = height / (device->abs.dimensions.y + 1.0); ++ ++ if (x_res == y_res) ++ return diameter * x_scale; ++ ++ /* no orientation available -> estimate resolution using the ++ * average */ ++ if (device->abs.absinfo_orientation == NULL) { ++ return diameter * (x_scale + y_scale) / 2.0; ++ } else { ++ /* Why scale x using sine of angle? ++ * axis_angle = 0 indicates that the given diameter ++ * is aligned with the y-axis. */ ++ double x_scaling_ratio = fabs(sin(deg2rad(axis_angle))); ++ double y_scaling_ratio = fabs(cos(deg2rad(axis_angle))); ++ ++ return diameter * (y_scale * y_scaling_ratio + ++ x_scale * x_scaling_ratio); ++ } ++} ++ ++double ++evdev_device_transform_orientation(struct evdev_device *device, ++ int32_t orientation) ++{ ++ const struct input_absinfo *orientation_info = ++ device->abs.absinfo_orientation; ++ ++ double angle = DEFAULT_TOUCH_ORIENTATION; ++ ++ /* ABS_MT_ORIENTATION is defined as a clockwise rotation - zero ++ * (instead of minimum) is mapped to the y-axis, and maximum is ++ * mapped to the x-axis. So minimum is likely to be negative but ++ * plays no role in scaling the value to degrees.*/ ++ if (orientation_info) ++ angle = (90.0 * orientation) / orientation_info->maximum; ++ ++ return fmod(360.0 + angle, 360.0); ++} ++ ++double ++evdev_device_transform_pressure(struct evdev_device *device, ++ int32_t pressure) ++{ ++ const struct input_absinfo *pressure_info = ++ device->abs.absinfo_pressure; ++ ++ if (pressure_info) { ++ double max_pressure = pressure_info->maximum; ++ double min_pressure = pressure_info->minimum; ++ return (pressure - min_pressure) / ++ (max_pressure - min_pressure); ++ } else { ++ return DEFAULT_TOUCH_PRESSURE; ++ } ++} ++ + static inline void + normalize_delta(struct evdev_device *device, + const struct device_coords *delta, +@@ -282,8 +380,15 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) + struct normalized_coords accel, unaccel; + struct device_coords point; + struct device_float_coords raw; ++ struct mt_slot *slot_data; ++ struct ellipse default_touch = { ++ .major = DEFAULT_TOUCH_MAJOR, ++ .minor = DEFAULT_TOUCH_MINOR, ++ .orientation = DEFAULT_TOUCH_ORIENTATION ++ }; + + slot = device->mt.slot; ++ slot_data = &device->mt.slots[slot]; + + switch (device->pending_event) { + case EVDEV_NONE: +@@ -314,7 +419,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) + if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) + break; + +- if (device->mt.slots[slot].seat_slot != -1) { ++ if (slot_data->seat_slot != -1) { + log_bug_kernel(libinput, + "%s: Driver sent multiple touch down for the " + "same slot", +@@ -323,38 +428,52 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) + } + + seat_slot = ffs(~seat->slot_map) - 1; +- device->mt.slots[slot].seat_slot = seat_slot; ++ slot_data->seat_slot = seat_slot; + + if (seat_slot == -1) + break; + + seat->slot_map |= 1 << seat_slot; +- point = device->mt.slots[slot].point; ++ point = slot_data->point; + transform_absolute(device, &point); + +- touch_notify_touch_down(base, time, slot, seat_slot, +- &point); ++ touch_notify_touch_down(base, ++ time, ++ slot, ++ seat_slot, ++ &point, ++ slot_data->available_data, ++ &slot_data->area, ++ slot_data->pressure); + break; + case EVDEV_ABSOLUTE_MT_MOTION: + if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) + break; + +- seat_slot = device->mt.slots[slot].seat_slot; +- point = device->mt.slots[slot].point; ++ seat_slot = slot_data->seat_slot; ++ ++ point = slot_data->point; + + if (seat_slot == -1) + break; + + transform_absolute(device, &point); +- touch_notify_touch_motion(base, time, slot, seat_slot, +- &point); ++ ++ touch_notify_touch_motion(base, ++ time, ++ slot, ++ seat_slot, ++ &point, ++ slot_data->available_data, ++ &slot_data->area, ++ slot_data->pressure); + break; + case EVDEV_ABSOLUTE_MT_UP: + if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) + break; + +- seat_slot = device->mt.slots[slot].seat_slot; +- device->mt.slots[slot].seat_slot = -1; ++ seat_slot = slot_data->seat_slot; ++ slot_data->seat_slot = -1; + + if (seat_slot == -1) + break; +@@ -386,7 +505,14 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) + point = device->abs.point; + transform_absolute(device, &point); + +- touch_notify_touch_down(base, time, -1, seat_slot, &point); ++ touch_notify_touch_down(base, ++ time, ++ -1, ++ seat_slot, ++ &point, ++ TOUCH_SLOT_DATA_NONE, ++ &default_touch, ++ DEFAULT_TOUCH_PRESSURE); + break; + case EVDEV_ABSOLUTE_MOTION: + point = device->abs.point; +@@ -398,8 +524,14 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time) + if (seat_slot == -1) + break; + +- touch_notify_touch_motion(base, time, -1, seat_slot, +- &point); ++ touch_notify_touch_motion(base, ++ time, ++ -1, ++ seat_slot, ++ &point, ++ TOUCH_SLOT_DATA_NONE, ++ &default_touch, ++ DEFAULT_TOUCH_PRESSURE); + } else if (device->seat_caps & EVDEV_DEVICE_POINTER) { + pointer_notify_motion_absolute(base, time, &point); + } +@@ -559,8 +691,9 @@ evdev_process_touch(struct evdev_device *device, + struct input_event *e, + uint64_t time) + { +- switch (e->code) { +- case ABS_MT_SLOT: ++ struct mt_slot *current_slot = &device->mt.slots[device->mt.slot]; ++ ++ if (e->code == ABS_MT_SLOT) { + if ((size_t)e->value >= device->mt.slots_len) { + log_bug_libinput(device->base.seat->libinput, + "%s exceeds slots (%d of %zd)\n", +@@ -571,8 +704,7 @@ evdev_process_touch(struct evdev_device *device, + } + evdev_flush_pending_event(device, time); + device->mt.slot = e->value; +- break; +- case ABS_MT_TRACKING_ID: ++ } else if(e->code == ABS_MT_TRACKING_ID) { + if (device->pending_event != EVDEV_NONE && + device->pending_event != EVDEV_ABSOLUTE_MT_MOTION) + evdev_flush_pending_event(device, time); +@@ -580,17 +712,40 @@ evdev_process_touch(struct evdev_device *device, + device->pending_event = EVDEV_ABSOLUTE_MT_DOWN; + else + device->pending_event = EVDEV_ABSOLUTE_MT_UP; +- break; +- case ABS_MT_POSITION_X: +- device->mt.slots[device->mt.slot].point.x = e->value; +- if (device->pending_event == EVDEV_NONE) +- device->pending_event = EVDEV_ABSOLUTE_MT_MOTION; +- break; +- case ABS_MT_POSITION_Y: +- device->mt.slots[device->mt.slot].point.y = e->value; +- if (device->pending_event == EVDEV_NONE) ++ } else { ++ bool needs_wake = true; ++ ++ switch(e->code) { ++ case ABS_MT_POSITION_X: ++ current_slot->point.x = e->value; ++ break; ++ case ABS_MT_POSITION_Y: ++ current_slot->point.y = e->value; ++ break; ++ case ABS_MT_TOUCH_MAJOR: ++ current_slot->available_data |= TOUCH_SLOT_DATA_MAJOR; ++ current_slot->area.major = e->value; ++ break; ++ case ABS_MT_TOUCH_MINOR: ++ current_slot->available_data |= TOUCH_SLOT_DATA_MINOR; ++ current_slot->area.minor = e->value; ++ break; ++ case ABS_MT_ORIENTATION: ++ current_slot->available_data |= ++ TOUCH_SLOT_DATA_ORIENTATION; ++ current_slot->area.orientation = e->value; ++ break; ++ case ABS_MT_PRESSURE: ++ current_slot->available_data |= ++ TOUCH_SLOT_DATA_PRESSURE; ++ current_slot->pressure = e->value; ++ break; ++ default: ++ needs_wake = false; ++ break; ++ } ++ if (needs_wake && device->pending_event == EVDEV_NONE) + device->pending_event = EVDEV_ABSOLUTE_MT_MOTION; +- break; + } + } + +@@ -1941,6 +2096,13 @@ evdev_configure_device(struct evdev_device *device) + return -1; + } + ++ device->abs.absinfo_orientation = ++ libevdev_get_abs_info(evdev, ++ ABS_MT_ORIENTATION); ++ device->abs.absinfo_pressure = ++ libevdev_get_abs_info(evdev, ++ ABS_MT_PRESSURE); ++ + if (!evdev_is_fake_mt_device(device)) + evdev_fix_android_mt(device); + +diff --git a/src/evdev.h b/src/evdev.h +index e44a65d..383e682 100644 +--- a/src/evdev.h ++++ b/src/evdev.h +@@ -112,6 +112,9 @@ enum evdev_device_model { + struct mt_slot { + int32_t seat_slot; + struct device_coords point; ++ enum touch_slot_data available_data; ++ struct ellipse area; ++ int32_t pressure; + }; + + struct evdev_device { +@@ -128,6 +131,8 @@ struct evdev_device { + int fd; + struct { + const struct input_absinfo *absinfo_x, *absinfo_y; ++ const struct input_absinfo *absinfo_pressure, ++ *absinfo_orientation; + int fake_resolution; + + struct device_coords point; +@@ -349,6 +354,26 @@ double + evdev_device_transform_y(struct evdev_device *device, + double y, + uint32_t height); ++double ++evdev_device_transform_ellipse_diameter_to_mm(struct evdev_device *device, ++ int32_t diameter, ++ double axis_angle); ++ ++double ++evdev_device_transform_ellipse_diameter(struct evdev_device *device, ++ int32_t diameter, ++ double axis_angle, ++ uint32_t width, ++ uint32_t height); ++ ++double ++evdev_device_transform_orientation(struct evdev_device *device, ++ int32_t orientation); ++ ++double ++evdev_device_transform_pressure(struct evdev_device *device, ++ int32_t pressure); ++ + int + evdev_device_suspend(struct evdev_device *device); + +diff --git a/src/libinput-private.h b/src/libinput-private.h +index 8b161cc..0060030 100644 +--- a/src/libinput-private.h ++++ b/src/libinput-private.h +@@ -40,6 +40,11 @@ struct device_coords { + int x, y; + }; + ++/* Ellipse parameters in device coordinates */ ++struct ellipse { ++ int major, minor, orientation; ++}; ++ + /* + * A coordinate pair in device coordinates, capable of holding non discrete + * values, this is necessary e.g. when device coordinates get averaged. +@@ -58,6 +63,16 @@ struct discrete_coords { + int x, y; + }; + ++enum touch_slot_data { ++ TOUCH_SLOT_DATA_NONE = 0, ++ TOUCH_SLOT_DATA_MAJOR = (1 << 1), ++ TOUCH_SLOT_DATA_MINOR = (1 << 2), ++ TOUCH_SLOT_DATA_ORIENTATION = (1 << 3), ++ TOUCH_SLOT_DATA_PRESSURE = (1 << 4), ++}; ++ ++ ++ + struct libinput_interface_backend { + int (*resume)(struct libinput *libinput); + void (*suspend)(struct libinput *libinput); +@@ -381,14 +396,20 @@ touch_notify_touch_down(struct libinput_device *device, + uint64_t time, + int32_t slot, + int32_t seat_slot, +- const struct device_coords *point); ++ const struct device_coords *point, ++ enum touch_slot_data available_data, ++ const struct ellipse *area, ++ int32_t pressure); + + void + touch_notify_touch_motion(struct libinput_device *device, + uint64_t time, + int32_t slot, + int32_t seat_slot, +- const struct device_coords *point); ++ const struct device_coords *point, ++ enum touch_slot_data available_data, ++ const struct ellipse *area, ++ int32_t pressure); + + void + touch_notify_touch_up(struct libinput_device *device, +diff --git a/src/libinput-util.h b/src/libinput-util.h +index ba253b5..9495fa6 100644 +--- a/src/libinput-util.h ++++ b/src/libinput-util.h +@@ -118,6 +118,12 @@ msleep(unsigned int ms) + usleep(ms * 1000); + } + ++static inline double ++deg2rad(double angle) ++{ ++ return angle * M_PI/180.0; ++} ++ + static inline int + long_bit_is_set(const unsigned long *array, int bit) + { +diff --git a/src/libinput.c b/src/libinput.c +index e564571..237a35f 100644 +--- a/src/libinput.c ++++ b/src/libinput.c +@@ -112,6 +112,9 @@ struct libinput_event_touch { + int32_t slot; + int32_t seat_slot; + struct device_coords point; ++ enum touch_slot_data available_data; ++ struct ellipse area; ++ int32_t pressure; + }; + + struct libinput_event_gesture { +@@ -729,6 +732,192 @@ libinput_event_touch_get_y(struct libinput_event_touch *event) + return evdev_convert_to_mm(device->abs.absinfo_y, event->point.y); + } + ++LIBINPUT_EXPORT double ++libinput_event_touch_get_major(struct libinput_event_touch *event) ++{ ++ struct evdev_device *device = ++ (struct evdev_device *) event->base.device; ++ double angle; ++ ++ require_event_type(libinput_event_get_context(&event->base), ++ event->base.type, ++ 0, ++ LIBINPUT_EVENT_TOUCH_DOWN, ++ LIBINPUT_EVENT_TOUCH_MOTION); ++ ++ angle = evdev_device_transform_orientation(device, ++ event->area.orientation); ++ ++ return evdev_device_transform_ellipse_diameter_to_mm(device, ++ event->area.major, ++ angle); ++} ++ ++LIBINPUT_EXPORT double ++libinput_event_touch_get_major_transformed(struct libinput_event_touch *event, ++ uint32_t width, ++ uint32_t height) ++{ ++ struct evdev_device *device = ++ (struct evdev_device *) event->base.device; ++ double angle; ++ ++ require_event_type(libinput_event_get_context(&event->base), ++ event->base.type, ++ 0, ++ LIBINPUT_EVENT_TOUCH_DOWN, ++ LIBINPUT_EVENT_TOUCH_MOTION); ++ ++ angle = evdev_device_transform_orientation(device, ++ event->area.orientation); ++ ++ return evdev_device_transform_ellipse_diameter(device, ++ event->area.major, ++ angle, ++ width, ++ height); ++} ++ ++LIBINPUT_EXPORT int ++libinput_event_touch_has_major(struct libinput_event_touch *event) ++{ ++ require_event_type(libinput_event_get_context(&event->base), ++ event->base.type, ++ 0, ++ LIBINPUT_EVENT_TOUCH_DOWN, ++ LIBINPUT_EVENT_TOUCH_MOTION); ++ ++ return event->available_data & TOUCH_SLOT_DATA_MAJOR; ++} ++ ++LIBINPUT_EXPORT double ++libinput_event_touch_get_minor(struct libinput_event_touch *event) ++{ ++ struct evdev_device *device = ++ (struct evdev_device *) event->base.device; ++ double angle; ++ ++ require_event_type(libinput_event_get_context(&event->base), ++ event->base.type, ++ 0, ++ LIBINPUT_EVENT_TOUCH_DOWN, ++ LIBINPUT_EVENT_TOUCH_MOTION); ++ ++ angle = evdev_device_transform_orientation(device, ++ event->area.orientation); ++ ++ /* angle + 90 since the minor diameter is perpendicular to the ++ * major axis */ ++ return evdev_device_transform_ellipse_diameter_to_mm(device, ++ event->area.minor, ++ angle + 90.0); ++ ++} ++ ++LIBINPUT_EXPORT double ++libinput_event_touch_get_minor_transformed(struct libinput_event_touch *event, ++ uint32_t width, ++ uint32_t height) ++{ ++ struct evdev_device *device = ++ (struct evdev_device *) event->base.device; ++ double angle; ++ int diameter; ++ ++ require_event_type(libinput_event_get_context(&event->base), ++ event->base.type, ++ 0, ++ LIBINPUT_EVENT_TOUCH_DOWN, ++ LIBINPUT_EVENT_TOUCH_MOTION); ++ ++ angle = evdev_device_transform_orientation(device, ++ event->area.orientation); ++ ++ /* use major diameter if minor is not available, but if it is ++ * add 90 since the minor diameter is perpendicular to the ++ * major axis */ ++ if( event->available_data & TOUCH_SLOT_DATA_MINOR) { ++ diameter = event->area.minor, ++ angle += 90.0; ++ } else { ++ diameter = event->area.major; ++ } ++ ++ return evdev_device_transform_ellipse_diameter(device, ++ diameter, ++ angle, ++ width, ++ height); ++} ++ ++LIBINPUT_EXPORT int ++libinput_event_touch_has_minor(struct libinput_event_touch *event) ++{ ++ require_event_type(libinput_event_get_context(&event->base), ++ event->base.type, ++ 0, ++ LIBINPUT_EVENT_TOUCH_DOWN, ++ LIBINPUT_EVENT_TOUCH_MOTION); ++ ++ return event->available_data & TOUCH_SLOT_DATA_MINOR; ++} ++ ++LIBINPUT_EXPORT double ++libinput_event_touch_get_orientation(struct libinput_event_touch *event) ++{ ++ struct evdev_device *device = ++ (struct evdev_device *) event->base.device; ++ ++ require_event_type(libinput_event_get_context(&event->base), ++ event->base.type, ++ 0, ++ LIBINPUT_EVENT_TOUCH_DOWN, ++ LIBINPUT_EVENT_TOUCH_MOTION); ++ ++ return evdev_device_transform_orientation(device, ++ event->area.orientation); ++} ++ ++LIBINPUT_EXPORT int ++libinput_event_touch_has_orientation(struct libinput_event_touch *event) ++{ ++ require_event_type(libinput_event_get_context(&event->base), ++ event->base.type, ++ 0, ++ LIBINPUT_EVENT_TOUCH_DOWN, ++ LIBINPUT_EVENT_TOUCH_MOTION); ++ ++ return event->available_data & TOUCH_SLOT_DATA_ORIENTATION; ++} ++ ++LIBINPUT_EXPORT double ++libinput_event_touch_get_pressure(struct libinput_event_touch *event) ++{ ++ struct evdev_device *device = ++ (struct evdev_device *) event->base.device; ++ ++ require_event_type(libinput_event_get_context(&event->base), ++ event->base.type, ++ 0, ++ LIBINPUT_EVENT_TOUCH_DOWN, ++ LIBINPUT_EVENT_TOUCH_MOTION); ++ ++ return evdev_device_transform_pressure(device, ++ event->pressure); ++} ++ ++LIBINPUT_EXPORT int ++libinput_event_touch_has_pressure(struct libinput_event_touch *event) ++{ ++ require_event_type(libinput_event_get_context(&event->base), ++ event->base.type, ++ 0, ++ LIBINPUT_EVENT_TOUCH_DOWN, ++ LIBINPUT_EVENT_TOUCH_MOTION); ++ ++ return event->available_data & TOUCH_SLOT_DATA_PRESSURE; ++} ++ + LIBINPUT_EXPORT uint32_t + libinput_event_gesture_get_time(struct libinput_event_gesture *event) + { +@@ -1500,7 +1689,10 @@ touch_notify_touch_down(struct libinput_device *device, + uint64_t time, + int32_t slot, + int32_t seat_slot, +- const struct device_coords *point) ++ const struct device_coords *point, ++ enum touch_slot_data available_data, ++ const struct ellipse *area, ++ int32_t pressure) + { + struct libinput_event_touch *touch_event; + +@@ -1516,6 +1708,9 @@ touch_notify_touch_down(struct libinput_device *device, + .slot = slot, + .seat_slot = seat_slot, + .point = *point, ++ .available_data = available_data, ++ .area = *area, ++ .pressure = pressure, + }; + + post_device_event(device, time, +@@ -1528,7 +1723,10 @@ touch_notify_touch_motion(struct libinput_device *device, + uint64_t time, + int32_t slot, + int32_t seat_slot, +- const struct device_coords *point) ++ const struct device_coords *point, ++ enum touch_slot_data available_data, ++ const struct ellipse *area, ++ int32_t pressure) + { + struct libinput_event_touch *touch_event; + +@@ -1544,6 +1742,9 @@ touch_notify_touch_motion(struct libinput_device *device, + .slot = slot, + .seat_slot = seat_slot, + .point = *point, ++ .available_data = available_data, ++ .area = *area, ++ .pressure = pressure, + }; + + post_device_event(device, time, +diff --git a/src/libinput.h b/src/libinput.h +index 88b3c05..34ef518 100644 +--- a/src/libinput.h ++++ b/src/libinput.h +@@ -968,6 +968,228 @@ libinput_event_touch_get_y_transformed(struct libinput_event_touch *event, + /** + * @ingroup event_touch + * ++ * Return the diameter of the major axis of the touch ellipse in mm. ++ * This value might not be provided by the device, in that case the value ++ * 0.0 is returned. ++ * ++ * A more detailed explanation can be found in @ref touch_event_properties. ++ * ++ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. ++ * ++ * @note It is an application bug to call this function for events of type ++ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION. ++ * ++ * @param event The libinput touch event ++ * @return The current major axis diameter ++ */ ++double ++libinput_event_touch_get_major(struct libinput_event_touch *event); ++ ++/** ++ * @ingroup event_touch ++ * ++ * Return the diameter of the major axis of the touch ellipse in screen ++ * space. This value might not be provided by the device, in that case the ++ * value 0.0 is returned. ++ * ++ * A more detailed explanation can be found in @ref touch_event_properties. ++ * ++ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION this function returns 0. ++ * ++ * @note It is an application bug to call this function for events of type ++ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION. ++ * ++ * @param event The libinput touch event ++ * @param width The current output screen width ++ * @param height The current output screen height ++ * @return The current major axis diameter ++ */ ++double ++libinput_event_touch_get_major_transformed(struct libinput_event_touch *event, ++ uint32_t width, ++ uint32_t height); ++ ++/** ++ * @ingroup event_touch ++ * ++ * Return if the event contains a major axis value of the touch ellipse. ++ * ++ * A more detailed explanation can be found in @ref touch_event_properties. ++ * ++ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. ++ * ++ * @note It is an application bug to call this function for events of type ++ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION. ++ * ++ * @param event The libinput touch event ++ * @return Whether a major diameter is available ++ */ ++int ++libinput_event_touch_has_major(struct libinput_event_touch *event); ++ ++/** ++ * @ingroup event_touch ++ * ++ * Return the diameter of the minor axis of the touch ellipse in mm. ++ * This value might not be provided by the device, in this case the value ++ * 0.0 is returned. ++ * ++ * A more detailed explanation can be found in @ref touch_event_properties. ++ * ++ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION this function returns 0. ++ * ++ * @note It is an application bug to call this function for events of type ++ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION. ++ * ++ * @param event The libinput touch event ++ * @return The current minor diameter ++ */ ++double ++libinput_event_touch_get_minor(struct libinput_event_touch *event); ++ ++/** ++ * @ingroup event_touch ++ * ++ * Return the diameter of the minor axis of the touch ellipse in screen ++ * space. This value might not be provided by the device, in this case ++ * the value 0.0 is returned. ++ * ++ * A more detailed explanation can be found in @ref touch_event_properties. ++ * ++ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION this function returns 0. ++ * ++ * @note It is an application bug to call this function for events of type ++ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION. ++ * ++ * @param event The libinput touch event ++ * @param width The current output screen width ++ * @param height The current output screen height ++ * @return The current minor diameter ++ */ ++double ++libinput_event_touch_get_minor_transformed(struct libinput_event_touch *event, ++ uint32_t width, ++ uint32_t height); ++/** ++ * @ingroup event_touch ++ * ++ * Return if the event contains a minor axis value of the touch ellipse. ++ * ++ * A more detailed explanation can be found in @ref touch_event_properties. ++ * ++ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. ++ * ++ * @note It is an application bug to call this function for events of type ++ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION. ++ * ++ * @param event The libinput touch event ++ * @return Whether a minor diameter is available ++ */ ++int ++libinput_event_touch_has_minor(struct libinput_event_touch *event); ++ ++/** ++ * @ingroup event_touch ++ * ++ * Return the pressure value applied to the touch contact normalized to the ++ * range [0, 1]. If this value is not available the function returns the maximum ++ * value 1.0. ++ * ++ * A more detailed explanation can be found in @ref touch_event_properties. ++ * ++ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION this function returns 0. ++ * ++ * @note It is an application bug to call this function for events of type ++ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION. ++ * ++ * @param event The libinput touch event ++ * @return The current pressure value ++ */ ++double ++libinput_event_touch_get_pressure(struct libinput_event_touch *event); ++ ++/** ++ * @ingroup event_touch ++ * ++ * Return if the event contains a pressure value for the touch contact. ++ * ++ * A more detailed explanation can be found in @ref touch_event_properties. ++ * ++ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. ++ * ++ * @note It is an application bug to call this function for events of type ++ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION. ++ * ++ * @param event The libinput touch event ++ * @return Whether a pressure value is available ++ */ ++int ++libinput_event_touch_has_pressure(struct libinput_event_touch *event); ++ ++/** ++ * @ingroup event_touch ++ * ++ * Return the major axis rotation in degrees, clockwise from the logical north ++ * of the touch screen. ++ * ++ * @note Even when the orientation is measured by the device, it might be only ++ * available in coarse steps (e.g only indicating alignment with either of the ++ * axes). ++ * ++ * A more detailed explanation can be found in @ref touch_event_properties. ++ * ++ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. ++ * ++ * @note It is an application bug to call this function for events of type ++ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION. ++ * ++ * @param event The libinput touch event ++ * @return The current orientation value ++ */ ++double ++libinput_event_touch_get_orientation(struct libinput_event_touch *event); ++ ++/** ++ * @ingroup event_touch ++ * ++ * Return if the event contains a orientation value for the touch contact. ++ * ++ * A more detailed explanation can be found in @ref touch_event_properties. ++ * ++ * For events not of type @ref LIBINPUT_EVENT_TOUCH_DOWN, @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. ++ * ++ * @note It is an application bug to call this function for events of type ++ * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref ++ * LIBINPUT_EVENT_TOUCH_MOTION. ++ * ++ * @param event The libinput touch event ++ * @return Whether a orientation value is available ++ */ ++int ++libinput_event_touch_has_orientation(struct libinput_event_touch *event); ++ ++/** ++ * @ingroup event_touch ++ * + * @return The generic libinput_event of this event + */ + struct libinput_event * +diff --git a/src/libinput.sym b/src/libinput.sym +index 7e0ef1c..12edd15 100644 +--- a/src/libinput.sym ++++ b/src/libinput.sym +@@ -172,3 +172,16 @@ LIBINPUT_0.21.0 { + libinput_event_pointer_get_time_usec; + libinput_event_touch_get_time_usec; + } LIBINPUT_0.20.0; ++ ++LIBINPUT_0.22.0 { ++ libinput_event_touch_get_major; ++ libinput_event_touch_get_major_transformed; ++ libinput_event_touch_get_minor; ++ libinput_event_touch_get_minor_transformed; ++ libinput_event_touch_get_orientation; ++ libinput_event_touch_get_pressure; ++ libinput_event_touch_has_major; ++ libinput_event_touch_has_minor; ++ libinput_event_touch_has_orientation; ++ libinput_event_touch_has_pressure; ++} LIBINPUT_0.21.0; +diff --git a/test/touch.c b/test/touch.c +index eae8007..066eee4 100644 +--- a/test/touch.c ++++ b/test/touch.c +@@ -673,6 +673,243 @@ START_TEST(touch_time_usec) + } + END_TEST + ++static inline double calc_diameter_scale(double x_res, ++ double y_res, ++ double orientation) ++{ ++ double orientation_rad = deg2rad(orientation); ++ if (x_res == y_res) ++ return x_res; ++ ++ return y_res * fabs(cos(orientation_rad)) + ++ x_res * fabs(sin(orientation_rad)); ++} ++ ++static inline bool exceeds_range(const struct input_absinfo *info, ++ int value) ++{ ++ return !info || (info->minimum > value) || (info->maximum < value); ++} ++ ++START_TEST(touch_point_properties) ++{ ++ struct litest_device *dev = litest_current_device(); ++ struct libinput *li = dev->libinput; ++ struct libinput_event *ev; ++ struct libinput_event_touch *tev; ++ ++ const int touch_x = 50; ++ const int touch_y = 90; ++ const int input_orientation = 64; ++ const int input_pressure = 128; ++ const int input_major = 14; ++ const int input_minor= 8; ++ ++ const int input_orientation_2 = 128; ++ const int input_major_2 = 30; ++ ++ struct axis_replacement down_values[] = { ++ {ABS_MT_PRESSURE, input_pressure}, ++ {ABS_MT_ORIENTATION, input_orientation}, ++ {ABS_MT_TOUCH_MAJOR, input_major}, ++ {ABS_MT_TOUCH_MINOR, input_minor}, ++ {-1, -1}}; ++ struct axis_replacement move_values[] = { ++ {ABS_MT_ORIENTATION, input_orientation_2}, ++ {ABS_MT_TOUCH_MAJOR, input_major_2}, ++ {-1, -1}}; ++ const struct input_absinfo *orientation_info; ++ const struct input_absinfo *pressure_info; ++ const struct input_absinfo *major_info; ++ const struct input_absinfo *minor_info; ++ const struct input_absinfo *x_info, *y_info; ++ ++ double x_res, y_res, touch_minor_scale, touch_major_scale; ++ ++ double expected_major; ++ double expected_minor; ++ double expected_orientation; ++ double expected_pressure; ++ ++ pressure_info = libevdev_get_abs_info(dev->evdev, ABS_MT_PRESSURE); ++ orientation_info = libevdev_get_abs_info(dev->evdev, ABS_MT_ORIENTATION); ++ major_info = libevdev_get_abs_info(dev->evdev, ABS_MT_TOUCH_MAJOR); ++ minor_info = libevdev_get_abs_info(dev->evdev, ABS_MT_TOUCH_MINOR); ++ x_info = libevdev_get_abs_info(dev->evdev, ABS_MT_POSITION_X); ++ y_info = libevdev_get_abs_info(dev->evdev, ABS_MT_POSITION_Y); ++ ++ if (!orientation_info || !pressure_info || !major_info || !minor_info) ++ return; ++ ++ if (exceeds_range(pressure_info, input_pressure) || ++ exceeds_range(major_info, input_major) || ++ exceeds_range(major_info, input_major_2) || ++ exceeds_range(minor_info, input_minor) || ++ exceeds_range(orientation_info, input_orientation) || ++ exceeds_range(orientation_info, input_orientation_2)) { ++ fprintf(stderr, "%s does not support the required value ranges", ++ libinput_device_get_name(dev->libinput_device)); ++ return; ++ } ++ ++ x_res = x_info->resolution ? x_info->resolution : 1; ++ y_res = y_info->resolution ? y_info->resolution : 1; ++ ++ expected_orientation = 90.0 * input_orientation / ++ orientation_info->maximum; ++ touch_major_scale = calc_diameter_scale(x_res, ++ y_res, ++ expected_orientation); ++ touch_minor_scale = calc_diameter_scale(x_res, ++ y_res, ++ expected_orientation + 90.0); ++ expected_major = input_major / touch_major_scale; ++ expected_minor = input_minor / touch_minor_scale; ++ expected_pressure = (double)input_pressure / (pressure_info->maximum - ++ pressure_info->minimum); ++ ++ litest_drain_events(li); ++ ++ litest_touch_down_extended(dev, 0, touch_x, touch_y, down_values); ++ ++ litest_wait_for_event(li); ++ ev = libinput_get_event(li); ++ tev = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); ++ ++ ck_assert_double_eq(libinput_event_touch_get_pressure(tev), ++ expected_pressure); ++ ck_assert_double_eq(libinput_event_touch_get_orientation(tev), ++ expected_orientation); ++ ck_assert_double_eq(libinput_event_touch_get_major(tev), ++ expected_major); ++ ck_assert_double_eq(libinput_event_touch_get_minor(tev), ++ expected_minor); ++ ++ libinput_event_destroy(ev); ++ ++ litest_touch_move_extended(dev, 0, touch_x, touch_y, move_values); ++ ++ do { ++ litest_wait_for_event(li); ++ ev = libinput_get_event(li); ++ } while (libinput_event_get_type(ev) == LIBINPUT_EVENT_TOUCH_FRAME); ++ tev = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_MOTION); ++ ++ expected_orientation = 90.0 * input_orientation_2 / ++ orientation_info->maximum; ++ touch_major_scale = calc_diameter_scale(x_res, ++ y_res, ++ expected_orientation); ++ expected_major = input_major_2 / touch_major_scale; ++ ++ ck_assert_double_eq(libinput_event_touch_get_pressure(tev), ++ expected_pressure); ++ ck_assert_double_eq(libinput_event_touch_get_orientation(tev), ++ expected_orientation); ++ ck_assert_double_eq(libinput_event_touch_get_major(tev), ++ expected_major); ++ ck_assert_double_eq(libinput_event_touch_get_minor(tev), ++ expected_minor); ++ ++ libinput_event_destroy(ev); ++} ++END_TEST ++ ++START_TEST(touch_point_no_minor_or_orienation) ++{ ++ struct litest_device *dev = litest_current_device(); ++ struct libinput *li = dev->libinput; ++ struct libinput_event *ev; ++ struct libinput_event_touch *tev; ++ const int touch_x = 50; ++ const int touch_y = 90; ++ const int input_pressure = 43; ++ const int input_major = 23; ++ const int input_major_2 = 30; ++ ++ struct axis_replacement down_values[] = { ++ {ABS_MT_PRESSURE, input_pressure}, ++ {ABS_MT_TOUCH_MAJOR, input_major}, ++ {-1, -1}}; ++ struct axis_replacement move_values[] = { ++ {ABS_MT_TOUCH_MAJOR, input_major_2}, ++ {-1, -1}}; ++ ++ const struct input_absinfo *orientation_info; ++ const struct input_absinfo *pressure_info; ++ const struct input_absinfo *x_info; ++ const struct input_absinfo *major_info; ++ double touch_major_scale; ++ ++ double expected_major; ++ double expected_minor; ++ double expected_orientation = 0.0; ++ double expected_pressure; ++ ++ x_info = libevdev_get_abs_info(dev->evdev, ABS_MT_POSITION_X); ++ pressure_info = libevdev_get_abs_info(dev->evdev, ABS_MT_PRESSURE); ++ major_info = libevdev_get_abs_info(dev->evdev, ABS_MT_TOUCH_MAJOR); ++ orientation_info = libevdev_get_abs_info(dev->evdev, ++ ABS_MT_ORIENTATION); ++ ++ if (orientation_info || !pressure_info || !x_info || !major_info || ++ !libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_TOUCH_MAJOR) || ++ libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_TOUCH_MINOR)) ++ return; ++ ++ if (exceeds_range(pressure_info, input_pressure) || ++ exceeds_range(major_info, input_major) || ++ exceeds_range(major_info, input_major_2)) { ++ fprintf(stderr, "%s does not support the required value ranges", ++ libinput_device_get_name(dev->libinput_device)); ++ return; ++ } ++ ++ expected_pressure = (double) input_pressure / ++ (pressure_info->maximum - pressure_info->minimum); ++ touch_major_scale = x_info->resolution ? x_info->resolution : 1; ++ expected_major = input_major / touch_major_scale; ++ expected_minor = expected_major; ++ ++ litest_drain_events(li); ++ ++ litest_touch_down_extended(dev, 0, touch_x, touch_y, down_values); ++ ++ litest_wait_for_event(li); ++ ev = libinput_get_event(li); ++ tev = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); ++ ++ ck_assert_double_eq(libinput_event_touch_get_orientation(tev), ++ expected_orientation); ++ ck_assert_double_eq(libinput_event_touch_get_pressure(tev), ++ expected_pressure); ++ ck_assert_double_eq(libinput_event_touch_get_major(tev), ++ expected_major); ++ ck_assert_double_eq(libinput_event_touch_get_minor(tev), ++ expected_minor); ++ ++ libinput_event_destroy(ev); ++ ++ expected_major = input_major_2 / touch_major_scale; ++ expected_minor = expected_major; ++ ++ litest_touch_move_extended(dev, 0, touch_x, touch_y, move_values); ++ ++ do { ++ litest_wait_for_event(li); ++ ev = libinput_get_event(li); ++ } while (libinput_event_get_type(ev) == LIBINPUT_EVENT_TOUCH_FRAME); ++ tev = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_MOTION); ++ ++ ck_assert_double_eq(libinput_event_touch_get_major(tev), ++ expected_major); ++ ck_assert_double_eq(libinput_event_touch_get_minor(tev), ++ expected_minor); ++ ++ libinput_event_destroy(ev); ++} ++END_TEST ++ + void + litest_setup_tests(void) + { +@@ -697,6 +934,8 @@ litest_setup_tests(void) + litest_add("touch:protocol a", touch_protocol_a_init, LITEST_PROTOCOL_A, LITEST_ANY); + litest_add("touch:protocol a", touch_protocol_a_touch, LITEST_PROTOCOL_A, LITEST_ANY); + litest_add("touch:protocol a", touch_protocol_a_2fg_touch, LITEST_PROTOCOL_A, LITEST_ANY); ++ litest_add("touch:properties", touch_point_properties, LITEST_TOUCH|LITEST_ELLIPSE, LITEST_ANY); ++ litest_add("touch:properties", touch_point_no_minor_or_orienation, LITEST_TOUCH|LITEST_ELLIPSE, LITEST_ANY); + + litest_add_ranged("touch:state", touch_initial_state, LITEST_TOUCH, LITEST_PROTOCOL_A, &axes); + +-- +2.1.4 diff -Nru libinput-1.10.3/debian/rules libinput-0.21.0/debian/rules --- libinput-1.10.3/debian/rules 2018-03-14 08:51:30.000000000 +0000 +++ libinput-0.21.0/debian/rules 2015-08-07 05:34:54.000000000 +0000 @@ -1,22 +1,14 @@ #!/usr/bin/make -f -override_dh_auto_configure: - dh_auto_configure -- \ - -Ddebug-gui=false \ - -Ddocumentation=false \ - -Dtests=false \ - -Dudev-dir=/lib/udev - -override_dh_install: - find debian/tmp -name '*.la' -delete - dh_install --fail-missing - override_dh_makeshlibs: dh_makeshlibs -plibinput10 -V --add-udeb="libinput10-udeb" -- -c4 +override_dh_strip: + dh_strip --dbg-package=libinput10-dbg + override_dh_clean: rm -f doc/doxygen_sqlite3.db dh_clean %: - dh $@ + dh $@ --with autoreconf diff -Nru libinput-1.10.3/debian/upstream/signing-key.asc libinput-0.21.0/debian/upstream/signing-key.asc --- libinput-1.10.3/debian/upstream/signing-key.asc 2018-03-14 08:51:30.000000000 +0000 +++ libinput-0.21.0/debian/upstream/signing-key.asc 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1 - -mQGiBD8b0wYRBACph9kRJmP+4+JGsCgFlFoy4vFO0DCG+jmkQN0n1wdInt/N/UtA -sZToO72AUmfmYizA+IEbzBrx0UnUo3w3BDmHxUWf/akZiPUz9AA/YFY4xC3MY2OK -VN2Jz6YSce4zJ5jd2ZRobHm4HuIf/8yqSCcsv7FNfrLaTNIFRs5gYYsqZwCgwmkp -RSLRc8WAnHrTWNQDaEFM2rUEAKTjrTjMN8+KGd0BxNX7HiTSqQP++nXNwAYs1oWB -Yt82YHj9SvRCqCzD1pzJQivYnlNoWDza1VeMnfdAvkdia8z4lYbO/RunXZJvra3Z -VDm+izq+uwUAyvFuEYnNz09VSqwXKT6+XW0Xtz2vHq52r6DS6mK8cGJHZ5OhrRjq -UEYxA/9STh+QfA98xtNoRcf52E/46r7IpCj440oRVc9lMfxQZrLGQNqp7sPdIhGQ -CCo2NUII5hkhdAG71kpbfSXU4Sh32p1cU1KYCAkDFfb49bKuAs+Pff8v6FGZxTdd -AinPZr4BbsYJatk818aTCnu0+s7L8jL5GPfeyuyEMKwzVBx2mLQpUGV0ZXIgSHV0 -dGVyZXIgKFdoby1UKSA8b2ZmaWNlQHdoby10Lm5ldD6IWQQTEQIAGQUCPxvTBgQL -BwMCAxUCAwMWAgECHgECF4AACgkQ4jt+cLRn8L/0RACfWo3KTMUg+uPRqA6RXxk0 -4CWjXaMAoJeIxOpZLB3RBltPnSi7PyVQIkHFuQENBD8b0wgQBACTnqOYOWYVR8O1 -D73J6nbdAeZCbXrUkyXIuyqBOdKmX/0QJmSs7Wfsa+hPfDhj6ai0Gs2C8Qg/0Pzk -86b4p9DLkf0M6RaYjUtCJBpS59xrsV6nz6xZzQa4RRdf1YJmw2tia1MMXzxbwQU2 -bKpYEm8NsGaBURMGd02EvsMN2wI2uwADBQP/e9MjVr/85XDzAlUBN8HwYW5szTyP -8ZVcQOqOmNebkTWGLvkPrBdXmxpzrWjxPolO1WcWQjUL0bN/rbdqefT65iVHJHJZ -/cpTtgGlCPhL5JTA50ltd0I13CABYWLFmswonXES/6tcglf4rr3Nri2sOrY5HggP -ipEzOo5vdKOow/qIRgQYEQIABgUCPxvTCAAKCRDiO35wtGfwv68jAKCDvL2gkrg1 -4NfV7rNc057K1nL2GgCeKApWRgGVzaOkAp0P5tQulaDD6zM= -=7uBX ------END PGP PUBLIC KEY BLOCK----- diff -Nru libinput-1.10.3/debian/watch libinput-0.21.0/debian/watch --- libinput-1.10.3/debian/watch 2018-03-14 08:51:30.000000000 +0000 +++ libinput-0.21.0/debian/watch 2015-08-05 06:34:07.000000000 +0000 @@ -1,4 +1,4 @@ #git=git://anongit.freedesktop.org/wayland/libinput version=3 -opts=pgpsigurlmangle=s/$/.sig/,dversionmangle=s/\+dfsg\d*$// \ +opts=dversionmangle=s/\+dfsg\d*$// \ http://www.freedesktop.org/software/libinput/libinput-(.*)\.tar\.xz diff -Nru libinput-1.10.3/depcomp libinput-0.21.0/depcomp --- libinput-1.10.3/depcomp 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/depcomp 2015-08-04 00:31:40.000000000 +0000 @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2013-05-30.07; # UTC + +# Copyright (C) 1999-2014 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + make_dummy_depfile + fi +} + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Avoid interferences from the environment. +gccflag= dashmflag= + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. +## (see the conditional assignment to $gccflag above). +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). Also, it might not be +## supported by the other compilers which use the 'gcc' depmode. +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The second -e expression handles DOS-style file names with drive + # letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the "deleted header file" problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. +## Some versions of gcc put a space before the ':'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like '#:fec' to the end of the + # dependency line. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts '$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + aix_post_process_depfile + ;; + +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +## The order of this option in the case statement is important, since the +## shell code in configure will try each of these formats in the order +## listed in this file. A plain '-MD' option would be understood by many +## compilers, so we must ensure this comes after the gcc and icc options. +pgcc) + # Portland's C compiler understands '-MD'. + # Will always output deps to 'file.d' where file is the root name of the + # source file under compilation, even if file resides in a subdirectory. + # The object file name does not affect the name of the '.d' file. + # pgcc 10.2 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\' : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + set_dir_from "$object" + # Use the source, not the object, to determine the base name, since + # that's sadly what pgcc will do too. + set_base_from "$source" + tmpdepfile=$base.d + + # For projects that build the same source file twice into different object + # files, the pgcc approach of using the *source* file root name can cause + # problems in parallel builds. Use a locking strategy to avoid stomping on + # the same $tmpdepfile. + lockdir=$base.d-lock + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir '$lockdir' + exit 1 + " 1 2 13 15 + numtries=100 + i=$numtries + while test $i -gt 0; do + # mkdir is a portable test-and-set. + if mkdir "$lockdir" 2>/dev/null; then + # This process acquired the lock. + "$@" -MD + stat=$? + # Release the lock. + rmdir "$lockdir" + break + else + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. + while test -d "$lockdir" && test $i -gt 0; do + sleep 1 + i=`expr $i - 1` + done + fi + i=`expr $i - 1` + done + trap - 1 2 13 15 + if test $i -le 0; then + echo "$0: failed to acquire lock after $numtries attempts" >&2 + echo "$0: check lockdir '$lockdir'" >&2 + exit 1 + fi + + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # Libtool generates 2 separate objects for the 2 libraries. These + # two compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for ':' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + "$@" $dashmflag | + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E \ + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + | sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru libinput-1.10.3/doc/absolute-axes.dox libinput-0.21.0/doc/absolute-axes.dox --- libinput-1.10.3/doc/absolute-axes.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/absolute-axes.dox 2015-07-09 02:52:56.000000000 +0000 @@ -10,7 +10,7 @@ - multi-touch screens - single-touch screens - - @ref tablet-support "graphics tablets" + - graphics tablets (currently WIP) Touchpads are technically absolute devices but libinput converts the axis values to directional motion and posts events as relative events. Touchpads do not count @@ -18,10 +18,7 @@ For all absolute devices in libinput, the default unit for x/y coordinates is in mm off the top left corner on the device, or more specifically off the -device's sensor. If the device is physically rotated from its natural -position and this rotation was communicated to libinput (e.g. -@ref libinput_device_config_left_handed_set "by setting the device left-handed"), -the coordinate origin is the top left corner of in the current rotation. +device's sensor. @section absolute_axes_handling Handling of absolute coordinates @@ -43,7 +40,7 @@ @section absolute_axes_nores Devices without x/y resolution An absolute device that does not provide a valid resolution is considered -buggy and must be fixed in the kernel. Some touchpad devices do not +buggy and must be fixed in the kernel. Some touchpad devices that do not provide resolution, those devices are correctly handled within libinput (touchpads are not absolute devices, as mentioned above). @@ -70,7 +67,7 @@ usually requires an offset to move the coordinates back into the original range. -The most common matrices are: +The most comon matrices are: - 90 degree clockwise: @f$ @@ -110,13 +107,10 @@ See Wikipedia's Transformation -Matrix article for more information on the matrix maths. See -libinput_device_config_calibration_get_default_matrix() for how these -matrices must be supplied to libinput. +Matrix article for more information on the matrix maths. -Once applied, any x and y axis value has the calibration applied before it -is made available to the caller. libinput does not provide access to the -raw coordinates before the calibration is applied. +See libinput_device_config_calibration_get_default_matrix() for how these +matrices must be supplied to libinput. @section absolute_axes_nonorm Why x/y coordinates are not normalized diff -Nru libinput-1.10.3/doc/absolute-coordinate-ranges.dox libinput-0.21.0/doc/absolute-coordinate-ranges.dox --- libinput-1.10.3/doc/absolute-coordinate-ranges.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/absolute-coordinate-ranges.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -/** -@page absolute_coordinate_ranges Coordinate ranges for absolute axes - -libinput requires that all touchpads provide a correct axis range and -resolution. These are used to enable or disable certain features or adapt -the interaction with the touchpad. For example, the software button area is -narrower on small touchpads to avoid reducing the interactive surface too -much. Likewise, palm detection works differently on small touchpads as palm -interference is less likely to happen. - -Touchpads with incorrect axis ranges generate error messages -in the form: -
-Axis 0x35 value 4000 is outside expected range [0, 3000] -
- -This error message indicates that the ABS_MT_POSITION_X axis (i.e. the x -axis) generated an event outside the expected range of 0-3000. In this case -the value was 4000. -This discrepancy between the coordinate range the kernels advertises vs. -what the touchpad sends can be the source of a number of perceived -bugs in libinput. - -@section absolute_coordinate_ranges_fix Measuring and fixing touchpad ranges - -To fix the touchpad you need to: --# measure the physical size of your touchpad in mm --# run touchpad-edge-detector --# trim the udev match rule to something sensible --# replace the resolution with the calculated resolution based on physical - settings --# test locally --# send a patch to the systemd project - -Detailed explanations are below. - -[libevdev](http://freedesktop.org/wiki/Software/libevdev/) provides a tool -called **touchpad-edge-detector** that allows measuring the touchpad's input -ranges. Run the tool as root against the device node of your touchpad device -and repeatedly move a finger around the whole outside area of the -touchpad. Then control+c the process and note the output. -An example output is below: - -@code -$> sudo touchpad-edge-detector /dev/input/event4 -Touchpad SynPS/2 Synaptics TouchPad on /dev/input/event4 -Move one finger around the touchpad to detect the actual edges -Kernel says: x [1024..3112], y [2024..4832] -Touchpad sends: x [2445..4252], y [3464..4071] - -Touchpad size as listed by the kernel: 49x66mm -Calculate resolution as: - x axis: 2088/ - y axis: 2808/ - -Suggested udev rule: -# -evdev:name:SynPS/2 Synaptics TouchPad:dmi:bvnLENOVO:bvrGJET72WW(2.22):bd02/21/2014:svnLENOVO:pn20ARS25701:pvrThinkPadT440s:rvnLENOVO:rn20ARS25701:rvrSDK0E50512STD:cvnLENOVO:ct10:cvrNotAvailable:* - EVDEV_ABS_00=2445:4252: - EVDEV_ABS_01=3464:4071: - EVDEV_ABS_35=2445:4252: - EVDEV_ABS_36=3464:4071: - -@endcode - -Note the discrepancy between the coordinate range the kernels advertises vs. -what the touchpad sends. -To fix the advertised ranges, the udev rule should be taken and trimmed -before being sent to the [systemd project](https://github.com/systemd/systemd). -An example commit can be found -[here](https://github.com/systemd/systemd/commit/26f667eac1c5e89b689aa0a1daef6a80f473e045). - -In most cases the match can and should be trimmed to the system vendor (svn) -and the product version (pvr), with everything else replaced by a wildcard -(*). In this case, a Lenovo T440s, a suitable match string would be: @code -evdev:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*pvrThinkPadT440s* -@endcode - -@note hwdb match strings only allow for alphanumeric ascii characters. Use a -wildcard (* or ?, whichever appropriate) for special characters. - -The actual axis overrides are in the form: -@code -# axis number=min:max:resolution - EVDEV_ABS_00=2445:4252:42 -@endcode -or, if the range is correct but the resolution is wrong -@code -# axis number=::resolution - EVDEV_ABS_00=::42 -@endcode - -Note the leading single space. The axis numbers are in hex and can be found -in *linux/input-event-codes.h*. For touchpads ABS_X, ABS_Y, -ABS_MT_POSITION_X and ABS_MT_POSITION_Y are required. - -@note The touchpad's ranges and/or resolution should only be fixed when -there is a significant discrepancy. A few units do not make a difference and -a resolution that is off by 2 or less usually does not matter either. - -Once a match and override rule has been found, follow the instructions at -the top of the -[60-evdev.hwdb](https://github.com/systemd/systemd/blob/master/hwdb/60-evdev.hwdb) -file to save it locally and trigger the udev hwdb reload. Rebooting is -always a good idea. If the match string is correct, the new properties will -show up in the -output of -@code - udevadm info /sys/class/input/event4 -@endcode - -Adjust the command for the event node of your touchpad. -A udev builtin will apply the new axis ranges automatically. - -When the axis override is confirmed to work, please submit it as a patch to -the [systemd project](https://github.com/systemd/systemd) or if that is not -possible as a libinput bug here: -https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=libinput -*/ diff -Nru libinput-1.10.3/doc/building.dox libinput-0.21.0/doc/building.dox --- libinput-1.10.3/doc/building.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/building.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,238 +0,0 @@ -/** -@page building_libinput libinput build instructions - -@tableofcontents - -Instructions on how to build libinput and its tools and how to build against -libinput. - -The build instruction on this page detail how to overwrite your -system-provided libinput with one from the git repository, see -see @ref reverting_install to revert to the previous state. - -@section building Building libinput - -libinput uses [meson](https://www.mesonbuild.com) and -[ninja](https://www.ninja-build.org). A build is usually the three-step -process below. A successful build requires the @ref -building_dependencies to be installed before running meson. - -@code -$> git clone git://anongit.freedesktop.org/git/wayland/libinput -$> cd libinput -$> meson --prefix=/usr builddir/ -$> ninja -C builddir/ -$> sudo ninja -C builddir/ install -$> sudo udevadm hwdb --update -@endcode - -Additional options may also be specified. For example: -@code -$> meson --prefix=/usr -Ddocumentation=false -Dlibwacom=false builddir/ -@endcode - -The ```prefix``` or other options can be changed later with the -```mesonconf``` command. For example: -@code -$> mesonconf builddir/ -Dprefix=/some/other/prefix -Ddocumentation=true -$> ninja -C builddir -$> sudo ninja -C builddir/ install -@endcode - -Running ``mesonconf builddir/`` with no other arguments lists all -configurable options meson provides. - -To rebuild from scratch, simply remove the build directory and run meson -again: -@code -$> rm -r builddir/ -$> meson --prefix=.... -@endcode - -@subsection verifying_install Verifying the install - -To verify the install worked correctly, check that libinput.so.x.x.x is in -the library path and that all symlinks point to the new library. -
-$> ls -l /usr/lib64/libinput.*
--rwxr-xr-x 1 root root    946 Apr 28  2015 /usr/lib64/libinput.la
-lrwxrwxrwx 1 root root     19 Feb  1 15:12 /usr/lib64/libinput.so -> libinput.so.10.13.0
-lrwxrwxrwx 1 root root     19 Feb  1 15:12 /usr/lib64/libinput.so.10 -> libinput.so.10.13.0
--rwxr-xr-x 1 root root 204992 Feb  1 15:12 /usr/lib64/libinput.so.10.13.0
-
- -@subsection reverting_install Reverting to the system-provided libinput package - -The recommended way to revert to the system install is to use the package -manager to reinstall the libinput package. In some cases, this may leave -files in the system (e.g. ```/usr/lib/libinput.la```) but these files are -usually harmless. To definitely remove all files, run the following command -from the libinput source directory: - -@code -$> sudo ninja -C builddir/ uninstall -# WARNING: Do not restart the computer/X/the Wayland compositor after -# uninstall, reinstall the system package immediately! -@endcode - -The following commands reinstall the current system package for libinput, -overwriting manually installed files. - -
    -
  • Debian/Ubuntu based distributions: ```sudo apt-get install ---reinstall libinput```
  • -
  • Fedora 22 and later: ```sudo dnf reinstall libinput```
  • -
  • RHEL/CentOS/Fedora 21 and earlier: ```sudo yum reinstall libinput```
  • -
  • openSUSE: ```sudo zypper install --force libinput10```
  • -
  • Arch: ```sudo packman -S libinput```
  • -
- -@subsection building_selinux SELinux adjustments - -On systems with SELinux, overwriting the distribution-provided package with -a manually built libinput may cause SELinux denials. This usually manifests -when gdm does not start because it is denied access to libinput. The journal -shows a log message in the form of: - -
-May 25 15:28:42 localhost.localdomain audit[23268]: AVC avc:  denied  { execute } for  pid=23268 comm="gnome-shell" path="/usr/lib64/libinput.so.10.12.2" dev="dm-0" ino=1709093 scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=0
-May 25 15:28:42 localhost.localdomain org.gnome.Shell.desktop[23270]: /usr/bin/gnome-shell: error while loading shared libraries: libinput.so.10: failed to map segment from shared object
-
- -The summary of this error message is that gdm's gnome-shell runs in the -```system_u:system_r:xdm_t``` context but libinput is installed with the -context ```unconfined_u:object_r:user_home_t```. - -To avoid this issue, restore the SELinux context for any system files. - -
-$> sudo restorecon /usr/lib*/libinput.so.*
-
- -This issue is tracked in https://github.com/mesonbuild/meson/issues/1967. - -@subsection building_dependencies Build dependencies - -libinput has a few build-time dependencies that must be installed prior to -running configure. In most cases, it is sufficient to install the -dependencies that your distribution uses to build the libinput package. -These can be installed with one of the following commands: - -
    -
  • Debian/Ubuntu based distributions: ```sudo apt-get build-dep -libinput```
  • -
  • Fedora 22 and later: ```sudo dnf builddep libinput```
  • -
  • RHEL/CentOS/Fedora 21 and earlier: ```sudo yum-builddep libinput```
  • -
  • openSUSE: -
    -$> sudo zypper modifyrepo --enable `zypper repos | grep source | awk '{print $5}'`
    -$> sudo zypper source-install -d libinput10
    -$> sudo zypper install autoconf automake libtool
    -$> sudo zypper modifyrepo --disable `zypper repos | grep source | awk '{print $5}'`
    -
    -
  • -
  • Arch: -
    -$> sudo pacman -S asp
    -$> cd $(mktemp -d)
    -$> asp export libinput
    -$> cd libinput
    -$> makepkg --syncdeps --nobuild --noextract
    -
    -
  • -
- -If dependencies are missing, a message ```No package 'foo' found``` will be -shown during the configure stage. See -this blog post here. -for instructions on how to fix it. - -@subsection building_libwacom Building without libwacom - -libwacom is required by libinput's tablet code to gather additional -information about tablets that is not available from the kernel device -itself. libwacom is required by default but can be skipped when @ref -building. - -@code -$> meson --prefix=/usr -Dlibwacom=false builddir -@endcode - -It is not recommended to disable libwacom unless libinput is used in an -environment where tablet support is not required. libinput provides tablet -support even without libwacom, but some features may be missing or working -differently. - -@subsection building_debug_gui Building without the graphical helper tool - -The @ref tools provide commandline features as well as graphical debugging -features. To keep dependencies in check on some builds, the graphical -features of the @ref tools can be disabled. By default, the `debug-gui` -feature of the `libinput` tool is enabled and if the required libraries are -not available, the build will fail. If the feature is not required, use the -``--disable-debug-gui`` argument when @ref building. - -@code -$> meson --prefix=/usr -Ddebug-gui=false builddir -@endcode - -@subsection building_autotools Building with autotools - -libinput no longer supports building with autotools. These -instructions are kept for users for libinput versions up to 1.8.x. - -A build with automake is usually the process below. A successful build -requires the @ref building_dependencies to be installed at configure -time. - -@code -$> git clone git://anongit.freedesktop.org/git/wayland/libinput -$> cd libinput -$> ./autogen.sh --prefix=/usr --libdir=/usr/lib64 -$> make -$> sudo make install -$> sudo udevadm hwdb --update -@endcode - -@note On Debian-based distributions including Ubuntu and its derivatives skip the -```--libdir=/usr/lib64``` argument. - -To uninstall libinput as detailed in section @ref reverting_install, run - -@code -$> sudo make uninstall -# WARNING: Do not restart the computer/X/the Wayland compositor after make -# uninstall, reinstall the system package immediately! -@endcode - -To disable libwacom as detailed in section @ref building_libwacom, run - -@code -$> ./autogen.sh --disable-libwacom --prefix=/usr --libdir=/usr/lib64 -@endcode - -To disable the graphical helper tool as detailed in section @ref -building_debug_gui, run - -@code -$> ./autogen.sh --disable-debug-gui --prefix=/usr --libdir=/usr/lib64 -@endcode - - -@section building_against Building against libinput - -libinput provides a -[pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/) file. -Software that uses libinput should use pkg-config and the -`PKG_CHECK_MODULES` autoconf macro. -Otherwise, the most rudimentary way to compile and link a program against -libinput is: - -@code - gcc -o myprogram myprogram.c `pkg-config --cflags --libs libinput` -@endcode - -For further information on using pkgconfig see the pkg-config documentation. - -*/ - diff -Nru libinput-1.10.3/doc/button_debouncing.dox libinput-0.21.0/doc/button_debouncing.dox --- libinput-1.10.3/doc/button_debouncing.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/button_debouncing.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -/** - -@page button_debouncing Button debouncing - -Physical buttons experience wear-and-tear with usage. On some devices this -can result in an effect called "contact bouncing" or "chatter". This effect -can cause the button to send multiple events within a short time frame, even -though the user only pressed or clicked the button once. This effect can be -counteracted by "debouncing" the buttons, usually by ignoring erroneous -events. - -libinput provides two methods of debouncing buttons, referred to as the -"bounce" and "spurious" methods: - -- In the "bounce" method, libinput monitors hardware bouncing on button - state changes, i.e. when a user clicks or releases a button. For example, - if a user presses a button but the hardware generates a - press-release-press sequence in quick succession, libinput ignores the - release and second press event. This method is always enabled. -- in the "spurious" method, libinput detects spurious releases of a button - while the button is physically held down by the user. These releases are - immediately followed by a press event. libinput monitors for these events - and ignores the release and press event. This method is disabled by - default and enables once libinput detects the first faulty event sequence. - -The "bounce" method guarantees that all press events are delivered -immediately and most release events are delivered immediately. The -"spurious" method requires that release events are delayed, libinput thus -does not enable this method unless a faulty event sequence is detected. A -message is printed to the log when spurious deboucing was detected. - -Note that libinput's debouncing intended to correct hardware damage or -substandard hardware. Debouncing is also used as an accessibility feature -but the requirements are different. In the accessibility feature, multiple -physical key presses, usually caused by involuntary muscle movement, must be -filtered to only one key press. This feature must be implemented higher in -the stack, libinput is limited to hardware debouncing. - -Below is an illustration of the button debouncing modes to show the relation -of the physical button state and the application state. Where applicable, an -extra line is added to show the timeouts used by libinput that -affect the button state handling. The waveform's high and low states -correspond to the buttons 'pressed' and 'released' states, respectively. - -@image html button-debouncing-wave-diagram.svg "Diagram illustrating button debouncing" - -*/ diff -Nru libinput-1.10.3/doc/button-debouncing-state-machine.svg libinput-0.21.0/doc/button-debouncing-state-machine.svg --- libinput-1.10.3/doc/button-debouncing-state-machine.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/button-debouncing-state-machine.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ - -
IS_UP
IS_UP
button
press
[Not supported by viewer]
DOWN_WAITING
DOWN_WAITING
RELEASE_PENDING
RELEASE_PENDING
timeout
timeout
notify
button
release
[Not supported by viewer]
notify
button
press
[Not supported by viewer]
IS_DOWN
IS_DOWN
button
release
button<br>release
timeout
timeout
IS_UP
IS_UP
button
release
button<br>release
button
press
[Not supported by viewer]
notify
button
release
[Not supported by viewer]
RELEASE_WAITING
RELEASE_WAITING
button
press
[Not supported by viewer]
timeout
timeout
MAYBE_SPURIOUS
MAYBE_SPURIOUS
button
release
button<br>release
timeout
short
timeout<br>short
spurious
enabled?
spurious<br>enabled?
no
no
timeout
short
timeout<br>short
RELEASED
RELEASED
button
press
[Not supported by viewer]
PRESS_PENDING
PRESS_PENDING
button
release
button<br>release
timeout
timeout
notify
button
press
[Not supported by viewer]
RELEASE_DELAYED
RELEASE_DELAYED
yes
yes
timeout
short
timeout<br>short
button
press
[Not supported by viewer]
set
timer
[Not supported by viewer]
set
timer
[Not supported by viewer]
set short
timer
set short<br>timer
other
button
[Not supported by viewer]
other
button
[Not supported by viewer]
other
button
[Not supported by viewer]
other
button
[Not supported by viewer]
other
button
[Not supported by viewer]
other
button
[Not supported by viewer]
timeout
timeout
notify
button
press
[Not supported by viewer]
other
button
[Not supported by viewer]
other
button
[Not supported by viewer]
notify
button
release
[Not supported by viewer]

Entry states: IS_UP, IS_DOWN

Assumption: state is stored per-button, and OTHER BUTTON events are always processed before the actual button. Stored state per button is a single bit (up/down), a single state for the state machine across the device is sufficient.

Start the state machine with IS_UP or IS_DOWN based on the button's bit, any OTHER BUTTON event will reset it to that state anyway, so the state can be re-used for the new button.

[Not supported by viewer]
other
button
[Not supported by viewer]
enable
spurious
enable<br>spurious
IS_DOWN
IS_DOWN
timeout
timeout
DISABLED
DISABLED
button
press
[Not supported by viewer]
notify
button
press
[Not supported by viewer]
button
release
button<br>release
notify
button
release
[Not supported by viewer]
other
button
[Not supported by viewer]

Entry state: DISABLED

Only set on devices that have button debouncing disabled. This state is effectively a noop, it just forwards the events as they come in and returns back to the same state.
[Not supported by viewer]
\ No newline at end of file diff -Nru libinput-1.10.3/doc/button-debouncing-wave-diagram.txt libinput-0.21.0/doc/button-debouncing-wave-diagram.txt --- libinput-1.10.3/doc/button-debouncing-wave-diagram.txt 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/button-debouncing-wave-diagram.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -# Source for the button debouncing wave diagram -# Paste into http://wavedrom.com/editor.html -{signal: [ - {name:'current mode', wave: '3............', data: ['normal button press and release']}, - {name:'physical button', wave: '01......0....'}, - {name:'application ', wave: '01......0....'}, - {}, - ['bounce mode', - {name:'current mode', wave: '4............', data: ['debounced button press']}, - {name:'physical button', wave: '0101...0.....'}, - {name: 'timeouts', wave: '01...0.1...0.'}, - {name:'application ', wave: '01.....0.....'}, - {}, - {name:'current mode', wave: '4............', data: ['debounced button release']}, - {name:'physical button', wave: '1...010......'}, - {name: 'timeouts', wave: '0...1...0....'}, - {name:'application ', wave: '1...0........'}, - {}, - {name:'current mode', wave: '5............', data: ['delayed button press']}, - {name:'physical button', wave: '1...01.......'}, - {name: 'timeouts', wave: '0...1...0....'}, - {name:'application ', wave: '1...0...1....'}, - {}, - {name:'current mode', wave: '5............', data: ['delayed button release']}, - {name:'physical button', wave: '0...10.......'}, - {name: 'timeouts', wave: '0...1...0....'}, - {name:'application ', wave: '0...1...0....'}, - ], - {}, - ['spurious mode', - {name:'current mode', wave: '3............', data: ['first spurious button release ']}, - {name:'physical button', wave: '1.......01...'}, - {name:'application ', wave: '1.......01...'}, - {}, - {name:'current mode', wave: '3............', data: ['later spurious button release ']}, - {name:'physical button', wave: '1....01......'}, - {name: 'timeouts', wave: '0....1..0....'}, - {name:'application ', wave: '1............'}, - {}, - {name:'current mode', wave: '3............', data: ['delayed release in spurious mode ']}, - {name:'physical button', wave: '1....0.......'}, - {name: 'timeouts', wave: '0....1..0....'}, - {name:'application ', wave: '1.......0....'} - ], - -], - head:{ - text:'Button Debouncing Scenarios', - }, -} diff -Nru libinput-1.10.3/doc/clickpad-softbuttons.dox libinput-0.21.0/doc/clickpad-softbuttons.dox --- libinput-1.10.3/doc/clickpad-softbuttons.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/clickpad-softbuttons.dox 2015-07-20 06:12:49.000000000 +0000 @@ -20,27 +20,19 @@ @section software_buttons Software button areas On most clickpads, this is the default behavior. The bottom of the touchpad -is split into three distinct areas generate left, middle or right button -events on click. The height of the button area depends on the hardware but -is usually around 10mm. +is split in the middle to generate left or right button events on click. The +height of the button area depends on the hardware but is usually around +10mm. Left, right and middle button events can be triggered as follows: - if a finger is in the main area or the left button area, a click generates left button events. - if a finger is in the right area, a click generates right button events. -- if a finger is in the middle area, a click generates middle button events. - -The middle button is always centered on the touchpad and smaller in size -than the left or right button. The actual size is device-dependent though as -many touchpads do not have visible markings for the middle button the exact -location of the button is not visibly obvious. +- if there is a finger in both the left and right button area, a click + generates middle button events. @image html software-buttons.svg "Left, right and middle-button click with software button areas" -@note If middle button emulation is enabled on a clickpad, only left and right -button areas are available. For more details, see -libinput_device_config_middle_emulation_set_enabled(). - If fingers are down in the main area in addition to fingers in the left or right button area, those fingers are are ignored. A release event always releases the buttons logically down, regardless of diff -Nru libinput-1.10.3/doc/contributing.dox libinput-0.21.0/doc/contributing.dox --- libinput-1.10.3/doc/contributing.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/contributing.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -/** - -@page contributing Contributing to libinput - -Contributions to libinput are always welcome. Any patches should be sent to -the -[wayland-devel](https://lists.freedesktop.org/mailman/listinfo/wayland-devel) -email list with a subject prefix of ````[PATCH libinput]````. The easiest -way to achieve that is to run the following command in the libinput -repository: - - git config --add format.subjectprefix "PATCH libinput" - -Likewise, any new features should also be discussed publicly on the -wayland-devel list. - -*/ - diff -Nru libinput-1.10.3/doc/device-configuration-via-udev.dox libinput-0.21.0/doc/device-configuration-via-udev.dox --- libinput-1.10.3/doc/device-configuration-via-udev.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/device-configuration-via-udev.dox 2015-07-28 22:12:38.000000000 +0000 @@ -24,7 +24,7 @@ ENV{LIBINPUT_CALIBRATION_MATRIX}="0 -1 1 1 0 0" # 90 degree clockwise ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1" # 180 degree clockwise ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1" # 270 degree clockwise - ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 1 0" # reflect along y axis + ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 1 0 0" # reflect along y axis @endcode
LIBINPUT_DEVICE_GROUP
@@ -32,12 +32,8 @@ devices with the same property value are grouped into the same device group, the value itself is irrelevant otherwise. -
LIBINPUT_IGNORE_DEVICE
-
If set to anything other than "0", the device is ignored by libinput. -See @ref ignoring_devices for more details. -
ID_SEAT
-
Assigns the physical @ref seats "seat" for this device. See +
Assigns the physical seat for this device. See libinput_seat_get_physical_name(). Defaults to "seat0".
ID_INPUT
If this property is set, the device is considered an input device. Any @@ -53,7 +49,7 @@ to determine the device type. To ensure libinput selects the correct device type, only set one of them.
WL_SEAT
-
Assigns the logical @ref seats "seat" for this device. See +
Assigns the logical seat for this device. See libinput_seat_get_logical_name() context. Defaults to "default".
MOUSE_DPI
@@ -68,11 +64,11 @@
A constant (linear) acceleration factor to apply to pointingstick deltas to normalize them.
LIBINPUT_MODEL_*
-
This prefix is reserved as private API, do not use. See @ref +
This prefix is reserved as private API, do not use.. See @ref model_specific_configuration for details.
LIBINPUT_ATTR_*
-
This prefix is reserved as private API, do not use. See @ref +
This prefix is reserved as private API, do not use.. See @ref model_specific_configuration for details.
@@ -109,33 +105,10 @@ ENV{ID_MODEL_ID}=="034b", ENV{ID_INPUT_TOUCHPAD}="", ENV{ID_INPUT_TABLET}="1" @endcode - -@section ignoring_devices Ignoring specific devices - -If a device has the LIBINPUT_IGNORE_DEVICE udev property set to any -value but "0", that device is not initialized by libinput. For a context -created with libinput_udev_create_context(), the device is silently ignored -and never shows up. If the device is added with libinput_path_add_device() -to a context created with libinput_path_create_context(), adding the device -will fail and return NULL (see that function's documentation for more -information). - -If the property value is exactly "0", then the property is considered unset -and libinput initializes the device normally. - -This property should be used for devices that are correctly detected as -input devices (see @ref udev_device_type) but that should not be used by -libinput. It is recommended that devices that should not be handled as input -devices at all unset the ID_INPUT and related properties instead. The -LIBINPUT_IGNORE_DEVICE property signals that only libinput should -ignore this property but other parts of the stack (if any) should continue -treating this device normally. - - @section model_specific_configuration Model-specific configuration libinput reserves the property prefixes LIBINPUT_MODEL_ and -LIBINPUT_ATTR_ for model-specific configuration. These prefixes +LIBINPUT_ATTR_* for model-specific configuration. These prefixes are reserved as private API, do not use. The effect of these properties may be to enable or disable certain @@ -144,163 +117,4 @@ format of the property and the value of the property are subject to change at any time. -@subsection model_specific_configuration_x220fw81 Lenovo x220 with touchpad firmware v8.1 - -The property LIBINPUT_MODEL_LENOVO_X220_TOUCHPAD_FW81 may be set by a -user in a local hwdb file. This property designates the touchpad on a Lenovo -x220 with a touchpad firmware version 8.1. When this firmware version is -installed, the touchpad is imprecise. The touchpad device does not send -continuos x/y axis position updates, a behavior also observed on its -successor model, the Lenovo x230 which has the same firmware version. If the -above property is set, libinput adjusts its behavior to better suit this -particular model. - -The touchpad firmware version cannot be detected automatically by libinput, -local configuration is required to set this property. Refer to the libinput -model quirks hwdb for instructions. - -This property must not be used for any other purpose, no specific behavior -is guaranteed. - - -@section hwdb Configuring the hwdb - -This section outlines how to add an entry to the udev -hwdb and reload properties so they are available to libinput. - -The hwdb contains a set of match rules that assign udev properties that are -available to libinput when the device is connected and/or libinput is -initialized. This section only describes the hwdb in relation to libinput, -it is not a full documentation on how the hwdb works. - -@note **The use of the hwdb by libinput is not part of the public API. It may -change at any time. Once tested, changes to the hwdb must be submitted -upstream.** - -@subsection hwdb_querying Querying the hwdb - -libinput only uses device nodes in the form of `/dev/input/eventX` where X -is the number of the specific device. Running `libinput debug-events` lists -all devices currently available to libinput and their event node name: - - $> sudo libinput debug-events - -event2 DEVICE_ADDED Power Button seat0 default group1 cap:k - -event5 DEVICE_ADDED Video Bus seat0 default group2 cap:k - -event0 DEVICE_ADDED Lid Switch seat0 default group3 cap:S - - ... - -Note the event node name for your device and translate it into a syspath in -the form of `/sys/class/input/eventX`. This path can be supplied to `udevadm -info` - - $> udevadm info - P: /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input0/event0 - N: input/event0 - E: DEVNAME=/dev/input/event0 - E: DEVPATH=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input0/event0 - E: ID_INPUT=1 - E: ID_INPUT_SWITCH=1 - E: MAJOR=13 - E: MINOR=64 - E: SUBSYSTEM=input - E: TAGS=:power-switch: - E: USEC_INITIALIZED=7167898 - -Lines starting with `E:` are udev properties available to libinput. For -example, the above device's `ID_INPUT_SWITCH` property will cause libinput -to treat this device as switch device. - - -@subsection hwdb_reloading Reloading the hwdb - -The actual hwdb is stored in binary file on-disk and must be updated -manually whenever a `.hwdb` file changes. This is required both when a user -manually edits the `.hwdb` file but also when the git tree is updated (and -that update causes a hwdb change). - -To update the binary file on-disk, run: - - sudo udevadm hwdb --update - -Then, to trigger a reload of all properties on your device, run: - - sudo udevadm trigger /sys/class/input/eventX - -Then check with `udevadm info` whether the properties were updated, see @ref -hwdb_querying. If a new property does not appear on the device, use `udevadm -test` to check for error messages by udev and the hwdb (e.g. syntax errors -in the udev rules files). - - sudo udevadm test /sys/class/input/eventX - -@subsection hwdb_modifying Modifying the hwdb - -This section applies to users that need to add, change, or remove a hwdb -entry for their device. Note that **the hwdb is not part of the public API -and may change at any time**. Once a device has been made to work, the -change must be submitted to the libinput bugzilla, see @ref reporting_bugs. - -hwdb entries are only applied if a udev rules calls out to the hwdb with the -right match format. libinput ships with a set of rules to query the hwdb, -the different rules are reflected by their prefix. Again, **this is not part -of the public API**. libinput's matches are -composed of a literal "libinput", then either the device name and dmi -modalias, or the device types and the input modalias. Any part of the hwdb -match line can be a glob by using a literal `*`. For example: - - libinput:keyboard:input:b0011v* - libinput:touchpad:input:b0003v05ACp* - libinput:touchpad:input:b0003v05ACp021A* - -This type of matching is the preferred one for any removable device (USB, -Bluetooth, ...) that can be uniquely identified by the bustype, vendor and -product ID. The first line matches any keyboard device on the -serial bus (0x0011). The second line matches any touchpad device -with a vendor ID of 0x05AC. The third line matches any touchpad device -with a vendor ID of 0x05AC and a product ID of 0x021A. The `input:b...` -string is available in the device's modalias file -`/sys/class/input/eventX/device/modalias`. - -In the case of built-in devices that do not have a unique id, we -need to use the host system's dmi information. For example: - - libinput:name:*Lid Switch*:dmi:*svnLENOVO:*pvrThinkPadT440* - -This match applies to any device with a name **containing** "Led Switch" -that is on a Lenovo T440 system. The dmi modalias is available in -`/sys/class/dmi/id/modalias`. For example, on the T440 matched above, the -modalias is - - dmi:bvnLENOVO:bvrGJET72WW(2.22):bd02/21/2014:svnLENOVO:pn3453453678:pvrThinkPadT440s:rvnLENOVO:rn2012345223:rvrABC123KKK123B:cvnLENOVO:ct10:cvrNotAvailable: - -The dmi should always be shortened to the sections that uniquely identify -the type system, in this case the vendor (svn) and the product version (pvr). -Failing to shorten the system may mean that the hwdb match rule only applies -to your specific system, rather than all systems of that type, or that the -rule no longer applies after a firmware update. - -The hwdb match string is the first portion of the hwdb entry. The second -portion is the property to set. Each hwdb entry may match on multiple -devices and may apply multiple properties. For example: - - - libinput:touchpad:input:b0003v05ACp* - THIS_IS_AN_APPLE_DEVICE=1 - - libinput:touchpad:input:b0003v05ACp* - libinput:name:*Lid Switch*:dmi:*svnLENOVO:*pvrThinkPadT440* - FOO=1 - BAR=2 - -In the example above, any matching touchpad device will have all three -properties applied, the lid switch device only has FOO and BAR. - -The hwdb does not allow removing properties. Where a property must be unset, -it should be set to 0. - -Any user-specific hwdb entries should be placed in a file -`/etc/udev/hwdb.d/99-somename.hwdb`. See @ref hwdb_reloading for -instructions on how to reload the hwdb once the file is in place. */ diff -Nru libinput-1.10.3/doc/dot/evemu.gv libinput-0.21.0/doc/dot/evemu.gv --- libinput-1.10.3/doc/dot/evemu.gv 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/dot/evemu.gv 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -digraph stack -{ - compound=true; - rankdir="LR"; - node [ - shape="box"; - ] - - kernel [label="Kernel"]; - - libinput; - xserver [label="X Server"]; - - kernel -> libinput - libinput -> xserver - - kernel -> evemu - evemu -> stdout -} diff -Nru libinput-1.10.3/doc/dot/libinput-stack-gnome.gv libinput-0.21.0/doc/dot/libinput-stack-gnome.gv --- libinput-1.10.3/doc/dot/libinput-stack-gnome.gv 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/dot/libinput-stack-gnome.gv 2015-07-15 04:18:08.000000000 +0000 @@ -23,7 +23,7 @@ gsettings } - gsd [label="mutter"]; + gsd [label="gnome-settings-daemon"]; gsd -> gsettings gsd -> xserver diff -Nru libinput-1.10.3/doc/faqs.dox libinput-0.21.0/doc/faqs.dox --- libinput-1.10.3/doc/faqs.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/faqs.dox 2015-07-28 22:12:38.000000000 +0000 @@ -3,35 +3,12 @@ Frequently asked questions about libinput. -@tableofcontents - -@section faq_feature Why doesn't libinput support ...? - -First, read @ref what_is_libinput If you have a feature that you think -libinput needs to support, please file a bug report. See @ref reporting_bugs -for more details. - @section faq_fast_mouse My mouse moves too fast, even at the slowest setting This is a symptom of high-dpi mice (greater than 1000dpi). These devices need a udev hwdb entry to normalize their motion. See @ref motion_normalization for a detailed explanation. -@section faq_fast_trackpoint My trackpoint moves too slow or too fast - -This is a symptom of an invalid trackpoint range. These devices need a udev -hwdb entry to specify the range available so libinput can adjust the pointer -acceleration accordingly. See @ref trackpoint_range for a detailed explanation. - -@section faq_enable_tapping Why isn't touchpad tap-to-click enabled by default - -See @ref tapping_default - -@section faq_touchpad_pressure Why does my touchpad lose track of touches - -The most common cause for this is an incorrect pressure threshold range. -See @ref touchpad_pressure for more info. - @section faq_kinetic_scrolling Kinetic scrolling does not work The X.Org synaptics driver implemented kinetic scrolling in the driver. It @@ -53,7 +30,7 @@ @section faq_gpl Is libinput GPL-licensed? No, libinput is MIT licensed. The Linux kernel header file linux/input.h in -libinput's tree is provided to ensure the same behavior regardless of which +libinput's tree is provded to ensure the same behavior regardless of which kernel version libinput is built on. It does not make libinput GPL-licensed. @section faq_config_options Where is the configuration stored? @@ -63,20 +40,12 @@ This must be done at startup, after a resume and whenever a new device is detected. -One commonly used way to configure libinput is to have the Wayland -compositor expose a compositor-specific configuration option. For example, -in a GNOME stack, the gnome-control-center modifies dconf entries. These -changes are read by mutter and applied to libinput. Changing these entries -via the gsettings commandline tool has the same effect. - -Another commonly used way to configure libinput is to have xorg.conf.d -snippets. When libinput is used with the xf86-input-libinput driver in an -X.Org stack, these options are read on startup and apply to each device. -Changing properties at runtime with the xinput commandline tool has the same -effect. - -In both cases, the selection of available options and how they are exposed -depends on the libinput caller (e.g. mutter or xf86-input-libinput). +In a GNOME X.Org stack a user would usually toggle an option in +the gnome-control-center which adjusts a gsettings entry. That change is +picked up by gnome-settings-daemon and applied to the device by adjusting +input device properties that the xf86-input-libinput driver provides. +The input device property changes map to the respective libinput +configuration options. @dotfile libinput-stack-gnome.gv @@ -85,139 +54,4 @@ client. Also some configuration options that are provided by the intermediary may not be libinput-specific configuration options. -@section faq_configure_wayland How do I configure my device on Wayland? - -See @ref faq_config_options Use the configuration tool provided by your -desktop environment (e.g. gnome-control-center) or direct access to your -desktop environment's configuration storage (e.g. gsettings). - -@section faq_configure_xorg How do I configure my device on X? - -See @ref faq_config_options If your desktop environment does not provide a -graphical configuration tool you can use an -xorg.conf.d snippet. -Usually, such a snippet looks like this: -
-$> cat /etc/X11/xorg.conf.d/99-libinput-custom-config.conf
-Section "InputClass"
-  Identifier "something to identify this snippet"
-  MatchDriver "libinput"
-  MatchProduct "substring of the device name"
-  Option "some option name" "the option value"
-EndSection
-
- -The identifier is merely a human-readable string that shows up in the log -file. The MatchProduct line should contain the device name or a substring of -the device name that the snippet should apply to. For a full list of option -names and permitted values, see the -libinput man page. -xorg.conf.d snippets like the above apply to hotplugged devices but can be -overwritten at runtime by desktop tools. Multiple snippets may be placed -into the same file. - -For run-time configuration and testing, the -xinput -debugging tool can modify a devices' properties. See the -libinput man page -for supported property names and values. Usually, an invocation looks like -this: -
-$> xinput set-prop "the device name" "the property name" value [value2] [value3]
-
- -@note -Changes performed by xinput do not persist across device hotplugs. xinput is -considered a debugging and testing tool only and should not be used for -permanent configurations. - -@section faq_configuration Can you add a configuration option for $FEATURE? - -No. At least that's going to be the initial answer. Read Why -libinput doesn't have a lot of configuration options first. -Configuration options for most features are a signal that we are incapable -of handling it correctly. To get to that point, we want to be sure we're -truly incapable of doing so. libinput has several features that -are handled automatically (and correctly) that users wanted to have -configuration options for initially. - -So the answer to this question will almost always be 'no'. A configuration -option is, in most cases, a cop-out. - -@section faq_synclient Why don't synclient and syndaemon work with libinput? - -Synclient and syndaemon rely on X input device properties that are specific -to the xf86-input-synaptics X.Org input driver. Both were written when the -synaptics driver was the only commmon touchpad driver in existence. They -assume that if the properties aren't available, no touchpad is available -either. The xf86-input-libinput X.Org input driver does not export these -driver-specific properties, synclient/syndaemon will thus not detect the -touchpad and refuse to work. Other tools that rely on synclient/syndaemon or -those same properties also do not work with xf86-input-libinput. - -Most of syndaemon's functionality is built into libinput, see @ref -disable-while-typing. synclient is merely a configuration tool, see -@ref faq_configure_xorg for similar functionality. - -See also the blog posts -The -definitive guide to synclient and - -The future of xinput, xmodmap, setxkbmap, xsetwacom and other tools under -Wayland - -@section faq_tablets Does libinput support non-Wacom tablets? - -Yes, though unfortunately many non-Wacom tablets suffer from bad firmware -and don't send the required events. But they should all work nonetheless. If -you have a tablet that does not work with libinput, please @ref -reporting_bugs "file a bug". - -@section faq_tablet_capabilities My tablet doesn't work - -If you see the message -
-libinput bug: device does not meet tablet criteria. Ignoring this device.
-
- -or the message -
-missing tablet capabilities [...] Ignoring this device.
-
- -your tablet device does not have the required capabilities to be treated as -a tablet. This is usually a problem with the device and the kernel driver. -See @ref tablet-capabilities for more details. - -@section faq_hwdb_changes How to apply hwdb changes - -Sometimes users are asked to test updates to the udev -hwdb or patches that include a change to the hwdb. See @ref hwdb for -details on the hwdb and how to modify it locally. - -@section faq_timer_offset What causes the "timer offset negative" warning? - -libinput relies on the caller to call libinput_dispatch() whenever data is -available on the epoll-fd. Doing so will process the state of all devices -and can trigger some timers to be set (e.g. palm detection, tap-to-click, -disable-while-typing, etc.). Internally, libinput's time offsets are always -based on the event time of the triggering event. - -For example, a touch event with time T may trigger a timer for the time T + -180ms. When setting a timer, libinput checks the wall clock time to ensure -that this time T + offset is still in the future. If not, the warning is -logged. - -When this warning appears, it simply means that too much time has passed -between the event occurring (and the epoll-fd triggering) and the current -time. In almost all cases this is an indication of the caller being -overloaded and not handling events as speedily as required. - -The warning has no immediate effect on libinput's behavior but some of the -functionality that relies on the timer may be impeded (e.g. palms are not -detected as they should be). - */ diff -Nru libinput-1.10.3/doc/gestures.dox libinput-0.21.0/doc/gestures.dox --- libinput-1.10.3/doc/gestures.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/gestures.dox 2015-07-28 22:12:38.000000000 +0000 @@ -82,48 +82,10 @@ @image html touchscreen-gestures.svg "Context-sensitivity of touchscreen gestures" In this example, the finger movements are identical but in the left case -both fingers are located within the same window, thus suggesting an attempt +both fingers are located within the same window, thus suggesting an attemp to zoom. In the right case both fingers are located on a window border, thus suggesting a window movement. libinput only has knowledge of the finger coordinates (and even then only in device coordinates, not in screen coordinates) and thus cannot differentiate the two. -@section gestures_softbuttons Gestures with enabled software buttons - -If the touchpad device is a @ref touchpads_buttons_clickpads "Clickpad", it -is recommended that a caller switches to @ref clickfinger. -Usually fingers placed in a @ref software_buttons "software button area" is not -considered for gestures, resulting in some gestures to be interpreted as -pointer motion or two-finger scroll events. - -@image html pinch-gestures-softbuttons.svg "Interference of software buttons and pinch gestures" - -In the example above, the software button area is highlighted in red. The -user executes a three-finger pinch gesture, with the thumb remaining in the -software button area. libinput ignores fingers within the software button -areas, the movement of the remaining fingers is thus interpreted as a -two-finger scroll motion. - -@section gestures_twofinger_touchpads Gestures on two-finger touchpads - -As of kernel 4.2, many @ref touchpads_touch_partial_mt provide only two -slots. This affects how gestures can be interpreted. Touchpads with only two -slots can identify two touches by position but can usually tell that there -is a third (or fourth) finger down on the touchpad - without providing -positional information for that finger. - -Touchpoints are assigned in sequential order and only the first two touch -points are trackable. For libinput this produces an ambiguity where it is -impossible to detect whether a gesture is a pinch gesture or a swipe gesture -whenever a user puts the index and middle finger down first. Since the third -finger does not have positional information, it's location cannot be -determined. - -@image html gesture-2fg-ambiguity.svg "Ambiguity of three-finger gestures on two-finger touchpads" - -The image above illustrates this ambiguity. The index and middle finger are -set down first, the data stream from both finger positions looks identical. -In this case, libinput assumes the fingers are in a horizontal arrangement -(the right image above) and use a swipe gesture. - */ diff -Nru libinput-1.10.3/doc/libinput.doxygen.in libinput-0.21.0/doc/libinput.doxygen.in --- libinput-1.10.3/doc/libinput.doxygen.in 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/libinput.doxygen.in 2015-07-28 22:12:38.000000000 +0000 @@ -8,23 +8,22 @@ EXTRACT_STATIC = YES MAX_INITIALIZER_LINES = 0 QUIET = YES -INPUT = @INPUT@ -IMAGE_PATH = "@top_srcdir@/doc/svg" \ - "@top_srcdir@/doc/dot" +INPUT = @top_srcdir@/src/libinput.h \ + @top_srcdir@/README.txt +IMAGE_PATH = @top_srcdir@/doc/svg \ + @top_srcdir@/doc/dot GENERATE_HTML = YES -SEARCHENGINE = NO +HTML_TIMESTAMP = YES USE_MATHJAX = YES -MATHJAX_RELPATH = https://cdn.mathjax.org/mathjax/latest GENERATE_LATEX = NO MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES -PREDEFINED = LIBINPUT_ATTRIBUTE_PRINTF(f, a)= \ +PREDEFINED = LIBINPUT_ATTRIBUTE_PRINTF(f, \ + a)= \ LIBINPUT_ATTRIBUTE_DEPRECATED -DOTFILE_DIRS = "@top_srcdir@/doc/dot" +DOTFILE_DIRS = @top_srcdir@/doc/dot -HTML_HEADER = "@top_srcdir@/doc/style/header.html" -HTML_FOOTER = "@top_srcdir@/doc/style/footer.html" -HTML_EXTRA_STYLESHEET = "@top_srcdir@/doc/style/bootstrap.css" \ - "@top_srcdir@/doc/style/customdoxygen.css" \ - "@top_srcdir@/doc/style/libinputdoxygen.css" -USE_MDFILE_AS_MAINPAGE = "@top_srcdir@/README.md" +HTML_HEADER = @top_srcdir@/doc/style/header.html +HTML_FOOTER = @top_srcdir@/doc/style/footer.html +HTML_EXTRA_STYLESHEET = @top_srcdir@/doc/style/customdoxygen.css \ + @top_srcdir@/doc/style/bootstrap.css diff -Nru libinput-1.10.3/doc/Makefile.am libinput-0.21.0/doc/Makefile.am --- libinput-1.10.3/doc/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/doc/Makefile.am 2015-08-03 21:42:14.000000000 +0000 @@ -0,0 +1,78 @@ +EXTRA_DIST = \ + middle-button-emulation.svg \ + touchpad-tap-state-machine.svg \ + touchpad-softbutton-state-machine.svg + +if BUILD_DOCS + +noinst_DATA = html/index.html + +header_files = \ + $(top_srcdir)/src/libinput.h \ + $(top_srcdir)/README.txt \ + $(srcdir)/absolute-axes.dox \ + $(srcdir)/clickpad-softbuttons.dox \ + $(srcdir)/device-configuration-via-udev.dox \ + $(srcdir)/faqs.dox \ + $(srcdir)/gestures.dox \ + $(srcdir)/normalization-of-relative-motion.dox \ + $(srcdir)/palm-detection.dox \ + $(srcdir)/page-hierarchy.dox \ + $(srcdir)/reporting-bugs.dox \ + $(srcdir)/scrolling.dox \ + $(srcdir)/seats.dox \ + $(srcdir)/t440-support.dox \ + $(srcdir)/tapping.dox \ + $(srcdir)/test-suite.dox \ + $(srcdir)/tools.dox \ + $(srcdir)/touchpads.dox + +diagram_files = \ + $(srcdir)/dot/seats-sketch.gv \ + $(srcdir)/dot/seats-sketch-libinput.gv \ + $(srcdir)/dot/libinput-stack-wayland.gv \ + $(srcdir)/dot/libinput-stack-xorg.gv \ + $(srcdir)/dot/libinput-stack-gnome.gv \ + $(srcdir)/svg/software-buttons.svg \ + $(srcdir)/svg/clickfinger.svg \ + $(srcdir)/svg/button-scrolling.svg \ + $(srcdir)/svg/edge-scrolling.svg \ + $(srcdir)/svg/palm-detection.svg \ + $(srcdir)/svg/pinch-gestures.svg \ + $(srcdir)/svg/swipe-gestures.svg \ + $(srcdir)/svg/tap-n-drag.svg \ + $(srcdir)/svg/thumb-detection.svg \ + $(srcdir)/svg/top-software-buttons.svg \ + $(srcdir)/svg/touchscreen-gestures.svg \ + $(srcdir)/svg/twofinger-scrolling.svg + +style_files = \ + style/header.html \ + style/footer.html \ + style/customdoxygen.css \ + style/bootstrap.css + +html/index.html: libinput.doxygen $(header_files) $(diagram_files) $(style_files) + $(AM_V_GEN)(cat $<; \ + echo "INPUT = $(header_files)"; \ + ) | $(DOXYGEN) - + +clean-local: + $(AM_V_at)rm -rf html + +doc_src= $(shell find html -type f -printf "html/%P\n" 2>/dev/null) +EXTRA_DIST += $(builddir)/html/index.html \ + $(doc_src) \ + $(diagram_files) \ + $(header_files) \ + $(style_files) +endif + +# make sure doc was built before running dist +dist-hook: + @test -f $(distdir)/html/index.html || (\ + echo "******************************************************" && \ + echo "Couldn't find documentation files, refusing make dist." && \ + echo "Install doxygen to build documentation for tarball." && \ + echo "******************************************************" && \ + test ) diff -Nru libinput-1.10.3/doc/Makefile.in libinput-0.21.0/doc/Makefile.in --- libinput-1.10.3/doc/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/doc/Makefile.in 2015-08-04 00:58:30.000000000 +0000 @@ -0,0 +1,550 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 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__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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@ +@BUILD_DOCS_TRUE@am__append_1 = $(builddir)/html/index.html \ +@BUILD_DOCS_TRUE@ $(doc_src) \ +@BUILD_DOCS_TRUE@ $(diagram_files) \ +@BUILD_DOCS_TRUE@ $(header_files) \ +@BUILD_DOCS_TRUE@ $(style_files) + +subdir = doc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(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)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = libinput.doxygen +CONFIG_CLEAN_VPATH_FILES = +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 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(noinst_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libinput.doxygen.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADDR2LINE = @ADDR2LINE@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GCC_CFLAGS = @GCC_CFLAGS@ +GCC_CXXFLAGS = @GCC_CXXFLAGS@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBEVDEV_CFLAGS = @LIBEVDEV_CFLAGS@ +LIBEVDEV_LIBS = @LIBEVDEV_LIBS@ +LIBINPUT_LT_VERSION = @LIBINPUT_LT_VERSION@ +LIBINPUT_VERSION = @LIBINPUT_VERSION@ +LIBINPUT_VERSION_MAJOR = @LIBINPUT_VERSION_MAJOR@ +LIBINPUT_VERSION_MICRO = @LIBINPUT_VERSION_MICRO@ +LIBINPUT_VERSION_MINOR = @LIBINPUT_VERSION_MINOR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@ +LIBUDEV_LIBS = @LIBUDEV_LIBS@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MTDEV_CFLAGS = @MTDEV_CFLAGS@ +MTDEV_LIBS = @MTDEV_LIBS@ +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@ +STRIP = @STRIP@ +UDEV_DIR = @UDEV_DIR@ +UDEV_TEST_PATH = @UDEV_TEST_PATH@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +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_CXX = @ac_ct_CXX@ +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@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = middle-button-emulation.svg \ + touchpad-tap-state-machine.svg \ + touchpad-softbutton-state-machine.svg $(am__append_1) +@BUILD_DOCS_TRUE@noinst_DATA = html/index.html +@BUILD_DOCS_TRUE@header_files = \ +@BUILD_DOCS_TRUE@ $(top_srcdir)/src/libinput.h \ +@BUILD_DOCS_TRUE@ $(top_srcdir)/README.txt \ +@BUILD_DOCS_TRUE@ $(srcdir)/absolute-axes.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/clickpad-softbuttons.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/device-configuration-via-udev.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/faqs.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/gestures.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/normalization-of-relative-motion.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/palm-detection.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/page-hierarchy.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/reporting-bugs.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/scrolling.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/seats.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/t440-support.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/tapping.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/test-suite.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/tools.dox \ +@BUILD_DOCS_TRUE@ $(srcdir)/touchpads.dox + +@BUILD_DOCS_TRUE@diagram_files = \ +@BUILD_DOCS_TRUE@ $(srcdir)/dot/seats-sketch.gv \ +@BUILD_DOCS_TRUE@ $(srcdir)/dot/seats-sketch-libinput.gv \ +@BUILD_DOCS_TRUE@ $(srcdir)/dot/libinput-stack-wayland.gv \ +@BUILD_DOCS_TRUE@ $(srcdir)/dot/libinput-stack-xorg.gv \ +@BUILD_DOCS_TRUE@ $(srcdir)/dot/libinput-stack-gnome.gv \ +@BUILD_DOCS_TRUE@ $(srcdir)/svg/software-buttons.svg \ +@BUILD_DOCS_TRUE@ $(srcdir)/svg/clickfinger.svg \ +@BUILD_DOCS_TRUE@ $(srcdir)/svg/button-scrolling.svg \ +@BUILD_DOCS_TRUE@ $(srcdir)/svg/edge-scrolling.svg \ +@BUILD_DOCS_TRUE@ $(srcdir)/svg/palm-detection.svg \ +@BUILD_DOCS_TRUE@ $(srcdir)/svg/pinch-gestures.svg \ +@BUILD_DOCS_TRUE@ $(srcdir)/svg/swipe-gestures.svg \ +@BUILD_DOCS_TRUE@ $(srcdir)/svg/tap-n-drag.svg \ +@BUILD_DOCS_TRUE@ $(srcdir)/svg/thumb-detection.svg \ +@BUILD_DOCS_TRUE@ $(srcdir)/svg/top-software-buttons.svg \ +@BUILD_DOCS_TRUE@ $(srcdir)/svg/touchscreen-gestures.svg \ +@BUILD_DOCS_TRUE@ $(srcdir)/svg/twofinger-scrolling.svg + +@BUILD_DOCS_TRUE@style_files = \ +@BUILD_DOCS_TRUE@ style/header.html \ +@BUILD_DOCS_TRUE@ style/footer.html \ +@BUILD_DOCS_TRUE@ style/customdoxygen.css \ +@BUILD_DOCS_TRUE@ style/bootstrap.css + +@BUILD_DOCS_TRUE@doc_src = $(shell find html -type f -printf "html/%P\n" 2>/dev/null) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(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 doc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign doc/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: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +libinput.doxygen: $(top_builddir)/config.status $(srcdir)/libinput.doxygen.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +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 + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: +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." +@BUILD_DOCS_FALSE@clean-local: +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +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 -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + clean-local cscopelist-am ctags-am dist-hook distclean \ + distclean-generic distclean-libtool 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-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +@BUILD_DOCS_TRUE@html/index.html: libinput.doxygen $(header_files) $(diagram_files) $(style_files) +@BUILD_DOCS_TRUE@ $(AM_V_GEN)(cat $<; \ +@BUILD_DOCS_TRUE@ echo "INPUT = $(header_files)"; \ +@BUILD_DOCS_TRUE@ ) | $(DOXYGEN) - + +@BUILD_DOCS_TRUE@clean-local: +@BUILD_DOCS_TRUE@ $(AM_V_at)rm -rf html + +# make sure doc was built before running dist +dist-hook: + @test -f $(distdir)/html/index.html || (\ + echo "******************************************************" && \ + echo "Couldn't find documentation files, refusing make dist." && \ + echo "Install doxygen to build documentation for tarball." && \ + echo "******************************************************" && \ + test ) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru libinput-1.10.3/doc/middle-button-emulation.dox libinput-0.21.0/doc/middle-button-emulation.dox --- libinput-1.10.3/doc/middle-button-emulation.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/middle-button-emulation.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/** -@page middle_button_emulation Middle button emulation - -Middle button emulation provides users with the ability to generate a middle -click even when the device does not have a physical middle button available. - -When middle button emulation is enabled, a simultaneous press of the left -and right button generates a middle mouse button event. Releasing the -buttons generates a middle mouse button release, the left and right button -events are discarded otherwise. - -The middle button release event may be generated when either button is -released, or when both buttons have been released. The exact behavior is -device-dependent, libinput will implement the behavior that is most -appropriate to the physical device. - -The middle button emulation behavior when combined with other device -buttons, including a physical middle button is device-dependent. -For example, @ref clickpad_softbuttons provides a middle button area when -middle button emulation is disabled. That middle button area disappears -when middle button emulation is enabled - a middle click can then only be -triggered by a simultaneous left + right click. - -Some devices provide middle mouse button emulation but do not allow -enabling/disabling that emulation. Likewise, some devices may allow middle -button emulation but have it disabled by default. This is the case for most -mouse-like devices where a middle button is detected. - -libinput provides libinput_device_config_middle_emulation_set_enabled() to -enable or disable middle button emulation. See @ref faq_configure_wayland -and @ref faq_configure_xorg for info on how to enable or disable middle -button emulation in the Wayland compositor or the X stack. - -*/ diff -Nru libinput-1.10.3/doc/normalization-of-relative-motion.dox libinput-0.21.0/doc/normalization-of-relative-motion.dox --- libinput-1.10.3/doc/normalization-of-relative-motion.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/normalization-of-relative-motion.dox 2015-07-28 22:12:38.000000000 +0000 @@ -25,24 +25,20 @@ device will roughly feel the same as a higher-dpi mouse. This normalization only applies to accelerated coordinates, unaccelerated -coordinates are left in device-units. It is up to the caller to interpret +coordiantes are left in device-units. It is up to the caller to interpret those coordinates correctly. -@section motion_normalization_touchpad Normalization of touchpad coordinates +@section Normalization of touchpad coordinates Touchpads may have a different resolution for the horizontal and vertical -axis. Interpreting coordinates from the touchpad without taking resolution +axis. Interpreting coordinates from the touchpad without taking resolutino into account results in uneven motion. -libinput scales unaccelerated touchpad motion to the resolution of the +libinput scales unaccelerated touchpad motion do the resolution of the touchpad's x axis, i.e. the unaccelerated value for the y axis is: y = (x / resolution_x) * resolution_y -@section motion_normalization_tablet Normalization of tablet coordinates - -See @ref tablet-relative-motion - -@section motion_normalization_customization Setting custom DPI settings +@section Setting custom DPI settings Devices usually do not advertise their resolution and libinput relies on the udev property MOUSE_DPI for this information. This property is usually diff -Nru libinput-1.10.3/doc/page-hierarchy.dox libinput-0.21.0/doc/page-hierarchy.dox --- libinput-1.10.3/doc/page-hierarchy.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/page-hierarchy.dox 2015-08-03 03:44:47.000000000 +0000 @@ -5,11 +5,8 @@ - @subpage clickpad_softbuttons - @subpage tapping - @subpage gestures -- @subpage touchpad_pressure - @subpage palm_detection - @subpage t440_support -- @subpage touchpad_jumping_cursor -- @subpage absolute_coordinate_ranges @page touchscreens Touchscreens @@ -18,37 +15,21 @@ @page pointers Mice, Trackballs, etc. - @subpage motion_normalization -- @subpage middle_button_emulation -- @subpage button_debouncing -- @subpage trackpoints -@page tablets Graphics Tablets - -- @subpage tablet-support - -@page general General +@page general General setup - @subpage udev_config - @subpage seats -- @subpage timestamps @page misc Users -- @subpage what_is_libinput - @subpage faq - @subpage tools - @subpage reporting_bugs @page developers Developers -Contributions to libinput are always welcome. See the links below for -specific documentation. - -- @subpage what_is_libinput -- @subpage contributing -- @subpage building_libinput - @subpage test-suite - @subpage tools -- @subpage pointer-acceleration */ diff -Nru libinput-1.10.3/doc/palm-detection.dox libinput-0.21.0/doc/palm-detection.dox --- libinput-1.10.3/doc/palm-detection.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/palm-detection.dox 2015-07-31 01:50:42.000000000 +0000 @@ -13,34 +13,18 @@ T440 series has one of the largest touchpads, other touchpads are less affected by palm touches. -@section palm_pressure Palm detection based on pressure - -The simplest form of palm detection labels a touch as palm when the pressure -value goes above a certain threshold. This threshold is usually high enough -that it cannot be triggered by a finger movement. One a touch is labelled as -palm based on pressure, it will remain so even if the pressure drops below -the threshold again. This ensures that a palm remains a palm even when the -pressure changes as the user is typing. - -For some information on how to detect pressure on a touch and debug the -pressure ranges, see @ref touchpad_pressure. - @section palm_exclusion_zones Palm exclusion zones -libinput enables palm detection on the left, right and top edges of the -touchpad. Two exclusion zones are defined on the left and right edge of the -touchpad. If a touch starts in the exclusion zone, it is considered a palm -and the touch point is ignored. However, for fast cursor movements across -the screen, it is common for a finger to start inside an exclusion zone and -move rapidly across the touchpad. libinput detects such movements and avoids -palm detection on such touch sequences. - -Another exclusion zone is defined on the top edge of the touchpad. As with -the edge zones, libinput detects vertical movements out of the edge zone and -avoids palm detection on such touch sequences. +libinput enables palm detection on the edge of the touchpad. Two exclusion +zones are defined on the left and right edge of the touchpad. +If a touch starts in the exclusion zone, it is considered a palm and the +touch point is ignored. However, for fast cursor movements across the +screen, it is common for a finger to start inside an exclusion zone and move +rapidly across the touchpad. libinput detects such movements and avoids palm +detection on such touch sequences. -Each side edge exclusion zone is divided into a top part and a bottom part. -A touch starting in the top part of the exclusion zone does not trigger a +Each exclusion zone is divided into a top part and a bottom part. A touch +starting in the top part of the exclusion zone does not trigger a tap (see @ref tapping). In the diagram below, the exclusion zones are painted red. @@ -62,10 +46,10 @@ If a device provides a trackpoint, it is -usually located above the touchpad. This increases the likelihood of +usually located above the touchpad. This increases the likelyhood of accidental touches whenever the trackpoint is used. -libinput disables the touchpad whenever it detects trackpoint activity for a +libinput disables the touchpad whenver it detects trackpoint activity for a certain timeout until after trackpoint activity stops. Touches generated during this timeout will not move the pointer, and touches started during this timeout will likewise not move the pointer (allowing for a user to rest @@ -94,10 +78,7 @@ has stopped, it is thus possible to rest the palm on the touchpad while typing. - Physical buttons work even while the touchpad is disabled. This includes - @ref t440_support "software-emulated buttons". - -Disable-while-typing can be enabled and disabled by calling -libinput_device_config_dwt_set_enabled(). + software-emulated buttons. @section thumb-detection Thumb detection diff -Nru libinput-1.10.3/doc/pointer-acceleration.dox libinput-0.21.0/doc/pointer-acceleration.dox --- libinput-1.10.3/doc/pointer-acceleration.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/pointer-acceleration.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,160 +0,0 @@ -/** -@page pointer-acceleration Pointer acceleration - -libinput uses device-specific pointer acceleration methods, with the default -being the @ref ptraccel-linear. The methods share common properties, such as -@ref ptraccel-velocity. - -This page explains the high-level concepts used in the code. It aims to -provide an overview for developers and is not necessarily useful for -users. - -@section ptraccel-profiles Pointer acceleration profiles - -The profile decides the general method of pointer acceleration. -libinput currently supports two profiles: "adaptive" and "flat". The aptive -profile is the default profile for all devices and takes the current speed -of the device into account when deciding on acceleration. The flat profile -is simply a constant factor applied to all device deltas, regardless of the -speed of motion (see @ref ptraccel-profile-flat). Most of this document -describes the adaptive pointer acceleration. - -@section ptraccel-velocity Velocity calculation - -The device's speed of movement is measured across multiple input events -through so-called "trackers". Each event prepends a the tracker item, each -subsequent tracker contains the delta of that item to the current position, -the timestamp of the event that created it and the cardinal direction of the -movement at the time. If a device moves into the same direction, the -velocity is calculated across multiple trackers. For example, if a device -moves steadily for 10 events to the left, the velocity is calculated across -all 10 events. - -Whenever the movement changes direction or significantly changes speed, the -velocity is calculated from the direction/speed change only. For example, if -a device moves steadily for 8 events to the left and then 2 events to the -right, the velocity is only that of the last 2 events. - -An extra time limit prevents events that are too old to factor into the -velocity calculation. For example, if a device moves steadily for 5 events -to the left, then pauses, then moves again for 5 events to the left, only -the last 5 events are used for velocity calculation. - -The velocity is then used to calculate the acceleration factor - -@section ptraccel-factor Acceleration factor - -The acceleration factor is the final outcome of the pointer acceleration -calculations. It is a unitless factor that is applied to the current delta, -a factor of 2 doubles the delta (i.e. speeds up the movement), a factor of -less than 1 reduces the delta (i.e. slows the movement). - -Any factor less than 1 requires the user to move the device further to move -the visible pointer. This is called deceleration and enables high precision -target selection through subpixel movements. libinput's current maximum -deceleration factor is 0.3 (i.e. slow down to 30% of the pointer speed). - -A factor higher than 1 moves the pointer further than the physical device -moves. This is acceleration and allows a user to cross the screen quickly -but effectively skips pixels. libinput's current maximum acceleration factor -is 3.5. - -@section ptraccel-linear Linear pointer acceleration - -The linear pointer acceleration method is the default for most pointer -devices. It provides deceleration at very slow movements, a 1:1 mapping for -regular movements and a linear increase to the maximum acceleration factor -for fast movements. - -Linear pointer acceleration applies to devices with above 1000dpi resolution -and after @ref motion_normalization is applied. - -@image html ptraccel-linear.svg "Linear pointer acceleration" - -The image above shows the linear pointer acceleration settings at various -speeds. The line for 0.0 is the default acceleration curve, speed settings -above 0.0 accelerate sooner, faster and to a higher maximum acceleration. -Speed settings below 0 delay when acceleration kicks in, how soon the -maximum acceleration is reached and the maximum acceleration factor. - -Extremely low speed settings provide no acceleration and additionally -decelerate all movement by a constant factor. - -@section ptraccel-low-dpi Pointer acceleration for low-dpi devices - -Low-dpi devices are those with a physical resolution of less than 1000 dots -per inch (dpi). The pointer acceleration is adjusted to provide roughly the -same feel for all devices at normal to high speeds. At slow speeds, the -pointer acceleration works on device-units rather than normalized -coordinates (see @ref motion_normalization). - -@image html ptraccel-low-dpi.svg "Pointer acceleration for low-dpi devices" - -The image above shows the default pointer acceleration curve for a speed of -0.0 at different DPI settings. A device with low DPI has the acceleration -applied sooner and with a stronger acceleration factor. - -@section ptraccel-touchpad Pointer acceleration on touchpads - -Touchpad pointer acceleration uses the same approach as the @ref -ptraccel-linear profile, with a constant deceleration factor applied. The -user expectation of how much a pointer should move in response to finger -movement is different to that of a mouse device, hence the constant -deceleration factor. - -@image html ptraccel-touchpad.svg "Pointer acceleration curve for touchpads" - -The image above shows the touchpad acceleration profile in comparison to the -@ref ptraccel-linear. The shape of the curve is identical but vertically squashed. - -@section ptraccel-trackpoint Pointer acceleration on trackpoints - -The main difference between trackpoint hardware and mice or touchpads is -that trackpoint speed is a function of pressure rather than moving speed. -But trackpoint hardware is quite varied in how it reacts to user pressure -and unlike other devices it cannot easily be normalized for physical -properties. Measuring pressure objectively across a variety of hardware is -nontrivial. - -libinput's pointer acceleration is a function of the total available -pressure range on a device. See @ref trackpoint_range for details. - -libinput relies on some system-wide configured properties, specifically the -@ref udev_config. The property that influences trackpoint acceleration is -`LIBINPUT_ATTR_TRACKPOINT_RANGE` which specifies the total delta range for -the trackpoint. See @ref trackpoint_range for details. - -Additionally, some trackpoints provide the ability to adjust the sensitivity in -hardware by modifying a sysfs file on the serio node. The udev property -`POINTINGSTICK_SENSITIVITY` indicates the desired value, a udev -builtin is expected to apply this to the device, i.e. libinput does not -handle this property. Once applied, the sensitivity adjusts the deltas -coming out of the hardware. When the sensitivity changes, the trackpoint -range changes and thus the `LIBINPUT_ATTR_TRACKPOINT_RANGE` property -becomes invalid. - -As of version 1.9, libinput does not parse the `POINTINGSTICK_CONST_ACCEL` property anymore. - -@image html ptraccel-trackpoint.svg "Pointer acceleration curves for trackpoints" - -The image above shows the trackpoint acceleration profile in comparison to the -@ref ptraccel-linear. - -The constant acceleration factor, usually applied in -@ref udev_config, shapes the acceleration profile and is pre-applied before -any user-specific acceleration adjustments. - -@section ptraccel-profile-flat The flat pointer acceleration profile - -In a flat profile, the acceleration factor is constant regardless of the -velocity of the pointer and each delta (dx, dy) results in an accelerated delta -(dx * factor, dy * factor). This provides 1:1 movement between the device -and the pointer on-screen. - -@section ptraccel-tablet Pointer acceleration on tablets - -Pointer acceleration for relative motion on tablet devices is a flat -acceleration, with the speed seeting slowing down or speeding up the pointer -motion by a constant factor. Tablets do not allow for switchable profiles. - -*/ diff -Nru libinput-1.10.3/doc/reporting-bugs.dox libinput-0.21.0/doc/reporting-bugs.dox --- libinput-1.10.3/doc/reporting-bugs.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/reporting-bugs.dox 2015-08-03 03:44:47.000000000 +0000 @@ -8,7 +8,7 @@ and provide the required data. This will speed up triage, resulting in a quicker bugfix. -First, try to identify the bug by reproducing it reliably. The more +First, try to identify the bugi by reproducing it reliably. The more specific a bug description is, the easier it is to fix. The @ref libinput-debug-events helper tool can help identify whether the bug is in libinput at all. This tool is a direct hook to libinput without a desktop @@ -16,111 +16,22 @@ or in one of the higher layers. See the @ref libinput-debug-events section for information on this tool. -@section triage Triaging bugs - -Some specific information is required, providing it enables the developers -to get a clear picture of what the issue with your device is. - -Always include the libinput version. Either the package version from your -distribution or, when running from git: git log -n 1 HEAD or -git describe HEAD. As a last resort: libinput-list-devices ---version. - -Include the current libinput settings for the device (if you are on X11). -The current settings can be obtained with xinput list-props "your device -name". Use xinput list to obtain the device name. - -Third, pick which device are you reporting a bug for: - -- @ref reporting_bugs_touchpad -- @ref reporting_bugs_mouse -- @ref reporting_bugs_keyboard -- @ref reporting_bugs_trackpoint -- @ref reporting_bugs_other - - -@section reporting_bugs_touchpad Reporting touchpad bugs +@section triage Required information for triage When you file a bug, please attach the following information: - - a virtual description of your input device, see @ref evemu. This is the most important piece of information, do not forget it! -- the output from udevadm info, see @ref udev_info. -- the vendor model number of your laptop (e.g. "Lenovo Thinkpad T440s") -- and the content of /sys/class/dmi/id/modalias. -- the physical dimensions of your touchpad in mm - -If you are reporting a bug related to button event generation: - -- does your touchpad have (separate) physical hardware buttons or is the - whole touchpad clickable? -- Are you using software buttons or clickfinger? See @ref - clickpad_softbuttons. - -@section reporting_bugs_mouse Reporting mouse bugs - -When you file a bug, please attach the following information: - -- a virtual description of your input device, see @ref evemu. This is the - most important piece of information, do not forget it! -- the vendor model number of the device (e.g. "Logitech M325") -- the output from udevadm info, see @ref udev_info. - -If the bug is related to the @ref motion_normalization_customization "speed of the mouse": - -- the resolution of the mouse as specified by the vendor (in DPI) -- the output of the mouse-dpi-tool (provided by libevdev) - -@section reporting_bugs_keyboard Reporting keyboard bugs - -When you file a bug, please attach the following information: - -- a virtual description of your input device, see @ref evemu. This is the - most important piece of information, do not forget it! - -@section reporting_bugs_trackpoint Reporting trackpoint bugs - -When you file a bug, please attach the following information: - -- a virtual description of your input device, see @ref evemu. This is the - most important piece of information, do not forget it! -- the vendor model number of the device (e.g. "Logitech M325") -- the output from udevadm info, see @ref udev_info. - -@section reporting_bugs_other All other devices - -When you file a bug, please attach the following information: - -- a virtual description of your input device, see @ref evemu. This is the - most important piece of information, do not forget it! -- the vendor model number of the device (e.g. "Sony Plastation3 controller") - -@section udev_info udev information for the device - -In many cases, we require the udev properties assigned to the device to -verify whether device-specific quirks were applied. This can be obtained -with ````udevadm info /sys/class/input/eventX```, with the correct event -node for your device. An example output is below: - -@code -$ udevadm info /sys/class/input/event4 -P: /devices/platform/i8042/serio1/input/input5/event4 -N: input/event4 -E: DEVNAME=/dev/input/event4 -E: DEVPATH=/devices/platform/i8042/serio1/input/input5/event4 -E: EVDEV_ABS_00=::41 -E: EVDEV_ABS_01=::37 -E: EVDEV_ABS_35=::41 -E: EVDEV_ABS_36=::37 -E: ID_INPUT=1 -E: ID_INPUT_HEIGHT_MM=66 -E: ID_INPUT_TOUCHPAD=1 -E: ID_INPUT_WIDTH_MM=97 -E: MAJOR=13 -E: MINOR=68 -E: SUBSYSTEM=input -E: USEC_INITIALIZED=5463031 -@endcode +- the libinput version. Either the package version from your distribution + or, when running from git: git log -n 1 HEAD or git describe + HEAD. As a last resort: libinput-list-devices --version. +- the current libinput settings for the device. This is a bit harder to + obtain, for now we'll assume you are running X11. The current settings can + be obtained with xinput list-props "your device name". Use + xinput list to obtain the device name. +- if the device is a touchpad or a pointing stick, the vendor model number + of your laptop, and the content of /sys/class/dmi/id/modalias. +- if the device is a touchpad, the physical dimensions of your touchpad in + mm @section evemu Recording devices with evemu @@ -174,10 +85,4 @@ If the bug is triggered by replaying on your device, attach the recording to the bug report. -@note libinput does not affect the evemu recording. libinput and evemu talk -directly to the kernel's device nodes. An evemu recording is not influenced -by the libinput version or whether a libinput context is currently active. - -@dotfile evemu.gv - */ diff -Nru libinput-1.10.3/doc/seats.dox libinput-0.21.0/doc/seats.dox --- libinput-1.10.3/doc/seats.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/seats.dox 2015-07-09 02:52:56.000000000 +0000 @@ -5,7 +5,7 @@ A seat has two identifiers, the physical name and the logical name. The physical name is summarized as the list of devices a process on the same physical seat has access to. The logical seat name is the seat name for a -logical group of devices. A compositor may use that to create additional +logical group of devices. A compositor may use that to create additonal seats as independent device sets. Alternatively, a compositor may limit itself to a single logical seat, leaving a second compositor to manage devices on the other logical seats. @@ -32,7 +32,7 @@ @section seats_and_features The effect of seat assignment -A logical set is interpreted as a group of devices that usually belong to a +A logical set is interprested as a group of devices that usually belong to a single user that interacts with a computer. Thus, the devices are semantically related. This means for devices within the same logical seat: diff -Nru libinput-1.10.3/doc/style/header.html libinput-0.21.0/doc/style/header.html --- libinput-1.10.3/doc/style/header.html 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/style/header.html 2015-07-28 22:12:38.000000000 +0000 @@ -20,6 +20,8 @@ $mathjax $extrastylesheet + + diff -Nru libinput-1.10.3/doc/style/libinputdoxygen.css libinput-0.21.0/doc/style/libinputdoxygen.css --- libinput-1.10.3/doc/style/libinputdoxygen.css 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/style/libinputdoxygen.css 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -dd { - margin-left: 30px; -} - -.title { - font-size: 400%; - font-weight: 200; -} - -h1 { - font-size: 300%; -} - -h2 { - font-size: 200%; -} - -.sm-dox li { - float:left; - border-top: 0; - padding-right: 20px; -} - -.sm li, .sm a { - position: relative; -} - -.sm, .sm ul, .sm li { - list-style: none; - display: block; - line-height: normal; - direction: ltr; - text-align: left; -} - -.sm, .sm *, .sm *::before, .sm *::after { - box-sizing: border-box; -} - -#main-nav { - padding: 30px; -} - -/* Main menu sub-items like file-list, etc */ -#main-menu li ul { - display: none; -} diff -Nru libinput-1.10.3/doc/style/LICENSE libinput-0.21.0/doc/style/LICENSE --- libinput-1.10.3/doc/style/LICENSE 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/style/LICENSE 1970-01-01 00:00:00.000000000 +0000 @@ -1,229 +0,0 @@ -These licenses apply to the doxygen documentation HTML style only. They do -not apply or affect libinput itself. - -Apache: https://github.com/Velron/doxygen-bootstrapped/ -MIT: https://bootswatch.com/paper/bootstrap.css - - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright {yyyy} {name of copyright owner} - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - - -The MIT License (MIT) - -Copyright (c) 2011-2015 Twitter, Inc - -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 OR COPYRIGHT HOLDERS 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. diff -Nru libinput-1.10.3/doc/svg/button-debouncing-wave-diagram.svg libinput-0.21.0/doc/svg/button-debouncing-wave-diagram.svg --- libinput-1.10.3/doc/svg/button-debouncing-wave-diagram.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/button-debouncing-wave-diagram.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - - - -Button Debouncing Scenarioscurrent modenormal button press and releasephysical buttonapplication current modedebounced button pressphysical buttontimeoutsapplication current modedebounced button releasephysical buttontimeoutsapplication current modedelayed button pressphysical buttontimeoutsapplication current modedelayed button releasephysical buttontimeoutsapplication current modefirst spurious button release physical buttonapplication current modelater spurious button release physical buttontimeoutsapplication current modedelayed release in spurious mode physical buttontimeoutsapplication bounce modespurious mode \ No newline at end of file diff -Nru libinput-1.10.3/doc/svg/clickfinger-distance.svg libinput-0.21.0/doc/svg/clickfinger-distance.svg --- libinput-1.10.3/doc/svg/clickfinger-distance.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/clickfinger-distance.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - diff -Nru libinput-1.10.3/doc/svg/edge-scrolling.svg libinput-0.21.0/doc/svg/edge-scrolling.svg --- libinput-1.10.3/doc/svg/edge-scrolling.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/edge-scrolling.svg 2015-07-09 02:52:56.000000000 +0000 @@ -105,7 +105,7 @@ + style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow1Lstart);marker-end:url(#Arrow1Lstart)" /> diff -Nru libinput-1.10.3/doc/svg/gesture-2fg-ambiguity.svg libinput-0.21.0/doc/svg/gesture-2fg-ambiguity.svg --- libinput-1.10.3/doc/svg/gesture-2fg-ambiguity.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/gesture-2fg-ambiguity.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,496 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Touch 1 - - - Touch 2 - - diff -Nru libinput-1.10.3/doc/svg/palm-detection.svg libinput-0.21.0/doc/svg/palm-detection.svg --- libinput-1.10.3/doc/svg/palm-detection.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/palm-detection.svg 2015-07-15 04:18:08.000000000 +0000 @@ -36,17 +36,16 @@ inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1920" - inkscape:window-height="1016" + inkscape:window-height="1136" id="namedview3477" showgrid="false" inkscape:zoom="3.5662625" - inkscape:cx="180.54059" - inkscape:cy="269.48563" + inkscape:cx="199.35048" + inkscape:cy="156.74673" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" - inkscape:current-layer="svg2" - inkscape:document-rotation="0" /> + inkscape:current-layer="svg2" /> + y="7.0411549" /> + x="321.23563" + y="6.7607527" /> C - - diff -Nru libinput-1.10.3/doc/svg/pinch-gestures-softbuttons.svg libinput-0.21.0/doc/svg/pinch-gestures-softbuttons.svg --- libinput-1.10.3/doc/svg/pinch-gestures-softbuttons.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/pinch-gestures-softbuttons.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,365 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru libinput-1.10.3/doc/svg/ptraccel-linear.svg libinput-0.21.0/doc/svg/ptraccel-linear.svg --- libinput-1.10.3/doc/svg/ptraccel-linear.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/ptraccel-linear.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,5486 +0,0 @@ - - - - -Gnuplot -Produced by GNUPLOT 5.0 patchlevel 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - 0.5 - - - - - 1 - - - - - 1.5 - - - - - 2 - - - - - 2.5 - - - - - 3 - - - - - 0 - - - - - 0.0005 - - - - - 0.001 - - - - - 0.0015 - - - - - 0.002 - - - - - 0.0025 - - - - - 0.003 - - - - - - - - - accel factor - - - - - speed in units/us - - - - - -1.0 - - - -1.0 - - - - - - -0.75 - - - -0.75 - - - - - - -0.5 - - - -0.5 - - - - - - -0.25 - - - -0.25 - - - - - - 0.0 - - - 0.0 - - - - - - 0.5 - - - 0.5 - - - - - - 1.0 - - - 1.0 - - - - - - - - - - - - - - - - - - diff -Nru libinput-1.10.3/doc/svg/ptraccel-low-dpi.svg libinput-0.21.0/doc/svg/ptraccel-low-dpi.svg --- libinput-1.10.3/doc/svg/ptraccel-low-dpi.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/ptraccel-low-dpi.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,3748 +0,0 @@ - - - - -Gnuplot -Produced by GNUPLOT 5.0 patchlevel 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - 1 - - - - - 2 - - - - - 3 - - - - - 4 - - - - - 5 - - - - - 0 - - - - - 0.0005 - - - - - 0.001 - - - - - 0.0015 - - - - - 0.002 - - - - - 0.0025 - - - - - 0.003 - - - - - - - - - accel factor - - - - - speed in units/us - - - - - 200dpi - - - 200dpi - - - - - - 400dpi - - - 400dpi - - - - - - 800dpi - - - 800dpi - - - - - - 1000dpi - - - 1000dpi - - - - - - - - - - - - - - - - - - diff -Nru libinput-1.10.3/doc/svg/ptraccel-touchpad.svg libinput-0.21.0/doc/svg/ptraccel-touchpad.svg --- libinput-1.10.3/doc/svg/ptraccel-touchpad.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/ptraccel-touchpad.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,496 +0,0 @@ - - - - -Gnuplot -Produced by GNUPLOT 5.0 patchlevel 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - 0.2 - - - - - 0.4 - - - - - 0.6 - - - - - 0.8 - - - - - 1 - - - - - 1.2 - - - - - 1.4 - - - - - 1.6 - - - - - 1.8 - - - - - 2 - - - - - 0 - - - - - 50 - - - - - 100 - - - - - 150 - - - - - 200 - - - - - 250 - - - - - 300 - - - - - 350 - - - - - 400 - - - - - - - - - accel factor - - - - - speed in mm/s - - - - - -1 - - - -1 - - - - - - -0.5 - - - -0.5 - - - - - - -0.2 - - - -0.2 - - - - - - 0 - - - 0 - - - - - - 0.2 - - - 0.2 - - - - - - 0.5 - - - 0.5 - - - - - - 1 - - - 1 - - - - - - - - - - - - - - - - - - diff -Nru libinput-1.10.3/doc/svg/ptraccel-trackpoint.svg libinput-0.21.0/doc/svg/ptraccel-trackpoint.svg --- libinput-1.10.3/doc/svg/ptraccel-trackpoint.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/ptraccel-trackpoint.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,3689 +0,0 @@ - - - - -Gnuplot -Produced by GNUPLOT 5.0 patchlevel 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - - - 1 - - - - - 2 - - - - - 3 - - - - - 4 - - - - - 5 - - - - - 0 - - - - - 0.0005 - - - - - 0.001 - - - - - 0.0015 - - - - - 0.002 - - - - - 0.0025 - - - - - 0.003 - - - - - - - - - accel factor - - - - - speed in units/us - - - - - linear (mouse) - - - linear (mouse) - - - - - - const accel 1 - - - const accel 1 - - - - - - const accel 2 - - - const accel 2 - - - - - - const accel 3 - - - const accel 3 - - - - - - - - - - - - - - - - - - diff -Nru libinput-1.10.3/doc/svg/software-buttons.svg libinput-0.21.0/doc/svg/software-buttons.svg --- libinput-1.10.3/doc/svg/software-buttons.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/software-buttons.svg 2015-07-15 04:18:08.000000000 +0000 @@ -41,8 +41,8 @@ id="namedview4312" showgrid="false" inkscape:zoom="0.57798581" - inkscape:cx="842.57758" - inkscape:cy="-74.644166" + inkscape:cx="1134.9723" + inkscape:cy="-71.183873" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" @@ -106,7 +106,7 @@ id="rect2858-7" style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#b3b3b3;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:5.19376326;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker:none;enable-background:accumulate" /> + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - Distance - - - - - - - - - - Pressure - - - - - - - Tilt (angle) - - - - - diff -Nru libinput-1.10.3/doc/svg/tablet-cintiq24hd-modes.svg libinput-0.21.0/doc/svg/tablet-cintiq24hd-modes.svg --- libinput-1.10.3/doc/svg/tablet-cintiq24hd-modes.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/tablet-cintiq24hd-modes.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,460 +0,0 @@ - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mode indicators - mode indicators - mode toggle buttons - - - - - - - - - - - - - - - - - - - - - - - mode toggle buttons - - - diff -Nru libinput-1.10.3/doc/svg/tablet-interfaces.svg libinput-0.21.0/doc/svg/tablet-interfaces.svg --- libinput-1.10.3/doc/svg/tablet-interfaces.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/tablet-interfaces.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,325 +0,0 @@ - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Pad buttons - - Pad buttons - Pad buttons - Pad ring - - - - Pad ring - Tool buttons - - Tool tip - - - diff -Nru libinput-1.10.3/doc/svg/tablet-intuos-modes.svg libinput-0.21.0/doc/svg/tablet-intuos-modes.svg --- libinput-1.10.3/doc/svg/tablet-intuos-modes.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/tablet-intuos-modes.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,321 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mode indicators - mode indicators - - mode toggle button - - diff -Nru libinput-1.10.3/doc/svg/tablet-left-handed.svg libinput-0.21.0/doc/svg/tablet-left-handed.svg --- libinput-1.10.3/doc/svg/tablet-left-handed.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/tablet-left-handed.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,469 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - origin - origin - - - zero - - - - zero - - - diff -Nru libinput-1.10.3/doc/svg/tablet-out-of-bounds.svg libinput-0.21.0/doc/svg/tablet-out-of-bounds.svg --- libinput-1.10.3/doc/svg/tablet-out-of-bounds.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/tablet-out-of-bounds.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,271 +0,0 @@ - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru libinput-1.10.3/doc/svg/tablet.svg libinput-0.21.0/doc/svg/tablet.svg --- libinput-1.10.3/doc/svg/tablet.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/tablet.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru libinput-1.10.3/doc/svg/twofinger-scrolling.svg libinput-0.21.0/doc/svg/twofinger-scrolling.svg --- libinput-1.10.3/doc/svg/twofinger-scrolling.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/svg/twofinger-scrolling.svg 2015-07-09 02:52:56.000000000 +0000 @@ -127,7 +127,7 @@ + style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow1Lstart);marker-end:url(#Arrow1Lstart)" /> diff -Nru libinput-1.10.3/doc/switches.dox libinput-0.21.0/doc/switches.dox --- libinput-1.10.3/doc/switches.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/switches.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -/** -@page switches Switches - -libinput supports a couple of switches. Unlike button events that come in -press and release pairs, switches are usually toggled once and left at the -setting for an extended period of time. - -Only some switches are handled by libinput, see @ref libinput_switch for a -list of supported switches. Switch events are exposed to the caller, but -libinput may handle some switch events internally and enable or disable -specific features based on a switch state. - -The order of switch events is guaranteed to be correct, i.e., a switch will -never send consecutive switch on, or switch off, events. - -@section switches_lid Lid switch handling - -Where available, libinput listens to devices providing a lid switch. -The evdev event code `EV_SW` `SW_LID` is provided as @ref -LIBINPUT_SWITCH_LID. If devices with a lid switch have a touchpad device, -the device is disabled while the lid is logically closed. This is to avoid -ghost touches that can be caused by interference with touchpads and the -closed lid. The touchpad is automatically re-enabled whenever the lid is -openend. - -This handling of lid switches is transparent to the user, no notifications -are sent and the device appears as enabled at all times. - -On some devices, the device's lid state does not always reflect the physical -state and the lid state may report as closed even when the lid is physicall -open. libinput employs some heuristics to detect user input (specificially -typing) to re-enable the touchpad on those devices. - -@section switches_tablet_mode Tablet mode switch handling - -Where available, libinput listens to devices providing a tablet mode switch. -This switch is usually triggered on devices that can switch between a normal -laptop layout and a tablet-like layout. One example for such a device is the -Lenovo Yoga. - -The event sent by the kernel is `EV_SW` `SW_TABLET_MODE` and is provided as -@ref LIBINPUT_SWITCH_TABLET_MODE. When the device switches to tablet mode, -the touchpad and internal keyboard are disabled. If a trackpoint exists, -it is disabled too. The input devices are automatically re-enabled whenever -tablet mode is disengaged. - -This handling of tablet mode switches is transparent to the user, no -notifications are sent and the device appears as enabled at all times. - -*/ diff -Nru libinput-1.10.3/doc/t440-support.dox libinput-0.21.0/doc/t440-support.dox --- libinput-1.10.3/doc/t440-support.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/t440-support.dox 2015-07-15 04:18:08.000000000 +0000 @@ -70,7 +70,7 @@ touchpad -> libinput_tp [color="red4"] events_tp [label="other touchpad events"]; - events_topbutton [label="top software button events"]; + events_topbutton [label="top sofware button events"]; libinput_tp -> events_tp [arrowhead="none"] libinput_ts -> events_topbutton [color="red4"] diff -Nru libinput-1.10.3/doc/tablet-support.dox libinput-0.21.0/doc/tablet-support.dox --- libinput-1.10.3/doc/tablet-support.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/tablet-support.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,374 +0,0 @@ -/** -@page tablet-support Tablet support - -This page provides details about the graphics tablet -support in libinput. Note that the term "tablet" in libinput refers to -graphics tablets only (e.g. Wacom Intuos), not to tablet devices like the -Apple iPad. - -@image html tablet.svg "Illustration of a graphics tablet" - -@section tablet-tools Pad buttons vs. tablet tools - -Most tablets provide two types of devices. The physical tablet often -provides a number of buttons and a touch ring or strip. Interaction on the -drawing surface of the tablet requires a tool, usually in the shape of a -stylus. The libinput interface exposed by devices with the @ref -LIBINPUT_DEVICE_CAP_TABLET_TOOL capability applies only to events generated -by tools. - -Buttons, rings or strips on the physical tablet hardware (the "pad") are -exposed by devices with the @ref LIBINPUT_DEVICE_CAP_TABLET_PAD capability. -Pad events do not require a tool to be in proximity. Note that both -capabilities may exist on the same device though usually they are split -across multiple kernel devices. - -@image html tablet-interfaces.svg "Difference between Pad and Tool buttons" - -Touch events on the tablet integrated into a screen itself are exposed -through the @ref LIBINPUT_DEVICE_CAP_TOUCH capability. Touch events on a -standalone tablet are exposed through the @ref LIBINPUT_DEVICE_CAP_POINTER -capability. In both cases, the kernel usually provides a separate event -node for the touch device, resulting in a separate libinput device. -See libinput_device_get_device_group() for information on how to associate -the touch part with other devices exposed by the same physical hardware. - -@section tablet-tip Tool tip events vs. tool button events - -The primary use of a tablet tool is to draw on the surface of the tablet. -When the tool tip comes into contact with the surface, libinput sends an -event of type @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, and again when the tip -ceases contact with the surface. - -Tablet tools may send button events; these are exclusively for extra buttons -unrelated to the tip. A button event is independent of the tip and can while -the tip is down or up. - -Some tablet tools' pressure detection is too sensitive, causing phantom -touches when the user only slightly brushes the surfaces. For example, some -tools are capable of detecting 1 gram of pressure. - -libinput uses a device-specific pressure threshold to determine when the tip -is considered logically down. As a result, libinput may send a nonzero -pressure value while the tip is logically up. Most application can and -should ignore pressure information until they receive the event of type @ref -LIBINPUT_EVENT_TABLET_TOOL_TIP. Applications that require extremely -fine-grained pressure sensitivity should use the pressure data instead of -the tip events to determine a logical tip down state and treat the tip -events like axis events otherwise. - -Note that the pressure threshold to trigger a logical tip event may be zero -on some devices. On tools without pressure sensitivity, determining when a -tip is down is device-specific. - -@section tablet-relative-motion Relative motion for tablet tools - -libinput calculates the relative motion vector for each event and converts -it to the same coordinate space that a normal mouse device would use. For -the caller, this means that the delta coordinates returned by -libinput_event_tablet_tool_get_dx() and -libinput_event_tablet_tool_get_dy() can be used identical to the delta -coordinates from any other pointer event. Any resolution differences between -the x and y axes are accommodated for, a delta of N/N represents a 45 degree -diagonal move on the tablet. - -The delta coordinates are available for all tablet events, it is up to the -caller to decide when a tool should be used in relative mode. It is -recommended that mouse and lens cursor tool default to relative mode and -all pen-like tools to absolute mode. - -If a tool in relative mode must not use pointer acceleration, callers -should use the absolute coordinates returned by -libinput_event_tablet_tool_get_x() and libinput_event_tablet_tool_get_y() -and calculate the delta themselves. Callers that require exact physical -distance should also use these functions to calculate delta movements. - -@section tablet-axes Special axes on tablet tools - -A tablet tool usually provides additional information beyond x/y positional -information and the tip state. A tool may provide the distance to the tablet -surface and the pressure exerted on the tip when in contact. Some tablets -additionally provide tilt information along the x and y axis. - -@image html tablet-axes.svg "Illustration of the distance, pressure and tilt axes" - -The granularity and precision of the distance and pressure axes varies -between tablet devices and cannot usually be mapped into a physical unit. -libinput normalizes distance and pressure into the [0, 1] range. - -While the normalization range is identical for these axes, a caller should -not interpret identical values as identical across axes, i.e. a value v1 on -the distance axis has no relation to the same value v1 on the pressure axis. - -The tilt axes provide the angle in degrees between a vertical line out of -the tablet and the top of the stylus. The angle is measured along the x and -y axis, respectively, a positive tilt angle thus means that the stylus' top -is tilted towards the logical right and/or bottom of the tablet. - -@section tablet-fake-proximity Handling of proximity events - -libinput's @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY events notify a caller -when a tool comes into sensor range or leaves the sensor range. On some -tools this range does not represent the physical range but a reduced -tool-specific logical range. If the range is reduced, this is done -transparent to the caller. - -For example, the Wacom mouse and lens cursor tools are usually -used in relative mode, lying flat on the tablet. Movement typically follows -the interaction normal mouse movements have, i.e. slightly lift the tool and -place it in a separate location. The proximity detection on Wacom -tablets however extends further than the user may lift the mouse, i.e. the -tool may not be lifted out of physical proximity. For such tools, libinput -provides software-emulated proximity. - -Events from the pad do not require proximity, they may be sent any time. - -@section tablet-pressure-offset Pressure offset on worn-out tools - -When a tool is used for an extended period it can wear down physically. A -worn-down tool may never return a zero pressure value. Even when hovering -above the surface, the pressure value returned by the tool is nonzero, -creating a fake surface touch and making interaction with the tablet less -predictable. - -libinput automatically detects pressure offsets and rescales the remaining -pressure range into the available range, making pressure-offsets transparent -to the caller. A tool with a pressure offset will thus send a 0 pressure -value for the detected offset and nonzero pressure values for values higher -than that offset. - -Some limitations apply to avoid misdetection of pressure offsets, -specifically: -- pressure offset is only detected on proximity in, and if a device is - capable of detection distances, -- pressure offset is only detected if the distance between the tool and the - tablet is high enough, -- pressure offset is only used if it is 20% or less of the pressure range - available to the tool. A pressure offset higher than 20% indicates either - a misdetection or a tool that should be replaced, and -- if a pressure value less than the current pressure offset is seen, the - offset resets to that value. - -Pressure offsets are not detected on @ref LIBINPUT_TABLET_TOOL_TYPE_MOUSE -and @ref LIBINPUT_TABLET_TOOL_TYPE_LENS tools. - -@section tablet-serial-numbers Tracking unique tools - -Some tools provide hardware information that enables libinput to uniquely -identify the physical device. For example, tools compatible with the Wacom -Intuos 4, Intuos 5, Intuos Pro and Cintiq series are uniquely identifiable -through a serial number. libinput does not specify how a tool can be -identified uniquely, a caller should use libinput_tablet_tool_is_unique() to -check if the tool is unique. - -libinput creates a struct libinput_tablet_tool on the first proximity in of -this tool. By default, this struct is destroyed on proximity out and -re-initialized on the next proximity in. If a caller keeps a reference to -the tool by using libinput_tablet_tool_ref() libinput re-uses this struct -whenever that same physical tool comes into proximity on any tablet -recognized by libinput. It is possible to attach tool-specific virtual state -to the tool. For example, a graphics program such as the GIMP may assign a -specific color to each tool, allowing the artist to use the tools like -physical pens of different color. In multi-tablet setups it is also -possible to track the tool across devices. - -If the tool does not have a unique identifier, libinput creates a single -struct libinput_tablet_tool per tool type on each tablet the tool is used -on. - -@section tablet-tool-types Vendor-specific tablet tool types - -libinput supports a number of high-level tool types that describe the -general interaction expected with the tool. For example, a user would expect -a tool of type @ref LIBINPUT_TABLET_TOOL_TYPE_PEN to interact with a -graphics application taking pressure and tilt into account. The default -virtual tool assigned should be a drawing tool, e.g. a virtual pen or brush. -A tool of type @ref LIBINPUT_TABLET_TOOL_TYPE_ERASER would normally be -mapped to an eraser-like virtual tool. See @ref libinput_tablet_tool_type -for the list of all available tools. - -Vendors may provide more fine-grained information about the tool in use by -adding a hardware-specific tool ID. libinput provides this ID to the caller -with libinput_tablet_tool_get_tool_id() but makes no promises about the -content or format of the ID. - -libinput currently supports Wacom-style tool IDs as provided on the Wacom -Intuos 3, 4, 5, Wacon Cintiq and Wacom Intuos Pro series. The tool ID can -be used to distinguish between e.g. a Wacom Classic Pen or a Wacom Pro Pen. -It is the caller's responsibility to interpret the tool ID. - -@section tablet-bounds Out-of-bounds motion events - -Some tablets integrated into a screen (e.g. Wacom Cintiq 24HD, 27QHD and -13HD series, etc.) have a sensor larger than the display area. libinput uses -the range advertised by the kernel as the valid range unless device-specific -quirks are present. Events outside this range will produce coordinates that -may be negative or larger than the tablet's width and/or height. It is up to -the caller to ignore these events. - -@image html tablet-out-of-bounds.svg "Illustration of the out-of-bounds area on a tablet" - -In the image above, the display area is shown in black. The red area around -the display illustrates the sensor area that generates input events. Events -within this area will have negative coordinate or coordinates larger than -the width/height of the tablet. - -If events outside the logical bounds of the input area are scaled into a -custom range with libinput_event_tablet_tool_get_x_transformed() and -libinput_event_tablet_tool_get_y_transformed() the resulting value may be -less than 0 or larger than the upper range provided. It is up to the caller -to test for this and handle or ignore these events accordingly. - -@section tablet-pad-buttons Tablet pad button numbers - -Tablet Pad buttons are numbered sequentially, starting with button 0. Thus -button numbers returned by libinput_event_tablet_pad_get_button_number() -have no semantic meaning, a notable difference to the button codes returned -by other libinput interfaces (e.g. libinput_event_tablet_tool_get_button()). - -The Linux kernel requires all input events to have semantic event codes, -but generic buttons like those on a pad cannot easily be assigned semantic -codes. The kernel supports generic codes in the form of BTN_0 through to -BTN_9 and additional unnamed space up until code 0x10f. Additional generic -buttons are available as BTN_A in the range dedicated for gamepads and -joysticks. Thus, tablet with a large number of buttons have to map across -two semantic ranges, have to use unnamed kernel button codes or risk leaking -into an unrelated range. libinput transparently maps the kernel event codes -into a sequential button range on the pad. Callers should use external -sources like libwacom to associate button numbers to their position on the -tablet. - -Some buttons may have expected default behaviors. For example, on Wacom -Intuos Pro series tablets, the button inside the touch ring is expected to -switch between modes, see @ref tablet-pad-modes. Callers should use -external sources like libwacom to identify which buttons have semantic -behaviors. - -@section tablet-left-handed Tablets in left-handed mode - -Left-handed mode on tablet devices usually means rotating the physical -tablet by 180 degrees to move the tablet pad button area to right side of -the tablet. When left-handed mode is enabled on a tablet device (see -libinput_device_config_left_handed_set()) the tablet tool and tablet pad -behavior changes. In left-handed mode, the tools' axes are adjusted -so that the origin of each axis remains the logical north-east of -the physical tablet. For example, the x and y axes are inverted and the -positive x/y coordinates are down/right of the top-left corner of the tablet -in its current orientation. On a tablet pad, the ring and strip are -similarly adjusted. The origin of the ring and strips remain the top-most -point. - -@image html tablet-left-handed.svg "Tablet axes in right- and left-handed mode" - -Pad buttons are not affected by left-handed mode; the number of each button -remains the same even when the perceived physical location of the button -changes. This is a conscious design decision: -- Tablet pad buttons do not have intrinsic semantic meanings. Re-ordering - the button numbers would not change any functionality. -- Button numbers should not be exposed directly to the user but handled in - the intermediate layers. Re-ordering button numbers thus has no - user-visible effect. -- Re-ordering button numbers may complicate the intermediate layers. - -Left-handed mode is only available on some tablets, some tablets are -symmetric and thus do not support left-handed mode. libinput requires -libwacom to determine if a tablet is capable of being switched to -left-handed mode. - -@section tablet-pad-modes Tablet pad modes - -Tablet pad modes are virtual groupings of button, ring and strip -functionality. A caller may assign different functionalities depending on -the mode the tablet is in. For example, in mode 0 the touch ring may emulate -scrolling, in mode 1 the touch ring may emulate zooming, etc. libinput -handles the modes and mode switching but does not assign specific -functionality to buttons, rings or strips based on the mode. It is up to the -caller to decide whether the mode only applies to buttons, rings and strips -or only to rings and strips (this is the case with the Wacom OS X and -Windows driver). - -The availability of modes on a touchpad usually depends on visual feedback -such as LEDs around the touch ring. If no visual feedback is available, only -one mode may be available. - -Mode switching is controlled by libinput and usually toggled by one or -more buttons on the device. For example, on the Wacom Intuos 4, 5, and -Pro series tablets the mode button is the button centered in the touch -ring and toggles the modes sequentially. On the Wacom Cintiq 24HD the -three buttons next to each touch ring allow for directly changing the -mode to the desired setting. - -Multiple modes may exist on the tablet, libinput uses the term "mode group" -for such groupings of buttons that share a mode and mode toggle. For -example, the Wacom Cintiq 24HD has two separate mode groups, one for the -left set of buttons, strips, and touch rings and one for the right set. -libinput handles the mode groups independently and returns the mode for each -button as appropriate. The mode group is static for the lifetime of the -device. - -@image html tablet-intuos-modes.svg "Modes on an Intuos Pro-like tablet" - -In the image above, the Intuos Pro-like tablet provides 4 LEDs to indicate -the currently active modes. The button inside the touch ring cycles through -the modes in a clockwise fashion. The upper-right LED indicates that the -currently active mode is 1, based on 0-indexed mode numbering. -libinput_event_tablet_pad_get_mode() would thus return 1 for all button and -ring events on this tablet. When the center button is pressed, the mode -switches to mode 2, the LED changes to the bottom-right and -libinput_event_tablet_pad_get_mode() returns 2 for the center button event -and all subsequent events. - -@image html tablet-cintiq24hd-modes.svg "Modes on an Cintiq 24HD-like tablet" - -In the image above, the Cintiq 24HD-like tablet provides 3 LEDs on each side -of the tablet to indicate the currently active mode for that group of -buttons and the respective ring. The buttons next to the touch ring select -the mode directly. The two LEDs indicate that the mode for the left set of -buttons is currently 0, the mode for the right set of buttons is currently -1, based on 0-indexed mode numbering. libinput_event_tablet_pad_get_mode() -would thus return 0 for all button and ring events on the left and 1 for all -button and ring events on the right. When one of the three mode toggle -buttons on the right is pressed, the right mode switches to that button's -mode but the left mode remains unchanged. - -@section tablet-touch-arbitration Tablet touch arbitration - -"Touch arbitration" is the terminology used when touch events are suppressed -while the pen is in proximity. Since it is almost impossible to use a stylus -or other tool without triggering touches with the hand holding the tool, -touch arbitration serves to reduce the number of accidental inputs. -The wacom kernel driver currently provides touch arbitration but for other -devices arbitration has to be done in userspace. - -libinput uses the @ref libinput_device_group to decide on touch arbitration -and automatically discards touch events whenever a tool is in proximity. -The exact behavior is device-dependent. - -@section tablet-capabilities Required tablet capabilities - -To handle a tablet correctly, libinput requires a set of capabilities -on the device. When these capabilities are missing, libinput ignores the -device and prints an error to the log. This error messages reads -
-missing tablet capabilities: xy pen btn-stylus resolution. Ignoring this device.
-
-or in older versions of libinput simply: -
-libinput bug: device does not meet tablet criteria. Ignoring this device.
-
- -When a tablet is rejected, it is usually possible to check the issue with -the `evemu-descibe` tool. - -- **xy** indicates that the tablet is missing the `ABS_X` and/or `ABS_Y` - axis. This indicates that the device is mislabelled and the udev tag - `ID_INPUT_TABLET` is applied to a device that is not a tablet. -- **pen** or **btn-stylus** indicates that the tablet does not have the - `BTN_TOOL_PEN` or `BTN_STYLUS` bit set. libinput requires either or both - of them to be present. This usually indicates a bug in the kernel driver - or the HID descriptors of the device. -- **resolution** indicates that the device does not have a resolution set - for the x and y axes. This can be fixed with a hwdb entry, locate and read - the 60-evdev.hwdb file on your machine to address this. - -*/ diff -Nru libinput-1.10.3/doc/tapping.dox libinput-0.21.0/doc/tapping.dox --- libinput-1.10.3/doc/tapping.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/tapping.dox 2015-07-15 04:18:08.000000000 +0000 @@ -12,9 +12,7 @@ not support four-finger taps or any tapping with more than four fingers, even though some hardware can distinguish between that many fingers. -@section tapping_default Tap-to-click default setting - -Tapping is **disabled** by default on most devices, see [this +Tapping is **disabled** by default, see [this commit](http://cgit.freedesktop.org/wayland/libinput/commit/?id=2219c12c3aa45b80f235e761e87c17fb9ec70eae) because: - if you don't know that tapping is a thing (or enabled by default), you get @@ -22,11 +20,7 @@ - if you do know what tapping is and you want it, you usually know where to enable it, or at least you can search for it. -Tapping is **enabled** by default on devices where tapping is the only -method to trigger button clicks. This includes devices without physical -buttons such as touch-capable graphics tablets. - -Tapping can be enabled/disabled on a per-device basis. See +Tapping can be enabled on a per-device basis. See libinput_device_config_tap_set_enabled() for details. @section tapndrag Tap-and-drag @@ -34,23 +28,19 @@ libinput also supports "tap-and-drag" where a tap immediately followed by a finger down and that finger being held down emulates a button press. Moving the finger around can thus drag the selected item on the screen. -Tap-and-drag is optional and can be enabled or disabled with -libinput_device_config_tap_set_drag_enabled(). Most devices have -tap-and-drag enabled by default. -Also optional is a feature called "drag lock". With drag lock disabled, lifting +Optional is a feature called "drag lock". With drag lock disabled, lifting the finger will stop any drag process. When enabled, libinput will ignore a finger up event during a drag process, provided the finger is set down again within a implementation-specific timeout. Drag lock can be enabled and disabled with libinput_device_config_tap_set_drag_lock_enabled(). -Note that drag lock only applies if tap-and-drag is be enabled. @image html tap-n-drag.svg "Tap-and-drag process" The above diagram explains the process, a tap (a) followed by a finger held down (b) starts the drag process and logically holds the left mouse button down. A movement of the finger (c) will drag the selected item until the -finger is released (e). If needed and drag lock is enabled, the finger's +finger is relased (e). If needed and drag lock is enabled, the finger's position can be reset by lifting and quickly setting it down again on the touchpad (d). This will be interpreted as continuing move and is especially useful on small touchpads or with slow pointer acceleration. diff -Nru libinput-1.10.3/doc/test-suite.dox libinput-0.21.0/doc/test-suite.dox --- libinput-1.10.3/doc/test-suite.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/test-suite.dox 2015-07-15 04:18:08.000000000 +0000 @@ -1,21 +1,11 @@ /** @page test-suite libinput test suite -libinput ships with a number of tests all run automatically on `ninja test`. -The primary test suite is the `libinput-test-suite-runner`. When testing, -the `libinput-test-suite-runner` should always be invoked to check for -behavior changes. - -The test suite runner uses -[Check](http://check.sourceforge.net/doc/check_html/) underneath the hood -but most of the functionality is abstracted into *litest* wrappers. - -The test suite runner has a make-like job control enabled by the `-j` or -`--jobs` flag and will fork off as many parallel processes as given by this -flag. The default if unspecified is 8. When debugging a specific test case -failure it is recommended to employ test filtures (see @ref test-filtering) -and disable parallel tests. The test suite automatically disables parallel -make when run in gdb. +The libinput test suite is based on +[Check](http://check.sourceforge.net/doc/check_html/) and runs automatically +during `make check`. Check itself is wrapped into a libinput-specific test +suite called *litest*. Tests are found in `$srcdir/test/`, the test binaries are +prefixed with `test-` and can be run individually. @section test-config X.Org config to avoid interference @@ -31,74 +21,42 @@ Most tests require the creation of uinput devices and access to the resulting `/dev/input/eventX` nodes. Some tests require temporary udev rules. -This usually requires the tests to be run as root. If not run as -root, the test suite runner will exit with status 77, interpreted as -"skipped" by ninja. +This usually requires the tests to be run as root. @section test-filtering Selective running of tests -litest's tests are grouped into test groups, test names and devices. A test -group is e.g. "touchpad:tap" and incorporates all tapping-related tests for -touchpads. Each test function is (usually) run with one or more specific -devices. The `--list` commandline argument shows the list of suites and -tests. This is useful when trying to figure out if a specific test is -run for a device. - +litest's tests are grouped by test groups and devices. A test group is e.g. +"touchpad:tap" and incorporates all tapping-related tests for touchpads. +Each test function is (usually) run with one or more specific devices. +The `--list` commandline argument shows the list of suites and tests. @code -$ ./test/libinput-test-suite-runner --list -... -pointer:left-handed: - pointer_left_handed_during_click_multiple_buttons: - trackpoint - ms-surface-cover - mouse-wheelclickcount - mouse-wheelclickangle - low-dpi-mouse - mouse-roccat - mouse-wheel-tilt - mouse - logitech-trackball - cyborg-rat - magicmouse - pointer_left_handed_during_click: - trackpoint - ms-surface-cover - mouse-wheelclickcount - mouse-wheelclickangle - low-dpi-mouse - mouse-roccat - mouse-wheel-tilt - mouse - logitech-trackball - cyborg-rat - litest-magicmouse-device - pointer_left_handed: - trackpoint - ms-surface-cover - mouse-wheelclickcount - mouse-wheelclickangle - low-dpi-mouse - mouse-roccat - mouse-wheel-tilt - mouse +$ ./test/test-device --list +device:wheel: + wheel only + blackwidow +device:invalid devices: + no device +device:group: + no device + logitech trackball + MS surface cover + mouse_roccat + wheel only + blackwidow ... @endcode -In the above example, the "pointer:left-handed" suite contains multiple -tests, e.g. "pointer_left_handed_during_click" (this is also the function -name of the test, making it easy to grep for). This particular test is run -for various devices including the trackpoint device and the magic mouse -device. - -The "no device" entry signals that litest does not instantiate a uinput -device for a specific test (though the test itself may +In the above example, the "device:wheel" suite is run for the "wheel only" and +the "blackwidow" device. Both devices are automatically instantiated through +uinput by litest. The "no device" entry signals that litest does not +instantiate a uinput device for a specific test (though the test itself may instantiate one). The `--filter-test` argument enables selective running of tests through basic shell-style function name matching. For example: @code -$ ./test/libinput-test-suite-runner --filter-test="*1fg_tap*" +$ ./test/test-touchpad --filter-test="*1fg_tap*" @endcode The `--filter-device` argument enables selective running of tests through @@ -106,7 +64,7 @@ litest-specific shortnames, see the output of `--list`. For example: @code -$ ./test/libinput-test-suite-runner --filter-device="synaptics*" +$ ./test/test-touchpad --filter-device="synaptics*" @endcode The `--filter-group` argument enables selective running of test groups @@ -114,7 +72,7 @@ litest-specific test groups, see the output of `--list`. For example: @code -$ ./test/libinput-test-suite-runner --filter-group="touchpad:*hover*" +$ ./test/test-touchpad --filter-group="touchpad:*hover*" @endcode The `--filter-device` and `--filter-group` arguments can be combined with @@ -127,8 +85,8 @@ environment variable, if set, also enables verbose mode. @code -$ ./test/libinput-test-suite-runner --verbose -$ LITEST_VERBOSE=1 ninja test +$ ./test/test-device --verbose +$ LITEST_VERBOSE=1 make check @endcode */ diff -Nru libinput-1.10.3/doc/timestamps.dox libinput-0.21.0/doc/timestamps.dox --- libinput-1.10.3/doc/timestamps.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/timestamps.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/** - -@page timestamps Timestamps - -@section event_timestamps Event timestamps - -Most libinput events provide a timestamp in millisecond and/or microsecond -resolution. These timestamp usually increase monotonically, but libinput -does not guarantee that this always the case. In other words, it is possible -to receive an event with a timestamp earlier than the previous event. - -For example, if a touchpad has @ref tapping enabled, a button event may have a -lower timestamp than an event from a different device. Tapping requires the -use of timeouts to detect multi-finger taps and/or @ref tapndrag. - -Consider the following event sequences from a touchpad and a mouse: - -
-Time      Touchpad      Mouse
----------------------------------
-t1       finger down
-t2        finger up
-t3                     movement
-t4       tap timeout
-
- -For this event sequence, the first event to be sent to a caller is in -response to the mouse movement: an event of type @ref -LIBINPUT_EVENT_POINTER_MOTION with the timestamp t3. -Once the timeout expires at t4, libinput generates an event of -@ref LIBINPUT_EVENT_POINTER_BUTTON (press) with a timestamp t1 and an event -@ref LIBINPUT_EVENT_POINTER_BUTTON (release) with a timestamp t2. - -Thus, the caller gets events with timestamps in the order t3, t1, t2, -despite t3 > t2 > t1. -*/ diff -Nru libinput-1.10.3/doc/tools.dox libinput-0.21.0/doc/tools.dox --- libinput-1.10.3/doc/tools.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/tools.dox 2015-07-28 22:12:38.000000000 +0000 @@ -1,23 +1,25 @@ /** @page tools Helper tools -libinput provides a `libinput` tool to query state and events. -The two most common invocations are -@ref libinput-list-devices and @ref libinput-debug-events. A full -explanation of the various commands available in the libinput tool is -available in the libinput(1) man page. Generally, the -tool must be run as root to have access to the kernel's @c /dev/input/event* -device files. - -@section libinput-list-devices libinput list-devices - -The `libinput list-devices` command shows information about devices -recognized by libinput and can help identifying why a device behaves -different than expected. For example, if a device does not show up in the -output, it is not a supported input device. +libinput provides a couple of tools to query state and events. Two of these +tools are usually installed, others are @ref developer_tools only. + +@section user_tools User tools + +libinput ships with two tools to gather information about devices: +@ref libinput-list-devices and @ref libinput-debug-events. Both tools must +be run as root to have acess to the kernel's @c /dev/input/event* device +files. + +@subsection libinput-list-devices + +The libinput-list-devices tool shows information about devices recognized by +libinput and can help identifying why a device behaves different than +expected. For example, if a device does not show up in the output, it is not +a supported input device. @verbatim -$ sudo libinput list-devices +$ sudo libinput-list-devices [...] Device: SynPS/2 Synaptics TouchPad Kernel: /dev/input/event4 @@ -37,8 +39,8 @@ @endverbatim The above listing shows example output for a touchpad. The -`libinput list-devices` command lists general information about the device -(the kernel event node) but also the configuration options. If an option is +libinput-list-devices tool lists general information about the device (the +kernel event node) but also the configuration options. If an option is "n/a" it does not exist on this device. Otherwise, the tool will show the default configuration for this device, for options that have more than a binary state all available options are listed, with the default one prefixed @@ -51,18 +53,37 @@ @note This tool is intended to be human-readable and may change its output at any time. -@section libinput-debug-events libinput debug-events -The `libinput debug-events` command prints events from devices and can help -to identify why a device behaves different than expected. +@subsection libinput-debug-events +This is an installed version of the @ref event-debug developer tool. It +prints events from devices and can help to identify why a device behaves +different than expected. + +@verbatim +$ sudo libinput-debug-events --enable-tapping --set-click-method=clickfinger +@endverbatim + +See the man page or the @c --help output for information about the available +options. + +@section developer_tools Developer tools + +The two most common tools used by developers are @ref event-debug and @ref +event-gui. + +@subsection event-debug +This is the in-tree version of the @ref libinput-debug-events tool and is +linked to allow for easy debugging (i.e. it avoids libtool shenanigans). The +code is the same. For debugging, run it against a single device only and +enable the --verbose flag. This will print the various state machine +transitions in addition to the events. @verbatim -$ sudo libinput debug-events --enable-tapping --set-click-method=clickfinger +$ sudo ./tools/event-debug --verbose --device /dev/input/event3 @endverbatim -See the libinput(1) man page or the @c --help output for information about -the available options. +See the @c --help output for information about the available options. -@section libinput-debug-gui libinput debug-gui +@subsection event-gui A simple GTK-based graphical tool that shows the behavior and location of touch events, pointer motion, scroll axes and gestures. Since this tool @@ -70,10 +91,12 @@ pointer-acceleration testing. @verbatim -$ sudo libinput debug-gui +$ sudo ./tools/event-gui @endverbatim -See the libinput(1) man page or the @c --help output for information about -the available options. +See the @c --help output for information about the available options. + +@note The @c --grab flag puts an exclusive @c EVIOCGRAB on the device to +avoid interference with the desktiop while testing. */ diff -Nru libinput-1.10.3/doc/touchpad-edge-scrolling-state-machine.svg libinput-0.21.0/doc/touchpad-edge-scrolling-state-machine.svg --- libinput-1.10.3/doc/touchpad-edge-scrolling-state-machine.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/touchpad-edge-scrolling-state-machine.svg 1970-01-01 00:00:00.000000000 +0000 @@ -1,262 +0,0 @@ - - - - - - - NONE - on-entry: - edge = none - threshold = def - - - - EDGE_NEW - on-entry: - edge = get_edge() - set_timer() - - - - AREA - on-entry: - edge = none - set_pointer() - - - - release - - - - touch - - - - - - touch, - edge &= get_edge() - - - - - - - - - - - - - - - tp_edge_scroll_post_events() - - - - dirty? - - - - - - no - - - - - - yes - - - - - - current = buttons.state & 0x01 - old = buttons.old_state & 0x01 - button = 0 - is_top = 0 - - - - - - notify_axis(last_axis, 0.0) - last_axis = -1 - - - - edge == right - - - - - - yes - - - - axis = scroll_vertical - delta = dy - - - - - - edge == none - - - - - - no - - - - edge == bottom - - - - - - yes - - - - - - no - - - - axis = scroll_horizontal - delta = dx - - - - - - no - - - - get_delta() - - - - - - - - notify_axis(axis, delta) - last_axis = axis - emit(scroll_event_posted) - - - - delta < threshold - - - - - - yes - - - - - - no - - - - - - - - last_axis != -1 - - - - EDGE - on-entry: - threshold = 0.01 - - - - - - - - timeout || - scroll_event_posted - - - - - - - - - - yes - - - - - - yes - - - - - - no - - - - - - - - - - - - - - - - - - yes - - - - - - no - - - - get_edge() - - - - edge - - - - - - no - - - - - - yes - - - diff -Nru libinput-1.10.3/doc/touchpad-jumping-cursors.dox libinput-0.21.0/doc/touchpad-jumping-cursors.dox --- libinput-1.10.3/doc/touchpad-jumping-cursors.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/touchpad-jumping-cursors.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -/** -@page touchpad_jumping_cursor Touchpad jumping cursor bugs - -A common bug encountered on touchpads is a cursor jump when alternating -between fingers on a multi-touch-capable touchpad. For example, after moving -the cursor a user may use a second finger in the software button area to -physically click the touchpad. Upon setting the finger down, the cursor -exhibits a jump towards the bottom left or right, depending on the finger -position. - -When libinput detects a cursor jump it prints a bug warning to the log with -the text "Touch jump detected and discarded." and a link to this page. - -In most cases, this is a bug in the kernel driver and to libinput it appears -that the touch point moves from its previous position. The pointer jump can -usually be seen in the evemu-record output for the device: - -
- E: 249.206319 0000 0000 0000    # ------------ SYN_REPORT (0) ----------
- E: 249.218008 0003 0035 3764    # EV_ABS / ABS_MT_POSITION_X    3764
- E: 249.218008 0003 0036 2221    # EV_ABS / ABS_MT_POSITION_Y    2221
- E: 249.218008 0003 003a 0065    # EV_ABS / ABS_MT_PRESSURE      65
- E: 249.218008 0003 0000 3764    # EV_ABS / ABS_X                3764
- E: 249.218008 0003 0001 2216    # EV_ABS / ABS_Y                2216
- E: 249.218008 0003 0018 0065    # EV_ABS / ABS_PRESSURE         65
- E: 249.218008 0000 0000 0000    # ------------ SYN_REPORT (0) ----------
- E: 249.230881 0003 0035 3752    # EV_ABS / ABS_MT_POSITION_X    3752
- E: 249.230881 0003 003a 0046    # EV_ABS / ABS_MT_PRESSURE      46
- E: 249.230881 0003 0000 3758    # EV_ABS / ABS_X                3758
- E: 249.230881 0003 0018 0046    # EV_ABS / ABS_PRESSURE         46
- E: 249.230881 0000 0000 0000    # ------------ SYN_REPORT (0) ----------
- E: 249.242648 0003 0035 1640    # EV_ABS / ABS_MT_POSITION_X    1640
- E: 249.242648 0003 0036 4681    # EV_ABS / ABS_MT_POSITION_Y    4681
- E: 249.242648 0003 003a 0025    # EV_ABS / ABS_MT_PRESSURE      25
- E: 249.242648 0003 0000 1640    # EV_ABS / ABS_X                1640
- E: 249.242648 0003 0001 4681    # EV_ABS / ABS_Y                4681
- E: 249.242648 0003 0018 0025    # EV_ABS / ABS_PRESSURE         25
- E: 249.242648 0000 0000 0000    # ------------ SYN_REPORT (0) ----------
- E: 249.254568 0003 0035 1648    # EV_ABS / ABS_MT_POSITION_X    1648
- E: 249.254568 0003 003a 0027    # EV_ABS / ABS_MT_PRESSURE      27
- E: 249.254568 0003 0000 1644    # EV_ABS / ABS_X                1644
- E: 249.254568 0003 0018 0027    # EV_ABS / ABS_PRESSURE         27
-
- -In this recording, the pointer jumps from its position 3752/2216 to -1640/4681 within a single frame. On this particular touchpad, this would -represent a physical move of almost 50mm. libinput detects some of these -jumps and discards the movement but otherwise continues as usual. However, -the bug should be fixed at the kernel level. - -When you encounter the warning in the log, please generate an evemu -recording of your touchpad and file a bug. See @ref reporting_bugs for more -details. -*/ diff -Nru libinput-1.10.3/doc/touchpad-pressure.dox libinput-0.21.0/doc/touchpad-pressure.dox --- libinput-1.10.3/doc/touchpad-pressure.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/touchpad-pressure.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,120 +0,0 @@ -/** -@page touchpad_pressure Touchpad pressure-based touch detection - -libinput uses the touchpad pressure values to detect wether a finger has -been placed on the touchpad. This is @ref kernel_pressure_information and -combines with a libinput-specific hardware database to adjust the thresholds -on a per-device basis. libinput uses pressure thresholds primarily to filter -out accidental light touches but pressure information is also used for -some @ref palm_detection. - -Pressure thresholds are **not** directly configurable by the user, rather it -is planned that libinput provides custom pressure thresholds for each device -where necessary. See @ref touchpad_pressure_hwdb for instructions for your -local device. - -@section kernel_pressure_information Information provided by the kernel - -The kernel sends multiple values to inform userspace about a finger touching -the touchpad. The most basic is the ```EV_KEY/BTN_TOUCH``` boolean event -that simply announces physical contact with the touchpad. The decision when -this event is sent is usually made by the kernel driver and may depend on -device-specific thresholds. These thresholds are transparent to userspace -and cannot be modified. - -Many contemporary touchpad devices provide an absolute pressure axis in -addition to ```BTN_TOUCH```. This pressure generally increases as the pressure -increases, however few touchpads are capable of detection pressure. The -pressure value is usually related to the covered area - as the pressure -increases a finger flattens and thus covers a larger area. The range -provided by the kernel is not mapped to a specific physical range and -often requires adjustment. Pressure is sent by the ```ABS_PRESSURE``` axis -for single-touch touchpads or ```ABS_MT_PRESSURE``` on multi-touch capable -touchpads. - -Some devices provide additional touch size information through -the ```ABS_MT_TOUCH_MAJOR/ABS_MT_TOUCH_MINOR``` axes and/or -the ```ABS_MT_WIDTH_MAJOR/ABS_MT_WIDTH_MINOR``` axes. While the kernel -documentation specifies how these axes are supposed to be mapped, few -devices forward -reliable information. - -@section touchpad_pressure_hwdb Debugging touchpad pressure ranges - -This section describes how to determine the touchpad pressure ranges -required for a touchpad device and how to add the required hwdb entry -locally. Note that the hwdb entry is **not public API** and **may change at -any time**. Users are advised to @ref reporting_bugs "report a bug" with the -updated pressure ranges when testing has completed. - -Use the ```libinput measure touchpad-pressure``` tool provided by libinput. -This tool will search for your touchpad device and print some pressure -statistics, including whether a touch is/was considered logically down. -Example output of the tool is below: - -
-$ sudo libinput measure touchpad-pressure
-Ready for recording data.
-Pressure range used: 8:10
-Palm pressure range used: 65535
-Place a single finger on the touchpad to measure pressure values.
-Ctrl+C to exit
- 
-Sequence 1190 pressure: min:  39 max:  48 avg:  43 median:  44 tags: down
-Sequence 1191 pressure: min:  49 max:  65 avg:  62 median:  64 tags: down
-Sequence 1192 pressure: min:  40 max:  78 avg:  64 median:  66 tags: down
-Sequence 1193 pressure: min:  36 max:  83 avg:  70 median:  73 tags: down
-Sequence 1194 pressure: min:  43 max:  76 avg:  72 median:  74 tags: down
-Touchpad pressure:  47 min:  47 max:  86 tags: down
-
- -The example output shows five completed touch sequences and one ongoing one. -For each, the respective minimum and maximum pressure values are printed as -well as some statistics. The ```tags``` show that sequence was considered -logically down at some point. This is an interactive tool and its output may -change frequently. Refer to the libinput-measure-touchpad-pressure(1) man -page for more details. - -By default, this tool uses the udev hwdb entries for the pressure range. To -narrow down on the best values for your device, specify the 'logically down' -and 'logically up' pressure thresholds with the ```--touch-thresholds`` -argument: -
-$ sudo libinput measure touchpad-pressure --touch-thresholds=10:8
-
- -Interact with the touchpad and check if the output of this tool matches your -expectations. - -Once the thresholds are decided on (e.g. 10 and 8), they can be enabled with -the following hwdb file: - -
-$> cat /etc/udev/hwdb.d/99-touchpad-pressure.hwdb
-libinput:name:*SynPS/2 Synaptics TouchPad:dmi:*svnHewlett-Packard:*pnHPCompaq6910p*
- LIBINPUT_ATTR_PRESSURE_RANGE=10:8
-
- -The first line is the match line and should be adjusted for the device name -(see evemu-record's output) and for the local system, based on the -information in ```/sys/class/dmi/id/modalias```. The modalias should be -shortened to the specific system's information, usually system vendor (svn) -and product name (pn). - -Once in place, you need to run the following to commands, adjusted for your -device's event node (see @ref faq_hwdb_changes): -
-    sudo udevadm hwdb --update
-    sudo udevadm test /sys/class/input/eventX
-
- -If the pressure range property shows up correctly, restart X or the -Wayland compositor and libinput should now use the correct pressure -thresholds. The @ref tools can be used to verify the correct -functionality first without the need for a restart. - -Once the pressure ranges are deemed correct, -@ref reporting_bugs "report a bug" to get the pressure ranges into the -repository. - -*/ diff -Nru libinput-1.10.3/doc/touchpads.dox libinput-0.21.0/doc/touchpads.dox --- libinput-1.10.3/doc/touchpads.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/touchpads.dox 2015-08-03 21:42:14.000000000 +0000 @@ -71,7 +71,7 @@ SMBus. These touchpads usually also provide extra information. Apple touchpads -provide an ellipse and the orientation of the ellipse for each touch point. +provide an ellipsis and the orientation of the ellipsis for each touch point. Other touchpads provide a pressure value for each touch point (see @ref touchpads_pressure_handling). @@ -130,7 +130,7 @@ Pressure is usually directly related to contact area. Human fingers flatten out as the pressure on the pad increases, resulting in a bigger contact area -and the firmware then calculates that back into a pressure reading. +and the firmware then calculates that back into a ressure reading. libinput uses pressure to detect accidental palm contact and thumbs, though pressure data is often device-specific and unreliable. @@ -138,7 +138,7 @@ @subsection touchpads_circular Circular touchpads Only listed for completeness, circular touchpads have not been used in -laptops for a number of years. These touchpad shaped in an ellipse or +laptops for a number of years. These touchpad shaped in an ellipsis or straight. @subsection touchpads_tablets Graphics tablets diff -Nru libinput-1.10.3/doc/touchpad-tap-state-machine.svg libinput-0.21.0/doc/touchpad-tap-state-machine.svg --- libinput-1.10.3/doc/touchpad-tap-state-machine.svg 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/touchpad-tap-state-machine.svg 2015-07-28 22:12:38.000000000 +0000 @@ -1,1248 +1,1201 @@ - + - + - - - - - - - - - IDLE - - - - TOUCH - - - - first - finger down - - - - - - finger up - - - - - - button 1 - press - - - - timeout - - - - - - move > - threshold - - - - - - second - finger down - - - - - - TOUCH_2 - - - - second - finger up - - - - - - button 2 - press - - - - move > - threshold - - - - timeout - - - - - - - - button 1 - release - - - - button 2 - release - - - - - - - - TAPPED - - - - timeout - - - - - - first - finger down - - - - - - DRAGGING - - - - first - finger up - - - - btn1 - release - - - - - - - - - - IDLE - - - - third - finger down - - - - - - TOUCH_3 - - - - - - button 3 - press - - - - button 3 - release - - - - - - move > - threshold - - - - - - IDLE - - - - timeout - - - - - - first - finger up - - - - - - IDLE - - - - fourth - finger down - - - - - - - - DRAGGING_OR_DOUBLETAP - - - - - - timeout - - - - - - first - finger up - - - - - - button 1 - release - - - - button 1 - press - - - - btn1 - release - - - - - - second - finger down - - - - - - move > - threshold - - - - - - - - HOLD - - - - first - finger up - - - - - - - - second - finger down - - - - - - - - TOUCH_2_HOLD - - - - second - finger up - - - - - - first - finger up - - - - - - - - third - finger down - - - - - - - - - - TOUCH_3_HOLD - - - - - - fourth - finger down - - - - DEAD - - - - - - - - - - any finger up - - - - fourth - finger up - - - - any finger up - - - - - + + + + + + + + + + IDLE + + + + + TOUCH + + + + + first + + finger down + + + + + + + finger up + + + + + + + button 1 + + press + + + + + timeout + + + + + + + move > + + threshold + + + + + + + second + + finger down + + + + + + + TOUCH_2 + + + + + second + + finger up + + + + + + + button 2 + + press + + + + + move > + + threshold + + + + + timeout + + + + + + + + + button 1 + + release + + + + + button 2 + + release + + + + + + + + + TAPPED + + + + + timeout + + + + + + + first + + finger down + + + + + + + DRAGGING + + + + + first + + finger up + + + + + btn1 + + release + + + + + + + + + + + IDLE + + + + + third + + finger down + + + + + + + TOUCH_3 + + + + + + + button 3 + + press + + + + + button 3 + + release + + + + + + + move > + + threshold + + + + + + + IDLE + + + + + timeout + + + + + + + first + + finger up + + + + + + + IDLE + + + + + fourth + + finger down + + + + + + + + + DRAGGING_OR_DOUBLETAP + + + + + + + timeout + + + + + + + first + + finger up + + + + + + + button 1 + + release + + + + + button 1 + + press + + + + + btn1 + + release + + + + + + + second + + finger down + + + + + + + move > + + threshold + + + + + + + + + HOLD + + + + + first + + finger up + + + + + + + + + second + + finger down + + + + + + + + + + + TOUCH_2_HOLD + + + + + second + + finger up + + + + + + + first + + finger up + + + + + + + + + + + third + + finger down + + + + + + + + + + + TOUCH_3_HOLD + + + + + + + fourth + + finger down + + + + + DEAD + + + + + + + + + + + any finger up + + + + + fourth + + finger up + + + + + any finger up + + + + + - - yes - - - - any finger up - - - - - - - - - - - - IDLE - - - - if finger - count == 0 - - - - - - - - - - second - finger up - - - - DRAGGING_2 - - - - - - - - first - finger up - - - - - - - - - - second - finger down - - - - - - - - - - third - finger down - - - - - - btn1 - release - - - - + + + yes + + + + + any finger up + + + + + + + + + + + + + IDLE + + + + + if finger + + count == 0 + + + + + + + + + + + second + + finger up + + + + + DRAGGING_2 + + + + + + + + + first + + finger up + + + + + + + + + + + second + + finger down + + + + + + + + + + + third + + finger down + + + + + + + btn1 + + release + + + + - phys - button - press - - - - - - - - - - - - - - + + phys + + button + + press +
+ + + + + + + + + + + + + - phys - button - press - - - - - - button 1 - release - - - - - - - - - - - - - - DRAGGING_WAIT - - - - timeout - - - - - - - - - - first - finger down - - - - - - TOUCH_TOUCH - - - - TOUCH_IDLE - - - - - - - - - - - - TOUCH_DEAD - - - - - - - - - - - - TOUCH_DEAD - - - - - - - - - - TOUCH_IDLE - - - - - - TOUCH_TOUCH - - - - - - - - TOUCH_IDLE - - - - - - TOUCH_IDLE - - - - - - TOUCH_TOUCH - - - - - - that finger - TOUCH_IDLE - - - - - - TOUCH_DEAD - - - - - - - - - - that finger - TOUCH_IDLE - - - - - + + phys + + button + + press +
+ + + + + + button 1 + + release + + + + + + + + + + + + + + + DRAGGING_WAIT + + + + + timeout + + + + + + + + + + + first + + finger down + + + + + + + TOUCH_TOUCH + + + + + TOUCH_IDLE + + + + + + + + + + + + + TOUCH_DEAD + + + + + + + + + + + - - no - - - - TOUCH_TOUCH - - - - - - TOUCH_IDLE - - - - TOUCH_TOUCH - - - - - - TOUCH_DEAD - - - - - - - - TOUCH_IDLE - - - - - - TOUCH_TOUCH - - - - TOUCH_TOUCH - - - - TOUCH_IDLE - - - - - - TOUCH_IDLE - - - - - - TOUCH_TOUCH - - - - - - TOUCH_IDLE - - - - - - TOUCH_TOUCH - - - - - - that finger - TOUCH_IDLE + + + yes + + + + + TOUCH_DEAD + + + + + + + + + + + TOUCH_IDLE + + + + + + + TOUCH_TOUCH + + + + + + + + + TOUCH_IDLE + + + + + + + TOUCH_IDLE + + + + + + + TOUCH_IDLE + + + + + + + TOUCH_TOUCH + + + + + + + that finger + + TOUCH_IDLE + + + + + + + TOUCH_DEAD + + + + + + + + + + + that finger + + TOUCH_IDLE + + + + + + + + + no - - - + - TOUCH_DEAD + + TOUCH_TOUCH - - - + + + - TOUCH_DEAD + + TOUCH_IDLE - + - TOUCH_DEAD + + TOUCH_TOUCH - + + + - TOUCH_DEAD + + TOUCH_DEAD - - - + + + + + - TOUCH_DEAD + + TOUCH_IDLE - - - + + + - TOUCH_DEAD + + TOUCH_TOUCH - - - + - that finger state == - TOUCH_TOUCH + + TOUCH_TOUCH - + + + - TOUCH_DEAD + + TOUCH_IDLE - - - + + + - TOUCH_DEAD + + TOUCH_IDLE - + + + - TOUCH_DEAD + + TOUCH_TOUCH - + + + - first - finger down + + TOUCH_IDLE - + + + - MULTITAP + + TOUCH_TOUCH - - - - - + + + - timeout + + that finger + + TOUCH_IDLE - - - - - + + + - IDLE + + TOUCH_DEAD - - - - - - - + + + - MULTITAP_DOWN + + TOUCH_DEAD - + - first - finger up + + TOUCH_DEAD - - - - - + - timeout + + TOUCH_DEAD - - - + + + - second - finger down + + TOUCH_DEAD - + + + - move > - threshold + + TOUCH_DEAD - - - - - - - - - + + + - TOUCH_TOUCH + + state == + + TOUCH_TOUCH - - - + - TOUCH_IDLE + + that finger state == + + TOUCH_TOUCH - + + + + + + no + + + + + TOUCH_DEAD + + + + + + + TOUCH_DEAD + + + + + TOUCH_DEAD + + + + + first + + finger down + + + + + MULTITAP + + + + + + + + + timeout + + + + + + + + + IDLE + + + + + + + + + + + MULTITAP_DOWN + + + + + button 1 + + press + + + + + + + + + first + + finger up + + + + + + + button 1 + + release + + + + + + + timeout + + + + + second + + finger down + + + + + move > + + threshold + + + + + + + + + + + button 1 + + release + + + + + button 1 + + press + + + + + + + + + + + button 1 + + release + + + + + button 1 + + press + + + + + + + + + + + button 1 + + release + + + + + button 1 + + press + + + + + + + + + + + + + TOUCH_TOUCH + + + + + + + TOUCH_IDLE + + + + - phys - button - press - - - - - - - - - - DRAGGING_OR_TAP - - - - first - finger up - - - - - - timeout - - - - - - - - move > - threshold - - - - - - - - - - - - - - TOUCH_IDLE - - - - - - - - - + + phys + + button + + press + + + + + + + + + + + DRAGGING_OR_TAP + + + + + first + + finger up + + + + + + + timeout + + + + + + + + + move > + + threshold + + + + + + + + + + + + + + + TOUCH_IDLE + + + + + + + + + - -
-
drag lock
enabled?
-
-
- [Not supported by viewer] + +
+
+ drag lock
+ enabled?
+
+
+
+ + [Not supported by viewer]
- - - + + + - -
-
no
-
-
- no + +
+
+ no
+
+
+ + [Not supported by viewer]
- - - + + + - -
-
yes
-
-
- yes<br> + +
+
+ yes
+
+
+
+ + [Not supported by viewer]
- - - thumb - - - - - - TOUCH_DEAD - - - - - - - - - - TOUCH_2_RELEASE - - - - second - finger up - - - - - - timeout - - - - - - move > - threshold - - - - - - - - - - - - first - finger down - - - - - - + - TOUCH_IDLE - - - - - - first - finger up - - - - - - - - second - finger down - - - - - - TOUCH_DEAD - - - - TOUCH_DEAD - - - - - - - - - - - - - -
-
drag
disabled?
-
-
- drag<br>disabled?<br> -
-
- - - - - -
-
no
-
-
- no -
-
- - - - - -
-
yes
-
-
- yes -
-
- - - palm - - - - - - either finger - palm - - - - - - remaining -  finger - palm - - - - - - any finger - palm - - - - - - - - that finger - TOUCH_DEAD - - - - - - that finger - TOUCH_DEAD - - - - - - - - - - palm - - - - - - - - - - any finger - palm - - - - - - that finger - TOUCH_DEAD - - - - - - - - TOUCH_DEAD - - - - - - - - palm - - - - TOUCH_DEAD - - - - - - - - - - any finger - palm - - - - - - - - that finger - TOUCH_DEAD - - - - - - either finger - palm - - - - - - that finger - TOUCH_DEAD - - - - - - - - palm - - - - - - - - TOUCH_DEAD - - - - - - - - any finger - palm - - - - - - that finger - TOUCH_DEAD - - - - - - - - - - - - palm - - - - - - - - - - - - - - - - button 1 - press - - - - - - TOUCH_DEAD - - - - - - btn1 - release - - - - - - - - - - MULTITAP_PALM - - - - - - first - finger down - - - - - - TOUCH_TOUCH - - - - - - timeout - - - - - - phys - button - press + + thumb + + + + + + TOUCH_DEAD + + + + + + +
diff -Nru libinput-1.10.3/doc/trackpoints.dox libinput-0.21.0/doc/trackpoints.dox --- libinput-1.10.3/doc/trackpoints.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/trackpoints.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,153 +0,0 @@ -/** -@page trackpoints Trackpoints and Pointing Sticks - -This page provides an overview of trackpoint handling in libinput, also -refered to as Pointing Stick or Trackstick. The device itself is usually a -round plastic stick between the G, H and B keys with a set of buttons below -the space bar. - -@image html button-scrolling.svg "A trackpoint" - -libinput always treats the buttons below the space bar as the buttons that -belong to the trackpoint even on the few laptops where the buttons are not -physically wired to the trackpoint device anyway, see @ref t440_support. - -Trackpoint devices have @ref button_scrolling enabled by default. This may -interfer with middle-button dragging, if middle-button dragging is required -by a user then button scrolling must be disabled. - -@section trackpoint_range Motion range on trackpoints - -It is difficult to associate motion on a trackpoint with a physical -reference. Unlike mice or touchpads where the motion can be -measured in mm, the trackpoint only responds to pressure. Without special -equipment it is impossible to measure identical pressure values across -multiple laptops. - -The values provided by a trackpoint are motion deltas, usually corresponding -to the pressure applied to the trackstick. For example, pressure towards the -screen on a laptop provides negative y deltas at a fixed rate (e.g. every -10ms). As the pressure increases, the delta increases too. As the pressure -decreases, the delta decreases until it hits the neutral state. - -The delta range itself can vary greatly between laptops, some devices send a -maximum delta value of 30, others can go beyond 100. To normalize the motion -trackpoint, libinput uses the available delta range and fits its -acceleration curve into this range. This requires calibration by the user, -see @ref trackpoint_range_measure. - -@section trackpoint_range_measure Measuring the trackpoint range - -This section describes how to measure the trackpoint range and apply a hwdb -entry to make this range known to libinput. libinput provides the tool -`libinput measure trackpoint-range` for this task. This is an interactive -tool and prints its instructions on the commandline. Example output from -this tool is below: - -@code -$ sudo libinput measure trackpoint-range -This tool measures the commonly used pressure range of the -trackpoint. Push the trackpoint: -- Four times around the screen edges -- From the top left to the bottom right and back, twice -- From the top right to the bottom left and back, twice -A minimum of 1000 events for each axis is required - -Movements should emulate fast pointer movement on the screen -but not use excessive pressure that would not be used -during day-to-day movement. For best results, run this tool -several times to get an idea of the common range. - -Trackpoint sends: max x: 19, max y: 23 samples [121, 121] -@endcode - -Once sufficient samples have been collected, the tool prints a simplified -histogram for x and y axis deltas. This histogram should be used to -estimate the appropriate trackpoint range. For example, let's look at -the histogram below: - -@code -Histogram for x axis deltas, in counts of 5 - -30: - -29: - -28: + - -27: + - -26: ++ - -25: ++++ - -24: +++++ - -23: ++ - -22: ++++++ - -21: +++ - -20: ++++ - -19: +++++++ - -18: ++++++++++++ - -17: ++++++++++++ - -16: ++++++++++++ - -15: ++++ - -14: +++++ - -13: +++++ - -12: ++++++ - -11: +++++ - -10: +++ - -9: ++++ - -8: +++++++ - -7: +++++++ - -6: ++++++++++++ - -5: ++++++++++++ - -4: ++++++++++++ - -3: +++++++++ - -2: +++++++++ - -1: ++++++++ - 0: +++++++ - 1: +++++ - 2: +++++ - 3: ++++++ - 4: ++++++ - 5: +++++++ - 6: ++++ - 7: ++ - 8: +++ - 9: +++ - 10: +++ - 11: +++ - 12: +++ - 13: ++++ - 14: ++++++ - 15: ++++ - 16: ++++ - 17: ++++ - 18: ++++++ - 19: +++++++ - 20: ++++ - 21: ++++++ - 22: ++++++ - 23: ++++++ - 24: ++++++ - 25: +++++++++ - 26: +++++++ - 27: ++++++++ - 28: +++++ - 29: ++ - 30: ++ - 31: + - 32: - 33: - 34: -@endcode - -The 0 delta is the neutral state, each + represents 5 events with that -delta value. Note how the curve is distributed, it's not a classic bell -curve. That can be a factor of the input provided or the firmware-based -pointer acceleration. - -Overall, the majority of events appear to be in the 0-25 range with a few -outliers. So the trackpoint range libinput should use for this particular -device would be 25. Note how there is a fair bit of guesswork involved, a -trackpoint's data is never clean enough to get a definitive value. It is -generally better to take a (slightly) smaller range than one too large. - -The udev property to set is `LIBINPUT_ATTR_TRACKPOINT_RANGE=25`. See @ref -hwdb_modifying for details on how to apply this property. - -*/ - diff -Nru libinput-1.10.3/doc/what-is-libinput.dox libinput-0.21.0/doc/what-is-libinput.dox --- libinput-1.10.3/doc/what-is-libinput.dox 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/doc/what-is-libinput.dox 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -/** - -@page what_is_libinput What is libinput? - -This page describes what libinput is, but more importantly it also describes -what libinput is **not**. - -libinput is an input stack to be used by those applications that need full -input device processing by commonly used input devices. That includes mice, -keyboards, touchpads, touchscreens and graphics tablets. libinput handles -device-specific quirks and provides an easy-to-use interface to receive -events from devices. - -libinput is designed to handle all input devices available on a system. It -is possible to limit the devices that employ libinput. For example, the use -of xf86-input-libinput depends on xorg.conf snippets for specific -devices. But libinput works best if it handles all input devices as this -allows for cross-device monitoring of events and smarter handling of -features that affect multiple devices. - -libinput restricts device-specific features to applicable devices only. -Devices with specific hardware properties may expose extra features, but -these features are not made available on other devices, even where it may be -possible to do so. One example for this are the top software buttons on the -touchpad in the Lenovo T440 and similar devices. While there may be -use-cases for providing top software buttons on other devices, libinput does -not do so. - -libinput is **not** a project to support experimental devices. Unless a -device is commonly available off-the-shelf, libinput will not support this -device. libinput can serve as a useful base for getting experimental devices -enabled and reduce the amount of boilerplate required. But such support will -not land in libinput master until the devices are commonly available. - -libinput is **not** a box of legos. It does not provide the pieces to -assemble a selection of features. Many features can be disabled through -configuration options, but some features are hardcoded or hardcoded on some -devices. This usually matches the intended use of the device. There are -plenty of use-cases to provide out-of-the-ordinary features, but libinput is -not the place to support these. - -libinput is **not** a showcase for features. There are a lot of potential -features that could be provided on input devices. But unless they have -common usage, libinput is not the place to implement them. Every feature -multiplies the maintenance effort, any feature that is provided but unused -is a net drain on the already sparse developer resources libinput has -available. - -libinput is boring. It does not intend to break new grounds on how devices -are handled. Instead, it takes best practice and the common use-cases and -provides it in an easy-to-consume package for compositors or other processes -that need those interactions typically expected by users. - -*/ diff -Nru libinput-1.10.3/include/linux/input-event-codes.h libinput-0.21.0/include/linux/input-event-codes.h --- libinput-1.10.3/include/linux/input-event-codes.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/include/linux/input-event-codes.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,838 +0,0 @@ -/* - * Input event codes - * - * *** IMPORTANT *** - * This file is not only included from C-code but also from devicetree source - * files. As such this file MUST only contain comments and defines. - * - * Copyright (c) 1999-2002 Vojtech Pavlik - * Copyright (c) 2015 Hans de Goede - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - */ -#ifndef _UAPI_INPUT_EVENT_CODES_H -#define _UAPI_INPUT_EVENT_CODES_H - -/* - * Device properties and quirks - */ - -#define INPUT_PROP_POINTER 0x00 /* needs a pointer */ -#define INPUT_PROP_DIRECT 0x01 /* direct input devices */ -#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ -#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ -#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ -#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */ -#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */ - -#define INPUT_PROP_MAX 0x1f -#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) - -/* - * Event types - */ - -#define EV_SYN 0x00 -#define EV_KEY 0x01 -#define EV_REL 0x02 -#define EV_ABS 0x03 -#define EV_MSC 0x04 -#define EV_SW 0x05 -#define EV_LED 0x11 -#define EV_SND 0x12 -#define EV_REP 0x14 -#define EV_FF 0x15 -#define EV_PWR 0x16 -#define EV_FF_STATUS 0x17 -#define EV_MAX 0x1f -#define EV_CNT (EV_MAX+1) - -/* - * Synchronization events. - */ - -#define SYN_REPORT 0 -#define SYN_CONFIG 1 -#define SYN_MT_REPORT 2 -#define SYN_DROPPED 3 -#define SYN_MAX 0xf -#define SYN_CNT (SYN_MAX+1) - -/* - * Keys and buttons - * - * Most of the keys/buttons are modeled after USB HUT 1.12 - * (see http://www.usb.org/developers/hidpage). - * Abbreviations in the comments: - * AC - Application Control - * AL - Application Launch Button - * SC - System Control - */ - -#define KEY_RESERVED 0 -#define KEY_ESC 1 -#define KEY_1 2 -#define KEY_2 3 -#define KEY_3 4 -#define KEY_4 5 -#define KEY_5 6 -#define KEY_6 7 -#define KEY_7 8 -#define KEY_8 9 -#define KEY_9 10 -#define KEY_0 11 -#define KEY_MINUS 12 -#define KEY_EQUAL 13 -#define KEY_BACKSPACE 14 -#define KEY_TAB 15 -#define KEY_Q 16 -#define KEY_W 17 -#define KEY_E 18 -#define KEY_R 19 -#define KEY_T 20 -#define KEY_Y 21 -#define KEY_U 22 -#define KEY_I 23 -#define KEY_O 24 -#define KEY_P 25 -#define KEY_LEFTBRACE 26 -#define KEY_RIGHTBRACE 27 -#define KEY_ENTER 28 -#define KEY_LEFTCTRL 29 -#define KEY_A 30 -#define KEY_S 31 -#define KEY_D 32 -#define KEY_F 33 -#define KEY_G 34 -#define KEY_H 35 -#define KEY_J 36 -#define KEY_K 37 -#define KEY_L 38 -#define KEY_SEMICOLON 39 -#define KEY_APOSTROPHE 40 -#define KEY_GRAVE 41 -#define KEY_LEFTSHIFT 42 -#define KEY_BACKSLASH 43 -#define KEY_Z 44 -#define KEY_X 45 -#define KEY_C 46 -#define KEY_V 47 -#define KEY_B 48 -#define KEY_N 49 -#define KEY_M 50 -#define KEY_COMMA 51 -#define KEY_DOT 52 -#define KEY_SLASH 53 -#define KEY_RIGHTSHIFT 54 -#define KEY_KPASTERISK 55 -#define KEY_LEFTALT 56 -#define KEY_SPACE 57 -#define KEY_CAPSLOCK 58 -#define KEY_F1 59 -#define KEY_F2 60 -#define KEY_F3 61 -#define KEY_F4 62 -#define KEY_F5 63 -#define KEY_F6 64 -#define KEY_F7 65 -#define KEY_F8 66 -#define KEY_F9 67 -#define KEY_F10 68 -#define KEY_NUMLOCK 69 -#define KEY_SCROLLLOCK 70 -#define KEY_KP7 71 -#define KEY_KP8 72 -#define KEY_KP9 73 -#define KEY_KPMINUS 74 -#define KEY_KP4 75 -#define KEY_KP5 76 -#define KEY_KP6 77 -#define KEY_KPPLUS 78 -#define KEY_KP1 79 -#define KEY_KP2 80 -#define KEY_KP3 81 -#define KEY_KP0 82 -#define KEY_KPDOT 83 - -#define KEY_ZENKAKUHANKAKU 85 -#define KEY_102ND 86 -#define KEY_F11 87 -#define KEY_F12 88 -#define KEY_RO 89 -#define KEY_KATAKANA 90 -#define KEY_HIRAGANA 91 -#define KEY_HENKAN 92 -#define KEY_KATAKANAHIRAGANA 93 -#define KEY_MUHENKAN 94 -#define KEY_KPJPCOMMA 95 -#define KEY_KPENTER 96 -#define KEY_RIGHTCTRL 97 -#define KEY_KPSLASH 98 -#define KEY_SYSRQ 99 -#define KEY_RIGHTALT 100 -#define KEY_LINEFEED 101 -#define KEY_HOME 102 -#define KEY_UP 103 -#define KEY_PAGEUP 104 -#define KEY_LEFT 105 -#define KEY_RIGHT 106 -#define KEY_END 107 -#define KEY_DOWN 108 -#define KEY_PAGEDOWN 109 -#define KEY_INSERT 110 -#define KEY_DELETE 111 -#define KEY_MACRO 112 -#define KEY_MUTE 113 -#define KEY_VOLUMEDOWN 114 -#define KEY_VOLUMEUP 115 -#define KEY_POWER 116 /* SC System Power Down */ -#define KEY_KPEQUAL 117 -#define KEY_KPPLUSMINUS 118 -#define KEY_PAUSE 119 -#define KEY_SCALE 120 /* AL Compiz Scale (Expose) */ - -#define KEY_KPCOMMA 121 -#define KEY_HANGEUL 122 -#define KEY_HANGUEL KEY_HANGEUL -#define KEY_HANJA 123 -#define KEY_YEN 124 -#define KEY_LEFTMETA 125 -#define KEY_RIGHTMETA 126 -#define KEY_COMPOSE 127 - -#define KEY_STOP 128 /* AC Stop */ -#define KEY_AGAIN 129 -#define KEY_PROPS 130 /* AC Properties */ -#define KEY_UNDO 131 /* AC Undo */ -#define KEY_FRONT 132 -#define KEY_COPY 133 /* AC Copy */ -#define KEY_OPEN 134 /* AC Open */ -#define KEY_PASTE 135 /* AC Paste */ -#define KEY_FIND 136 /* AC Search */ -#define KEY_CUT 137 /* AC Cut */ -#define KEY_HELP 138 /* AL Integrated Help Center */ -#define KEY_MENU 139 /* Menu (show menu) */ -#define KEY_CALC 140 /* AL Calculator */ -#define KEY_SETUP 141 -#define KEY_SLEEP 142 /* SC System Sleep */ -#define KEY_WAKEUP 143 /* System Wake Up */ -#define KEY_FILE 144 /* AL Local Machine Browser */ -#define KEY_SENDFILE 145 -#define KEY_DELETEFILE 146 -#define KEY_XFER 147 -#define KEY_PROG1 148 -#define KEY_PROG2 149 -#define KEY_WWW 150 /* AL Internet Browser */ -#define KEY_MSDOS 151 -#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */ -#define KEY_SCREENLOCK KEY_COFFEE -#define KEY_ROTATE_DISPLAY 153 /* Display orientation for e.g. tablets */ -#define KEY_DIRECTION KEY_ROTATE_DISPLAY -#define KEY_CYCLEWINDOWS 154 -#define KEY_MAIL 155 -#define KEY_BOOKMARKS 156 /* AC Bookmarks */ -#define KEY_COMPUTER 157 -#define KEY_BACK 158 /* AC Back */ -#define KEY_FORWARD 159 /* AC Forward */ -#define KEY_CLOSECD 160 -#define KEY_EJECTCD 161 -#define KEY_EJECTCLOSECD 162 -#define KEY_NEXTSONG 163 -#define KEY_PLAYPAUSE 164 -#define KEY_PREVIOUSSONG 165 -#define KEY_STOPCD 166 -#define KEY_RECORD 167 -#define KEY_REWIND 168 -#define KEY_PHONE 169 /* Media Select Telephone */ -#define KEY_ISO 170 -#define KEY_CONFIG 171 /* AL Consumer Control Configuration */ -#define KEY_HOMEPAGE 172 /* AC Home */ -#define KEY_REFRESH 173 /* AC Refresh */ -#define KEY_EXIT 174 /* AC Exit */ -#define KEY_MOVE 175 -#define KEY_EDIT 176 -#define KEY_SCROLLUP 177 -#define KEY_SCROLLDOWN 178 -#define KEY_KPLEFTPAREN 179 -#define KEY_KPRIGHTPAREN 180 -#define KEY_NEW 181 /* AC New */ -#define KEY_REDO 182 /* AC Redo/Repeat */ - -#define KEY_F13 183 -#define KEY_F14 184 -#define KEY_F15 185 -#define KEY_F16 186 -#define KEY_F17 187 -#define KEY_F18 188 -#define KEY_F19 189 -#define KEY_F20 190 -#define KEY_F21 191 -#define KEY_F22 192 -#define KEY_F23 193 -#define KEY_F24 194 - -#define KEY_PLAYCD 200 -#define KEY_PAUSECD 201 -#define KEY_PROG3 202 -#define KEY_PROG4 203 -#define KEY_DASHBOARD 204 /* AL Dashboard */ -#define KEY_SUSPEND 205 -#define KEY_CLOSE 206 /* AC Close */ -#define KEY_PLAY 207 -#define KEY_FASTFORWARD 208 -#define KEY_BASSBOOST 209 -#define KEY_PRINT 210 /* AC Print */ -#define KEY_HP 211 -#define KEY_CAMERA 212 -#define KEY_SOUND 213 -#define KEY_QUESTION 214 -#define KEY_EMAIL 215 -#define KEY_CHAT 216 -#define KEY_SEARCH 217 -#define KEY_CONNECT 218 -#define KEY_FINANCE 219 /* AL Checkbook/Finance */ -#define KEY_SPORT 220 -#define KEY_SHOP 221 -#define KEY_ALTERASE 222 -#define KEY_CANCEL 223 /* AC Cancel */ -#define KEY_BRIGHTNESSDOWN 224 -#define KEY_BRIGHTNESSUP 225 -#define KEY_MEDIA 226 - -#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video - outputs (Monitor/LCD/TV-out/etc) */ -#define KEY_KBDILLUMTOGGLE 228 -#define KEY_KBDILLUMDOWN 229 -#define KEY_KBDILLUMUP 230 - -#define KEY_SEND 231 /* AC Send */ -#define KEY_REPLY 232 /* AC Reply */ -#define KEY_FORWARDMAIL 233 /* AC Forward Msg */ -#define KEY_SAVE 234 /* AC Save */ -#define KEY_DOCUMENTS 235 - -#define KEY_BATTERY 236 - -#define KEY_BLUETOOTH 237 -#define KEY_WLAN 238 -#define KEY_UWB 239 - -#define KEY_UNKNOWN 240 - -#define KEY_VIDEO_NEXT 241 /* drive next video source */ -#define KEY_VIDEO_PREV 242 /* drive previous video source */ -#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */ -#define KEY_BRIGHTNESS_AUTO 244 /* Set Auto Brightness: manual - brightness control is off, - rely on ambient */ -#define KEY_BRIGHTNESS_ZERO KEY_BRIGHTNESS_AUTO -#define KEY_DISPLAY_OFF 245 /* display device to off state */ - -#define KEY_WWAN 246 /* Wireless WAN (LTE, UMTS, GSM, etc.) */ -#define KEY_WIMAX KEY_WWAN -#define KEY_RFKILL 247 /* Key that controls all radios */ - -#define KEY_MICMUTE 248 /* Mute / unmute the microphone */ - -/* Code 255 is reserved for special needs of AT keyboard driver */ - -#define BTN_MISC 0x100 -#define BTN_0 0x100 -#define BTN_1 0x101 -#define BTN_2 0x102 -#define BTN_3 0x103 -#define BTN_4 0x104 -#define BTN_5 0x105 -#define BTN_6 0x106 -#define BTN_7 0x107 -#define BTN_8 0x108 -#define BTN_9 0x109 - -#define BTN_MOUSE 0x110 -#define BTN_LEFT 0x110 -#define BTN_RIGHT 0x111 -#define BTN_MIDDLE 0x112 -#define BTN_SIDE 0x113 -#define BTN_EXTRA 0x114 -#define BTN_FORWARD 0x115 -#define BTN_BACK 0x116 -#define BTN_TASK 0x117 - -#define BTN_JOYSTICK 0x120 -#define BTN_TRIGGER 0x120 -#define BTN_THUMB 0x121 -#define BTN_THUMB2 0x122 -#define BTN_TOP 0x123 -#define BTN_TOP2 0x124 -#define BTN_PINKIE 0x125 -#define BTN_BASE 0x126 -#define BTN_BASE2 0x127 -#define BTN_BASE3 0x128 -#define BTN_BASE4 0x129 -#define BTN_BASE5 0x12a -#define BTN_BASE6 0x12b -#define BTN_DEAD 0x12f - -#define BTN_GAMEPAD 0x130 -#define BTN_SOUTH 0x130 -#define BTN_A BTN_SOUTH -#define BTN_EAST 0x131 -#define BTN_B BTN_EAST -#define BTN_C 0x132 -#define BTN_NORTH 0x133 -#define BTN_X BTN_NORTH -#define BTN_WEST 0x134 -#define BTN_Y BTN_WEST -#define BTN_Z 0x135 -#define BTN_TL 0x136 -#define BTN_TR 0x137 -#define BTN_TL2 0x138 -#define BTN_TR2 0x139 -#define BTN_SELECT 0x13a -#define BTN_START 0x13b -#define BTN_MODE 0x13c -#define BTN_THUMBL 0x13d -#define BTN_THUMBR 0x13e - -#define BTN_DIGI 0x140 -#define BTN_TOOL_PEN 0x140 -#define BTN_TOOL_RUBBER 0x141 -#define BTN_TOOL_BRUSH 0x142 -#define BTN_TOOL_PENCIL 0x143 -#define BTN_TOOL_AIRBRUSH 0x144 -#define BTN_TOOL_FINGER 0x145 -#define BTN_TOOL_MOUSE 0x146 -#define BTN_TOOL_LENS 0x147 -#define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */ -#define BTN_TOUCH 0x14a -#define BTN_STYLUS 0x14b -#define BTN_STYLUS2 0x14c -#define BTN_TOOL_DOUBLETAP 0x14d -#define BTN_TOOL_TRIPLETAP 0x14e -#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ - -#define BTN_WHEEL 0x150 -#define BTN_GEAR_DOWN 0x150 -#define BTN_GEAR_UP 0x151 - -#define KEY_OK 0x160 -#define KEY_SELECT 0x161 -#define KEY_GOTO 0x162 -#define KEY_CLEAR 0x163 -#define KEY_POWER2 0x164 -#define KEY_OPTION 0x165 -#define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */ -#define KEY_TIME 0x167 -#define KEY_VENDOR 0x168 -#define KEY_ARCHIVE 0x169 -#define KEY_PROGRAM 0x16a /* Media Select Program Guide */ -#define KEY_CHANNEL 0x16b -#define KEY_FAVORITES 0x16c -#define KEY_EPG 0x16d -#define KEY_PVR 0x16e /* Media Select Home */ -#define KEY_MHP 0x16f -#define KEY_LANGUAGE 0x170 -#define KEY_TITLE 0x171 -#define KEY_SUBTITLE 0x172 -#define KEY_ANGLE 0x173 -#define KEY_ZOOM 0x174 -#define KEY_MODE 0x175 -#define KEY_KEYBOARD 0x176 -#define KEY_SCREEN 0x177 -#define KEY_PC 0x178 /* Media Select Computer */ -#define KEY_TV 0x179 /* Media Select TV */ -#define KEY_TV2 0x17a /* Media Select Cable */ -#define KEY_VCR 0x17b /* Media Select VCR */ -#define KEY_VCR2 0x17c /* VCR Plus */ -#define KEY_SAT 0x17d /* Media Select Satellite */ -#define KEY_SAT2 0x17e -#define KEY_CD 0x17f /* Media Select CD */ -#define KEY_TAPE 0x180 /* Media Select Tape */ -#define KEY_RADIO 0x181 -#define KEY_TUNER 0x182 /* Media Select Tuner */ -#define KEY_PLAYER 0x183 -#define KEY_TEXT 0x184 -#define KEY_DVD 0x185 /* Media Select DVD */ -#define KEY_AUX 0x186 -#define KEY_MP3 0x187 -#define KEY_AUDIO 0x188 /* AL Audio Browser */ -#define KEY_VIDEO 0x189 /* AL Movie Browser */ -#define KEY_DIRECTORY 0x18a -#define KEY_LIST 0x18b -#define KEY_MEMO 0x18c /* Media Select Messages */ -#define KEY_CALENDAR 0x18d -#define KEY_RED 0x18e -#define KEY_GREEN 0x18f -#define KEY_YELLOW 0x190 -#define KEY_BLUE 0x191 -#define KEY_CHANNELUP 0x192 /* Channel Increment */ -#define KEY_CHANNELDOWN 0x193 /* Channel Decrement */ -#define KEY_FIRST 0x194 -#define KEY_LAST 0x195 /* Recall Last */ -#define KEY_AB 0x196 -#define KEY_NEXT 0x197 -#define KEY_RESTART 0x198 -#define KEY_SLOW 0x199 -#define KEY_SHUFFLE 0x19a -#define KEY_BREAK 0x19b -#define KEY_PREVIOUS 0x19c -#define KEY_DIGITS 0x19d -#define KEY_TEEN 0x19e -#define KEY_TWEN 0x19f -#define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */ -#define KEY_GAMES 0x1a1 /* Media Select Games */ -#define KEY_ZOOMIN 0x1a2 /* AC Zoom In */ -#define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */ -#define KEY_ZOOMRESET 0x1a4 /* AC Zoom */ -#define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */ -#define KEY_EDITOR 0x1a6 /* AL Text Editor */ -#define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */ -#define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */ -#define KEY_PRESENTATION 0x1a9 /* AL Presentation App */ -#define KEY_DATABASE 0x1aa /* AL Database App */ -#define KEY_NEWS 0x1ab /* AL Newsreader */ -#define KEY_VOICEMAIL 0x1ac /* AL Voicemail */ -#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */ -#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */ -#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */ -#define KEY_BRIGHTNESS_TOGGLE KEY_DISPLAYTOGGLE -#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */ -#define KEY_LOGOFF 0x1b1 /* AL Logoff */ - -#define KEY_DOLLAR 0x1b2 -#define KEY_EURO 0x1b3 - -#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */ -#define KEY_FRAMEFORWARD 0x1b5 -#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ -#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ -#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */ -#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */ -#define KEY_IMAGES 0x1ba /* AL Image Browser */ - -#define KEY_DEL_EOL 0x1c0 -#define KEY_DEL_EOS 0x1c1 -#define KEY_INS_LINE 0x1c2 -#define KEY_DEL_LINE 0x1c3 - -#define KEY_FN 0x1d0 -#define KEY_FN_ESC 0x1d1 -#define KEY_FN_F1 0x1d2 -#define KEY_FN_F2 0x1d3 -#define KEY_FN_F3 0x1d4 -#define KEY_FN_F4 0x1d5 -#define KEY_FN_F5 0x1d6 -#define KEY_FN_F6 0x1d7 -#define KEY_FN_F7 0x1d8 -#define KEY_FN_F8 0x1d9 -#define KEY_FN_F9 0x1da -#define KEY_FN_F10 0x1db -#define KEY_FN_F11 0x1dc -#define KEY_FN_F12 0x1dd -#define KEY_FN_1 0x1de -#define KEY_FN_2 0x1df -#define KEY_FN_D 0x1e0 -#define KEY_FN_E 0x1e1 -#define KEY_FN_F 0x1e2 -#define KEY_FN_S 0x1e3 -#define KEY_FN_B 0x1e4 - -#define KEY_BRL_DOT1 0x1f1 -#define KEY_BRL_DOT2 0x1f2 -#define KEY_BRL_DOT3 0x1f3 -#define KEY_BRL_DOT4 0x1f4 -#define KEY_BRL_DOT5 0x1f5 -#define KEY_BRL_DOT6 0x1f6 -#define KEY_BRL_DOT7 0x1f7 -#define KEY_BRL_DOT8 0x1f8 -#define KEY_BRL_DOT9 0x1f9 -#define KEY_BRL_DOT10 0x1fa - -#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */ -#define KEY_NUMERIC_1 0x201 /* and other keypads */ -#define KEY_NUMERIC_2 0x202 -#define KEY_NUMERIC_3 0x203 -#define KEY_NUMERIC_4 0x204 -#define KEY_NUMERIC_5 0x205 -#define KEY_NUMERIC_6 0x206 -#define KEY_NUMERIC_7 0x207 -#define KEY_NUMERIC_8 0x208 -#define KEY_NUMERIC_9 0x209 -#define KEY_NUMERIC_STAR 0x20a -#define KEY_NUMERIC_POUND 0x20b -#define KEY_NUMERIC_A 0x20c /* Phone key A - HUT Telephony 0xb9 */ -#define KEY_NUMERIC_B 0x20d -#define KEY_NUMERIC_C 0x20e -#define KEY_NUMERIC_D 0x20f - -#define KEY_CAMERA_FOCUS 0x210 -#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ - -#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */ -#define KEY_TOUCHPAD_ON 0x213 -#define KEY_TOUCHPAD_OFF 0x214 - -#define KEY_CAMERA_ZOOMIN 0x215 -#define KEY_CAMERA_ZOOMOUT 0x216 -#define KEY_CAMERA_UP 0x217 -#define KEY_CAMERA_DOWN 0x218 -#define KEY_CAMERA_LEFT 0x219 -#define KEY_CAMERA_RIGHT 0x21a - -#define KEY_ATTENDANT_ON 0x21b -#define KEY_ATTENDANT_OFF 0x21c -#define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */ -#define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */ - -#define BTN_DPAD_UP 0x220 -#define BTN_DPAD_DOWN 0x221 -#define BTN_DPAD_LEFT 0x222 -#define BTN_DPAD_RIGHT 0x223 - -#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */ - -#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */ -#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */ -#define KEY_JOURNAL 0x242 /* AL Log/Journal/Timecard */ -#define KEY_CONTROLPANEL 0x243 /* AL Control Panel */ -#define KEY_APPSELECT 0x244 /* AL Select Task/Application */ -#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */ -#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */ - -#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ -#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ - -#define KEY_KBDINPUTASSIST_PREV 0x260 -#define KEY_KBDINPUTASSIST_NEXT 0x261 -#define KEY_KBDINPUTASSIST_PREVGROUP 0x262 -#define KEY_KBDINPUTASSIST_NEXTGROUP 0x263 -#define KEY_KBDINPUTASSIST_ACCEPT 0x264 -#define KEY_KBDINPUTASSIST_CANCEL 0x265 - -/* Diagonal movement keys */ -#define KEY_RIGHT_UP 0x266 -#define KEY_RIGHT_DOWN 0x267 -#define KEY_LEFT_UP 0x268 -#define KEY_LEFT_DOWN 0x269 - -#define KEY_ROOT_MENU 0x26a /* Show Device's Root Menu */ -/* Show Top Menu of the Media (e.g. DVD) */ -#define KEY_MEDIA_TOP_MENU 0x26b -#define KEY_NUMERIC_11 0x26c -#define KEY_NUMERIC_12 0x26d -/* - * Toggle Audio Description: refers to an audio service that helps blind and - * visually impaired consumers understand the action in a program. Note: in - * some countries this is referred to as "Video Description". - */ -#define KEY_AUDIO_DESC 0x26e -#define KEY_3D_MODE 0x26f -#define KEY_NEXT_FAVORITE 0x270 -#define KEY_STOP_RECORD 0x271 -#define KEY_PAUSE_RECORD 0x272 -#define KEY_VOD 0x273 /* Video on Demand */ -#define KEY_UNMUTE 0x274 -#define KEY_FASTREVERSE 0x275 -#define KEY_SLOWREVERSE 0x276 -/* - * Control a data application associated with the currently viewed channel, - * e.g. teletext or data broadcast application (MHEG, MHP, HbbTV, etc.) - */ -#define KEY_DATA 0x277 -#define KEY_ONSCREEN_KEYBOARD 0x278 - -#define BTN_TRIGGER_HAPPY 0x2c0 -#define BTN_TRIGGER_HAPPY1 0x2c0 -#define BTN_TRIGGER_HAPPY2 0x2c1 -#define BTN_TRIGGER_HAPPY3 0x2c2 -#define BTN_TRIGGER_HAPPY4 0x2c3 -#define BTN_TRIGGER_HAPPY5 0x2c4 -#define BTN_TRIGGER_HAPPY6 0x2c5 -#define BTN_TRIGGER_HAPPY7 0x2c6 -#define BTN_TRIGGER_HAPPY8 0x2c7 -#define BTN_TRIGGER_HAPPY9 0x2c8 -#define BTN_TRIGGER_HAPPY10 0x2c9 -#define BTN_TRIGGER_HAPPY11 0x2ca -#define BTN_TRIGGER_HAPPY12 0x2cb -#define BTN_TRIGGER_HAPPY13 0x2cc -#define BTN_TRIGGER_HAPPY14 0x2cd -#define BTN_TRIGGER_HAPPY15 0x2ce -#define BTN_TRIGGER_HAPPY16 0x2cf -#define BTN_TRIGGER_HAPPY17 0x2d0 -#define BTN_TRIGGER_HAPPY18 0x2d1 -#define BTN_TRIGGER_HAPPY19 0x2d2 -#define BTN_TRIGGER_HAPPY20 0x2d3 -#define BTN_TRIGGER_HAPPY21 0x2d4 -#define BTN_TRIGGER_HAPPY22 0x2d5 -#define BTN_TRIGGER_HAPPY23 0x2d6 -#define BTN_TRIGGER_HAPPY24 0x2d7 -#define BTN_TRIGGER_HAPPY25 0x2d8 -#define BTN_TRIGGER_HAPPY26 0x2d9 -#define BTN_TRIGGER_HAPPY27 0x2da -#define BTN_TRIGGER_HAPPY28 0x2db -#define BTN_TRIGGER_HAPPY29 0x2dc -#define BTN_TRIGGER_HAPPY30 0x2dd -#define BTN_TRIGGER_HAPPY31 0x2de -#define BTN_TRIGGER_HAPPY32 0x2df -#define BTN_TRIGGER_HAPPY33 0x2e0 -#define BTN_TRIGGER_HAPPY34 0x2e1 -#define BTN_TRIGGER_HAPPY35 0x2e2 -#define BTN_TRIGGER_HAPPY36 0x2e3 -#define BTN_TRIGGER_HAPPY37 0x2e4 -#define BTN_TRIGGER_HAPPY38 0x2e5 -#define BTN_TRIGGER_HAPPY39 0x2e6 -#define BTN_TRIGGER_HAPPY40 0x2e7 - -/* We avoid low common keys in module aliases so they don't get huge. */ -#define KEY_MIN_INTERESTING KEY_MUTE -#define KEY_MAX 0x2ff -#define KEY_CNT (KEY_MAX+1) - -/* - * Relative axes - */ - -#define REL_X 0x00 -#define REL_Y 0x01 -#define REL_Z 0x02 -#define REL_RX 0x03 -#define REL_RY 0x04 -#define REL_RZ 0x05 -#define REL_HWHEEL 0x06 -#define REL_DIAL 0x07 -#define REL_WHEEL 0x08 -#define REL_MISC 0x09 -#define REL_MAX 0x0f -#define REL_CNT (REL_MAX+1) - -/* - * Absolute axes - */ - -#define ABS_X 0x00 -#define ABS_Y 0x01 -#define ABS_Z 0x02 -#define ABS_RX 0x03 -#define ABS_RY 0x04 -#define ABS_RZ 0x05 -#define ABS_THROTTLE 0x06 -#define ABS_RUDDER 0x07 -#define ABS_WHEEL 0x08 -#define ABS_GAS 0x09 -#define ABS_BRAKE 0x0a -#define ABS_HAT0X 0x10 -#define ABS_HAT0Y 0x11 -#define ABS_HAT1X 0x12 -#define ABS_HAT1Y 0x13 -#define ABS_HAT2X 0x14 -#define ABS_HAT2Y 0x15 -#define ABS_HAT3X 0x16 -#define ABS_HAT3Y 0x17 -#define ABS_PRESSURE 0x18 -#define ABS_DISTANCE 0x19 -#define ABS_TILT_X 0x1a -#define ABS_TILT_Y 0x1b -#define ABS_TOOL_WIDTH 0x1c - -#define ABS_VOLUME 0x20 - -#define ABS_MISC 0x28 - -#define ABS_MT_SLOT 0x2f /* MT slot being modified */ -#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ -#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ -#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ -#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */ -#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ -#define ABS_MT_POSITION_X 0x35 /* Center X touch position */ -#define ABS_MT_POSITION_Y 0x36 /* Center Y touch position */ -#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ -#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ -#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ -#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ -#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */ -#define ABS_MT_TOOL_X 0x3c /* Center X tool position */ -#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */ - - -#define ABS_MAX 0x3f -#define ABS_CNT (ABS_MAX+1) - -/* - * Switch events - */ - -#define SW_LID 0x00 /* set = lid shut */ -#define SW_TABLET_MODE 0x01 /* set = tablet mode */ -#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ -#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" - set = radio enabled */ -#define SW_RADIO SW_RFKILL_ALL /* deprecated */ -#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */ -#define SW_DOCK 0x05 /* set = plugged into dock */ -#define SW_LINEOUT_INSERT 0x06 /* set = inserted */ -#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ -#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ -#define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */ -#define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */ -#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ -#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ -#define SW_LINEIN_INSERT 0x0d /* set = inserted */ -#define SW_MUTE_DEVICE 0x0e /* set = device disabled */ -#define SW_PEN_INSERTED 0x0f /* set = pen inserted */ -#define SW_MAX 0x0f -#define SW_CNT (SW_MAX+1) - -/* - * Misc events - */ - -#define MSC_SERIAL 0x00 -#define MSC_PULSELED 0x01 -#define MSC_GESTURE 0x02 -#define MSC_RAW 0x03 -#define MSC_SCAN 0x04 -#define MSC_TIMESTAMP 0x05 -#define MSC_MAX 0x07 -#define MSC_CNT (MSC_MAX+1) - -/* - * LEDs - */ - -#define LED_NUML 0x00 -#define LED_CAPSL 0x01 -#define LED_SCROLLL 0x02 -#define LED_COMPOSE 0x03 -#define LED_KANA 0x04 -#define LED_SLEEP 0x05 -#define LED_SUSPEND 0x06 -#define LED_MUTE 0x07 -#define LED_MISC 0x08 -#define LED_MAIL 0x09 -#define LED_CHARGING 0x0a -#define LED_MAX 0x0f -#define LED_CNT (LED_MAX+1) - -/* - * Autorepeat values - */ - -#define REP_DELAY 0x00 -#define REP_PERIOD 0x01 -#define REP_MAX 0x01 -#define REP_CNT (REP_MAX+1) - -/* - * Sounds - */ - -#define SND_CLICK 0x00 -#define SND_BELL 0x01 -#define SND_TONE 0x02 -#define SND_MAX 0x07 -#define SND_CNT (SND_MAX+1) - -#endif diff -Nru libinput-1.10.3/include/linux/input.h libinput-0.21.0/include/linux/input.h --- libinput-1.10.3/include/linux/input.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/include/linux/input.h 2015-07-15 04:18:08.000000000 +0000 @@ -13,8 +13,6 @@ #include #include -#include "input-event-codes.h" - /* * The event structure itself */ @@ -58,14 +56,9 @@ * Note that input core does not clamp reported values to the * [minimum, maximum] limits, such task is left to userspace. * - * The default resolution for main axes (ABS_X, ABS_Y, ABS_Z) - * is reported in units per millimeter (units/mm), resolution - * for rotational axes (ABS_RX, ABS_RY, ABS_RZ) is reported - * in units per radian. - * When INPUT_PROP_ACCELEROMETER is set the resolution changes. - * The main axes (ABS_X, ABS_Y, ABS_Z) are then reported in - * in units per g (units/g) and in units per degree per second - * (units/deg/s) for rotational axes (ABS_RX, ABS_RY, ABS_RZ). + * Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in + * units per millimeter (units/mm), resolution for rotational axes + * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian. */ struct input_absinfo { __s32 value; @@ -100,12 +93,6 @@ __u8 scancode[32]; }; -struct input_mask { - __u32 type; - __u32 codes_size; - __u64 codes_ptr; -}; - #define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ #define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */ #define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */ @@ -156,68 +143,795 @@ #define EVIOCGABS(abs) _IOR('E', 0x40 + (abs), struct input_absinfo) /* get abs value/limits */ #define EVIOCSABS(abs) _IOW('E', 0xc0 + (abs), struct input_absinfo) /* set abs value/limits */ -#define EVIOCSFF _IOW('E', 0x80, struct ff_effect) /* send a force effect to a force feedback device */ +#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */ #define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */ #define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */ #define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */ #define EVIOCREVOKE _IOW('E', 0x91, int) /* Revoke device access */ -/** - * EVIOCGMASK - Retrieve current event mask +#define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */ + +/* + * Device properties and quirks + */ + +#define INPUT_PROP_POINTER 0x00 /* needs a pointer */ +#define INPUT_PROP_DIRECT 0x01 /* direct input devices */ +#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */ +#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */ +#define INPUT_PROP_TOPBUTTONPAD 0x04 /* softbuttons at top of pad */ +#define INPUT_PROP_POINTING_STICK 0x05 /* is a pointing stick */ +#define INPUT_PROP_ACCELEROMETER 0x06 /* has accelerometer */ + +#define INPUT_PROP_MAX 0x1f +#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1) + +/* + * Event types + */ + +#define EV_SYN 0x00 +#define EV_KEY 0x01 +#define EV_REL 0x02 +#define EV_ABS 0x03 +#define EV_MSC 0x04 +#define EV_SW 0x05 +#define EV_LED 0x11 +#define EV_SND 0x12 +#define EV_REP 0x14 +#define EV_FF 0x15 +#define EV_PWR 0x16 +#define EV_FF_STATUS 0x17 +#define EV_MAX 0x1f +#define EV_CNT (EV_MAX+1) + +/* + * Synchronization events. + */ + +#define SYN_REPORT 0 +#define SYN_CONFIG 1 +#define SYN_MT_REPORT 2 +#define SYN_DROPPED 3 +#define SYN_MAX 0xf +#define SYN_CNT (SYN_MAX+1) + +/* + * Keys and buttons * - * This ioctl allows user to retrieve the current event mask for specific - * event type. The argument must be of type "struct input_mask" and - * specifies the event type to query, the address of the receive buffer and - * the size of the receive buffer. - * - * The event mask is a per-client mask that specifies which events are - * forwarded to the client. Each event code is represented by a single bit - * in the event mask. If the bit is set, the event is passed to the client - * normally. Otherwise, the event is filtered and will never be queued on - * the client's receive buffer. - * - * Event masks do not affect global state of the input device. They only - * affect the file descriptor they are applied to. - * - * The default event mask for a client has all bits set, i.e. all events - * are forwarded to the client. If the kernel is queried for an unknown - * event type or if the receive buffer is larger than the number of - * event codes known to the kernel, the kernel returns all zeroes for those - * codes. - * - * At maximum, codes_size bytes are copied. - * - * This ioctl may fail with ENODEV in case the file is revoked, EFAULT - * if the receive-buffer points to invalid memory, or EINVAL if the kernel - * does not implement the ioctl. - */ -#define EVIOCGMASK _IOR('E', 0x92, struct input_mask) /* Get event-masks */ - -/** - * EVIOCSMASK - Set event mask - * - * This ioctl is the counterpart to EVIOCGMASK. Instead of receiving the - * current event mask, this changes the client's event mask for a specific - * type. See EVIOCGMASK for a description of event-masks and the - * argument-type. - * - * This ioctl provides full forward compatibility. If the passed event type - * is unknown to the kernel, or if the number of event codes specified in - * the mask is bigger than what is known to the kernel, the ioctl is still - * accepted and applied. However, any unknown codes are left untouched and - * stay cleared. That means, the kernel always filters unknown codes - * regardless of what the client requests. If the new mask doesn't cover - * all known event-codes, all remaining codes are automatically cleared and - * thus filtered. - * - * This ioctl may fail with ENODEV in case the file is revoked. EFAULT is - * returned if the receive-buffer points to invalid memory. EINVAL is returned - * if the kernel does not implement the ioctl. + * Most of the keys/buttons are modeled after USB HUT 1.12 + * (see http://www.usb.org/developers/hidpage). + * Abbreviations in the comments: + * AC - Application Control + * AL - Application Launch Button + * SC - System Control + */ + +#define KEY_RESERVED 0 +#define KEY_ESC 1 +#define KEY_1 2 +#define KEY_2 3 +#define KEY_3 4 +#define KEY_4 5 +#define KEY_5 6 +#define KEY_6 7 +#define KEY_7 8 +#define KEY_8 9 +#define KEY_9 10 +#define KEY_0 11 +#define KEY_MINUS 12 +#define KEY_EQUAL 13 +#define KEY_BACKSPACE 14 +#define KEY_TAB 15 +#define KEY_Q 16 +#define KEY_W 17 +#define KEY_E 18 +#define KEY_R 19 +#define KEY_T 20 +#define KEY_Y 21 +#define KEY_U 22 +#define KEY_I 23 +#define KEY_O 24 +#define KEY_P 25 +#define KEY_LEFTBRACE 26 +#define KEY_RIGHTBRACE 27 +#define KEY_ENTER 28 +#define KEY_LEFTCTRL 29 +#define KEY_A 30 +#define KEY_S 31 +#define KEY_D 32 +#define KEY_F 33 +#define KEY_G 34 +#define KEY_H 35 +#define KEY_J 36 +#define KEY_K 37 +#define KEY_L 38 +#define KEY_SEMICOLON 39 +#define KEY_APOSTROPHE 40 +#define KEY_GRAVE 41 +#define KEY_LEFTSHIFT 42 +#define KEY_BACKSLASH 43 +#define KEY_Z 44 +#define KEY_X 45 +#define KEY_C 46 +#define KEY_V 47 +#define KEY_B 48 +#define KEY_N 49 +#define KEY_M 50 +#define KEY_COMMA 51 +#define KEY_DOT 52 +#define KEY_SLASH 53 +#define KEY_RIGHTSHIFT 54 +#define KEY_KPASTERISK 55 +#define KEY_LEFTALT 56 +#define KEY_SPACE 57 +#define KEY_CAPSLOCK 58 +#define KEY_F1 59 +#define KEY_F2 60 +#define KEY_F3 61 +#define KEY_F4 62 +#define KEY_F5 63 +#define KEY_F6 64 +#define KEY_F7 65 +#define KEY_F8 66 +#define KEY_F9 67 +#define KEY_F10 68 +#define KEY_NUMLOCK 69 +#define KEY_SCROLLLOCK 70 +#define KEY_KP7 71 +#define KEY_KP8 72 +#define KEY_KP9 73 +#define KEY_KPMINUS 74 +#define KEY_KP4 75 +#define KEY_KP5 76 +#define KEY_KP6 77 +#define KEY_KPPLUS 78 +#define KEY_KP1 79 +#define KEY_KP2 80 +#define KEY_KP3 81 +#define KEY_KP0 82 +#define KEY_KPDOT 83 + +#define KEY_ZENKAKUHANKAKU 85 +#define KEY_102ND 86 +#define KEY_F11 87 +#define KEY_F12 88 +#define KEY_RO 89 +#define KEY_KATAKANA 90 +#define KEY_HIRAGANA 91 +#define KEY_HENKAN 92 +#define KEY_KATAKANAHIRAGANA 93 +#define KEY_MUHENKAN 94 +#define KEY_KPJPCOMMA 95 +#define KEY_KPENTER 96 +#define KEY_RIGHTCTRL 97 +#define KEY_KPSLASH 98 +#define KEY_SYSRQ 99 +#define KEY_RIGHTALT 100 +#define KEY_LINEFEED 101 +#define KEY_HOME 102 +#define KEY_UP 103 +#define KEY_PAGEUP 104 +#define KEY_LEFT 105 +#define KEY_RIGHT 106 +#define KEY_END 107 +#define KEY_DOWN 108 +#define KEY_PAGEDOWN 109 +#define KEY_INSERT 110 +#define KEY_DELETE 111 +#define KEY_MACRO 112 +#define KEY_MUTE 113 +#define KEY_VOLUMEDOWN 114 +#define KEY_VOLUMEUP 115 +#define KEY_POWER 116 /* SC System Power Down */ +#define KEY_KPEQUAL 117 +#define KEY_KPPLUSMINUS 118 +#define KEY_PAUSE 119 +#define KEY_SCALE 120 /* AL Compiz Scale (Expose) */ + +#define KEY_KPCOMMA 121 +#define KEY_HANGEUL 122 +#define KEY_HANGUEL KEY_HANGEUL +#define KEY_HANJA 123 +#define KEY_YEN 124 +#define KEY_LEFTMETA 125 +#define KEY_RIGHTMETA 126 +#define KEY_COMPOSE 127 + +#define KEY_STOP 128 /* AC Stop */ +#define KEY_AGAIN 129 +#define KEY_PROPS 130 /* AC Properties */ +#define KEY_UNDO 131 /* AC Undo */ +#define KEY_FRONT 132 +#define KEY_COPY 133 /* AC Copy */ +#define KEY_OPEN 134 /* AC Open */ +#define KEY_PASTE 135 /* AC Paste */ +#define KEY_FIND 136 /* AC Search */ +#define KEY_CUT 137 /* AC Cut */ +#define KEY_HELP 138 /* AL Integrated Help Center */ +#define KEY_MENU 139 /* Menu (show menu) */ +#define KEY_CALC 140 /* AL Calculator */ +#define KEY_SETUP 141 +#define KEY_SLEEP 142 /* SC System Sleep */ +#define KEY_WAKEUP 143 /* System Wake Up */ +#define KEY_FILE 144 /* AL Local Machine Browser */ +#define KEY_SENDFILE 145 +#define KEY_DELETEFILE 146 +#define KEY_XFER 147 +#define KEY_PROG1 148 +#define KEY_PROG2 149 +#define KEY_WWW 150 /* AL Internet Browser */ +#define KEY_MSDOS 151 +#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */ +#define KEY_SCREENLOCK KEY_COFFEE +#define KEY_DIRECTION 153 +#define KEY_CYCLEWINDOWS 154 +#define KEY_MAIL 155 +#define KEY_BOOKMARKS 156 /* AC Bookmarks */ +#define KEY_COMPUTER 157 +#define KEY_BACK 158 /* AC Back */ +#define KEY_FORWARD 159 /* AC Forward */ +#define KEY_CLOSECD 160 +#define KEY_EJECTCD 161 +#define KEY_EJECTCLOSECD 162 +#define KEY_NEXTSONG 163 +#define KEY_PLAYPAUSE 164 +#define KEY_PREVIOUSSONG 165 +#define KEY_STOPCD 166 +#define KEY_RECORD 167 +#define KEY_REWIND 168 +#define KEY_PHONE 169 /* Media Select Telephone */ +#define KEY_ISO 170 +#define KEY_CONFIG 171 /* AL Consumer Control Configuration */ +#define KEY_HOMEPAGE 172 /* AC Home */ +#define KEY_REFRESH 173 /* AC Refresh */ +#define KEY_EXIT 174 /* AC Exit */ +#define KEY_MOVE 175 +#define KEY_EDIT 176 +#define KEY_SCROLLUP 177 +#define KEY_SCROLLDOWN 178 +#define KEY_KPLEFTPAREN 179 +#define KEY_KPRIGHTPAREN 180 +#define KEY_NEW 181 /* AC New */ +#define KEY_REDO 182 /* AC Redo/Repeat */ + +#define KEY_F13 183 +#define KEY_F14 184 +#define KEY_F15 185 +#define KEY_F16 186 +#define KEY_F17 187 +#define KEY_F18 188 +#define KEY_F19 189 +#define KEY_F20 190 +#define KEY_F21 191 +#define KEY_F22 192 +#define KEY_F23 193 +#define KEY_F24 194 + +#define KEY_PLAYCD 200 +#define KEY_PAUSECD 201 +#define KEY_PROG3 202 +#define KEY_PROG4 203 +#define KEY_DASHBOARD 204 /* AL Dashboard */ +#define KEY_SUSPEND 205 +#define KEY_CLOSE 206 /* AC Close */ +#define KEY_PLAY 207 +#define KEY_FASTFORWARD 208 +#define KEY_BASSBOOST 209 +#define KEY_PRINT 210 /* AC Print */ +#define KEY_HP 211 +#define KEY_CAMERA 212 +#define KEY_SOUND 213 +#define KEY_QUESTION 214 +#define KEY_EMAIL 215 +#define KEY_CHAT 216 +#define KEY_SEARCH 217 +#define KEY_CONNECT 218 +#define KEY_FINANCE 219 /* AL Checkbook/Finance */ +#define KEY_SPORT 220 +#define KEY_SHOP 221 +#define KEY_ALTERASE 222 +#define KEY_CANCEL 223 /* AC Cancel */ +#define KEY_BRIGHTNESSDOWN 224 +#define KEY_BRIGHTNESSUP 225 +#define KEY_MEDIA 226 + +#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video + outputs (Monitor/LCD/TV-out/etc) */ +#define KEY_KBDILLUMTOGGLE 228 +#define KEY_KBDILLUMDOWN 229 +#define KEY_KBDILLUMUP 230 + +#define KEY_SEND 231 /* AC Send */ +#define KEY_REPLY 232 /* AC Reply */ +#define KEY_FORWARDMAIL 233 /* AC Forward Msg */ +#define KEY_SAVE 234 /* AC Save */ +#define KEY_DOCUMENTS 235 + +#define KEY_BATTERY 236 + +#define KEY_BLUETOOTH 237 +#define KEY_WLAN 238 +#define KEY_UWB 239 + +#define KEY_UNKNOWN 240 + +#define KEY_VIDEO_NEXT 241 /* drive next video source */ +#define KEY_VIDEO_PREV 242 /* drive previous video source */ +#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */ +#define KEY_BRIGHTNESS_AUTO 244 /* Set Auto Brightness: manual + brightness control is off, + rely on ambient */ +#define KEY_BRIGHTNESS_ZERO KEY_BRIGHTNESS_AUTO +#define KEY_DISPLAY_OFF 245 /* display device to off state */ + +#define KEY_WWAN 246 /* Wireless WAN (LTE, UMTS, GSM, etc.) */ +#define KEY_WIMAX KEY_WWAN +#define KEY_RFKILL 247 /* Key that controls all radios */ + +#define KEY_MICMUTE 248 /* Mute / unmute the microphone */ + +/* Code 255 is reserved for special needs of AT keyboard driver */ + +#define BTN_MISC 0x100 +#define BTN_0 0x100 +#define BTN_1 0x101 +#define BTN_2 0x102 +#define BTN_3 0x103 +#define BTN_4 0x104 +#define BTN_5 0x105 +#define BTN_6 0x106 +#define BTN_7 0x107 +#define BTN_8 0x108 +#define BTN_9 0x109 + +#define BTN_MOUSE 0x110 +#define BTN_LEFT 0x110 +#define BTN_RIGHT 0x111 +#define BTN_MIDDLE 0x112 +#define BTN_SIDE 0x113 +#define BTN_EXTRA 0x114 +#define BTN_FORWARD 0x115 +#define BTN_BACK 0x116 +#define BTN_TASK 0x117 + +#define BTN_JOYSTICK 0x120 +#define BTN_TRIGGER 0x120 +#define BTN_THUMB 0x121 +#define BTN_THUMB2 0x122 +#define BTN_TOP 0x123 +#define BTN_TOP2 0x124 +#define BTN_PINKIE 0x125 +#define BTN_BASE 0x126 +#define BTN_BASE2 0x127 +#define BTN_BASE3 0x128 +#define BTN_BASE4 0x129 +#define BTN_BASE5 0x12a +#define BTN_BASE6 0x12b +#define BTN_DEAD 0x12f + +#define BTN_GAMEPAD 0x130 +#define BTN_SOUTH 0x130 +#define BTN_A BTN_SOUTH +#define BTN_EAST 0x131 +#define BTN_B BTN_EAST +#define BTN_C 0x132 +#define BTN_NORTH 0x133 +#define BTN_X BTN_NORTH +#define BTN_WEST 0x134 +#define BTN_Y BTN_WEST +#define BTN_Z 0x135 +#define BTN_TL 0x136 +#define BTN_TR 0x137 +#define BTN_TL2 0x138 +#define BTN_TR2 0x139 +#define BTN_SELECT 0x13a +#define BTN_START 0x13b +#define BTN_MODE 0x13c +#define BTN_THUMBL 0x13d +#define BTN_THUMBR 0x13e + +#define BTN_DIGI 0x140 +#define BTN_TOOL_PEN 0x140 +#define BTN_TOOL_RUBBER 0x141 +#define BTN_TOOL_BRUSH 0x142 +#define BTN_TOOL_PENCIL 0x143 +#define BTN_TOOL_AIRBRUSH 0x144 +#define BTN_TOOL_FINGER 0x145 +#define BTN_TOOL_MOUSE 0x146 +#define BTN_TOOL_LENS 0x147 +#define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */ +#define BTN_TOUCH 0x14a +#define BTN_STYLUS 0x14b +#define BTN_STYLUS2 0x14c +#define BTN_TOOL_DOUBLETAP 0x14d +#define BTN_TOOL_TRIPLETAP 0x14e +#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */ + +#define BTN_WHEEL 0x150 +#define BTN_GEAR_DOWN 0x150 +#define BTN_GEAR_UP 0x151 + +#define KEY_OK 0x160 +#define KEY_SELECT 0x161 +#define KEY_GOTO 0x162 +#define KEY_CLEAR 0x163 +#define KEY_POWER2 0x164 +#define KEY_OPTION 0x165 +#define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */ +#define KEY_TIME 0x167 +#define KEY_VENDOR 0x168 +#define KEY_ARCHIVE 0x169 +#define KEY_PROGRAM 0x16a /* Media Select Program Guide */ +#define KEY_CHANNEL 0x16b +#define KEY_FAVORITES 0x16c +#define KEY_EPG 0x16d +#define KEY_PVR 0x16e /* Media Select Home */ +#define KEY_MHP 0x16f +#define KEY_LANGUAGE 0x170 +#define KEY_TITLE 0x171 +#define KEY_SUBTITLE 0x172 +#define KEY_ANGLE 0x173 +#define KEY_ZOOM 0x174 +#define KEY_MODE 0x175 +#define KEY_KEYBOARD 0x176 +#define KEY_SCREEN 0x177 +#define KEY_PC 0x178 /* Media Select Computer */ +#define KEY_TV 0x179 /* Media Select TV */ +#define KEY_TV2 0x17a /* Media Select Cable */ +#define KEY_VCR 0x17b /* Media Select VCR */ +#define KEY_VCR2 0x17c /* VCR Plus */ +#define KEY_SAT 0x17d /* Media Select Satellite */ +#define KEY_SAT2 0x17e +#define KEY_CD 0x17f /* Media Select CD */ +#define KEY_TAPE 0x180 /* Media Select Tape */ +#define KEY_RADIO 0x181 +#define KEY_TUNER 0x182 /* Media Select Tuner */ +#define KEY_PLAYER 0x183 +#define KEY_TEXT 0x184 +#define KEY_DVD 0x185 /* Media Select DVD */ +#define KEY_AUX 0x186 +#define KEY_MP3 0x187 +#define KEY_AUDIO 0x188 /* AL Audio Browser */ +#define KEY_VIDEO 0x189 /* AL Movie Browser */ +#define KEY_DIRECTORY 0x18a +#define KEY_LIST 0x18b +#define KEY_MEMO 0x18c /* Media Select Messages */ +#define KEY_CALENDAR 0x18d +#define KEY_RED 0x18e +#define KEY_GREEN 0x18f +#define KEY_YELLOW 0x190 +#define KEY_BLUE 0x191 +#define KEY_CHANNELUP 0x192 /* Channel Increment */ +#define KEY_CHANNELDOWN 0x193 /* Channel Decrement */ +#define KEY_FIRST 0x194 +#define KEY_LAST 0x195 /* Recall Last */ +#define KEY_AB 0x196 +#define KEY_NEXT 0x197 +#define KEY_RESTART 0x198 +#define KEY_SLOW 0x199 +#define KEY_SHUFFLE 0x19a +#define KEY_BREAK 0x19b +#define KEY_PREVIOUS 0x19c +#define KEY_DIGITS 0x19d +#define KEY_TEEN 0x19e +#define KEY_TWEN 0x19f +#define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */ +#define KEY_GAMES 0x1a1 /* Media Select Games */ +#define KEY_ZOOMIN 0x1a2 /* AC Zoom In */ +#define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */ +#define KEY_ZOOMRESET 0x1a4 /* AC Zoom */ +#define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */ +#define KEY_EDITOR 0x1a6 /* AL Text Editor */ +#define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */ +#define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */ +#define KEY_PRESENTATION 0x1a9 /* AL Presentation App */ +#define KEY_DATABASE 0x1aa /* AL Database App */ +#define KEY_NEWS 0x1ab /* AL Newsreader */ +#define KEY_VOICEMAIL 0x1ac /* AL Voicemail */ +#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */ +#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */ +#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */ +#define KEY_BRIGHTNESS_TOGGLE KEY_DISPLAYTOGGLE +#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */ +#define KEY_LOGOFF 0x1b1 /* AL Logoff */ + +#define KEY_DOLLAR 0x1b2 +#define KEY_EURO 0x1b3 + +#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */ +#define KEY_FRAMEFORWARD 0x1b5 +#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */ +#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */ +#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */ +#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */ +#define KEY_IMAGES 0x1ba /* AL Image Browser */ + +#define KEY_DEL_EOL 0x1c0 +#define KEY_DEL_EOS 0x1c1 +#define KEY_INS_LINE 0x1c2 +#define KEY_DEL_LINE 0x1c3 + +#define KEY_FN 0x1d0 +#define KEY_FN_ESC 0x1d1 +#define KEY_FN_F1 0x1d2 +#define KEY_FN_F2 0x1d3 +#define KEY_FN_F3 0x1d4 +#define KEY_FN_F4 0x1d5 +#define KEY_FN_F5 0x1d6 +#define KEY_FN_F6 0x1d7 +#define KEY_FN_F7 0x1d8 +#define KEY_FN_F8 0x1d9 +#define KEY_FN_F9 0x1da +#define KEY_FN_F10 0x1db +#define KEY_FN_F11 0x1dc +#define KEY_FN_F12 0x1dd +#define KEY_FN_1 0x1de +#define KEY_FN_2 0x1df +#define KEY_FN_D 0x1e0 +#define KEY_FN_E 0x1e1 +#define KEY_FN_F 0x1e2 +#define KEY_FN_S 0x1e3 +#define KEY_FN_B 0x1e4 + +#define KEY_BRL_DOT1 0x1f1 +#define KEY_BRL_DOT2 0x1f2 +#define KEY_BRL_DOT3 0x1f3 +#define KEY_BRL_DOT4 0x1f4 +#define KEY_BRL_DOT5 0x1f5 +#define KEY_BRL_DOT6 0x1f6 +#define KEY_BRL_DOT7 0x1f7 +#define KEY_BRL_DOT8 0x1f8 +#define KEY_BRL_DOT9 0x1f9 +#define KEY_BRL_DOT10 0x1fa + +#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */ +#define KEY_NUMERIC_1 0x201 /* and other keypads */ +#define KEY_NUMERIC_2 0x202 +#define KEY_NUMERIC_3 0x203 +#define KEY_NUMERIC_4 0x204 +#define KEY_NUMERIC_5 0x205 +#define KEY_NUMERIC_6 0x206 +#define KEY_NUMERIC_7 0x207 +#define KEY_NUMERIC_8 0x208 +#define KEY_NUMERIC_9 0x209 +#define KEY_NUMERIC_STAR 0x20a +#define KEY_NUMERIC_POUND 0x20b + +#define KEY_CAMERA_FOCUS 0x210 +#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */ + +#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */ +#define KEY_TOUCHPAD_ON 0x213 +#define KEY_TOUCHPAD_OFF 0x214 + +#define KEY_CAMERA_ZOOMIN 0x215 +#define KEY_CAMERA_ZOOMOUT 0x216 +#define KEY_CAMERA_UP 0x217 +#define KEY_CAMERA_DOWN 0x218 +#define KEY_CAMERA_LEFT 0x219 +#define KEY_CAMERA_RIGHT 0x21a + +#define KEY_ATTENDANT_ON 0x21b +#define KEY_ATTENDANT_OFF 0x21c +#define KEY_ATTENDANT_TOGGLE 0x21d /* Attendant call on or off */ +#define KEY_LIGHTS_TOGGLE 0x21e /* Reading light on or off */ + +#define BTN_DPAD_UP 0x220 +#define BTN_DPAD_DOWN 0x221 +#define BTN_DPAD_LEFT 0x222 +#define BTN_DPAD_RIGHT 0x223 + +#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */ + +#define KEY_BUTTONCONFIG 0x240 /* AL Button Configuration */ +#define KEY_TASKMANAGER 0x241 /* AL Task/Project Manager */ +#define KEY_JOURNAL 0x242 /* AL Log/Journal/Timecard */ +#define KEY_CONTROLPANEL 0x243 /* AL Control Panel */ +#define KEY_APPSELECT 0x244 /* AL Select Task/Application */ +#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */ +#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */ + +#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ +#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ + +#define KEY_KBDINPUTASSIST_PREV 0x260 +#define KEY_KBDINPUTASSIST_NEXT 0x261 +#define KEY_KBDINPUTASSIST_PREVGROUP 0x262 +#define KEY_KBDINPUTASSIST_NEXTGROUP 0x263 +#define KEY_KBDINPUTASSIST_ACCEPT 0x264 +#define KEY_KBDINPUTASSIST_CANCEL 0x265 + +#define BTN_TRIGGER_HAPPY 0x2c0 +#define BTN_TRIGGER_HAPPY1 0x2c0 +#define BTN_TRIGGER_HAPPY2 0x2c1 +#define BTN_TRIGGER_HAPPY3 0x2c2 +#define BTN_TRIGGER_HAPPY4 0x2c3 +#define BTN_TRIGGER_HAPPY5 0x2c4 +#define BTN_TRIGGER_HAPPY6 0x2c5 +#define BTN_TRIGGER_HAPPY7 0x2c6 +#define BTN_TRIGGER_HAPPY8 0x2c7 +#define BTN_TRIGGER_HAPPY9 0x2c8 +#define BTN_TRIGGER_HAPPY10 0x2c9 +#define BTN_TRIGGER_HAPPY11 0x2ca +#define BTN_TRIGGER_HAPPY12 0x2cb +#define BTN_TRIGGER_HAPPY13 0x2cc +#define BTN_TRIGGER_HAPPY14 0x2cd +#define BTN_TRIGGER_HAPPY15 0x2ce +#define BTN_TRIGGER_HAPPY16 0x2cf +#define BTN_TRIGGER_HAPPY17 0x2d0 +#define BTN_TRIGGER_HAPPY18 0x2d1 +#define BTN_TRIGGER_HAPPY19 0x2d2 +#define BTN_TRIGGER_HAPPY20 0x2d3 +#define BTN_TRIGGER_HAPPY21 0x2d4 +#define BTN_TRIGGER_HAPPY22 0x2d5 +#define BTN_TRIGGER_HAPPY23 0x2d6 +#define BTN_TRIGGER_HAPPY24 0x2d7 +#define BTN_TRIGGER_HAPPY25 0x2d8 +#define BTN_TRIGGER_HAPPY26 0x2d9 +#define BTN_TRIGGER_HAPPY27 0x2da +#define BTN_TRIGGER_HAPPY28 0x2db +#define BTN_TRIGGER_HAPPY29 0x2dc +#define BTN_TRIGGER_HAPPY30 0x2dd +#define BTN_TRIGGER_HAPPY31 0x2de +#define BTN_TRIGGER_HAPPY32 0x2df +#define BTN_TRIGGER_HAPPY33 0x2e0 +#define BTN_TRIGGER_HAPPY34 0x2e1 +#define BTN_TRIGGER_HAPPY35 0x2e2 +#define BTN_TRIGGER_HAPPY36 0x2e3 +#define BTN_TRIGGER_HAPPY37 0x2e4 +#define BTN_TRIGGER_HAPPY38 0x2e5 +#define BTN_TRIGGER_HAPPY39 0x2e6 +#define BTN_TRIGGER_HAPPY40 0x2e7 + +/* We avoid low common keys in module aliases so they don't get huge. */ +#define KEY_MIN_INTERESTING KEY_MUTE +#define KEY_MAX 0x2ff +#define KEY_CNT (KEY_MAX+1) + +/* + * Relative axes */ -#define EVIOCSMASK _IOW('E', 0x93, struct input_mask) /* Set event-masks */ -#define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */ +#define REL_X 0x00 +#define REL_Y 0x01 +#define REL_Z 0x02 +#define REL_RX 0x03 +#define REL_RY 0x04 +#define REL_RZ 0x05 +#define REL_HWHEEL 0x06 +#define REL_DIAL 0x07 +#define REL_WHEEL 0x08 +#define REL_MISC 0x09 +#define REL_MAX 0x0f +#define REL_CNT (REL_MAX+1) + +/* + * Absolute axes + */ + +#define ABS_X 0x00 +#define ABS_Y 0x01 +#define ABS_Z 0x02 +#define ABS_RX 0x03 +#define ABS_RY 0x04 +#define ABS_RZ 0x05 +#define ABS_THROTTLE 0x06 +#define ABS_RUDDER 0x07 +#define ABS_WHEEL 0x08 +#define ABS_GAS 0x09 +#define ABS_BRAKE 0x0a +#define ABS_HAT0X 0x10 +#define ABS_HAT0Y 0x11 +#define ABS_HAT1X 0x12 +#define ABS_HAT1Y 0x13 +#define ABS_HAT2X 0x14 +#define ABS_HAT2Y 0x15 +#define ABS_HAT3X 0x16 +#define ABS_HAT3Y 0x17 +#define ABS_PRESSURE 0x18 +#define ABS_DISTANCE 0x19 +#define ABS_TILT_X 0x1a +#define ABS_TILT_Y 0x1b +#define ABS_TOOL_WIDTH 0x1c + +#define ABS_VOLUME 0x20 + +#define ABS_MISC 0x28 + +#define ABS_MT_SLOT 0x2f /* MT slot being modified */ +#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */ +#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */ +#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */ +#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */ +#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */ +#define ABS_MT_POSITION_X 0x35 /* Center X touch position */ +#define ABS_MT_POSITION_Y 0x36 /* Center Y touch position */ +#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */ +#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ +#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ +#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ +#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */ +#define ABS_MT_TOOL_X 0x3c /* Center X tool position */ +#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */ + +#define ABS_MAX 0x3f +#define ABS_CNT (ABS_MAX+1) + +/* + * Switch events + */ + +#define SW_LID 0x00 /* set = lid shut */ +#define SW_TABLET_MODE 0x01 /* set = tablet mode */ +#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ +#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" + set = radio enabled */ +#define SW_RADIO SW_RFKILL_ALL /* deprecated */ +#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */ +#define SW_DOCK 0x05 /* set = plugged into dock */ +#define SW_LINEOUT_INSERT 0x06 /* set = inserted */ +#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */ +#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */ +#define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */ +#define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */ +#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */ +#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */ +#define SW_LINEIN_INSERT 0x0d /* set = inserted */ +#define SW_MUTE_DEVICE 0x0e /* set = device disabled */ +#define SW_MAX 0x0f +#define SW_CNT (SW_MAX+1) + +/* + * Misc events + */ + +#define MSC_SERIAL 0x00 +#define MSC_PULSELED 0x01 +#define MSC_GESTURE 0x02 +#define MSC_RAW 0x03 +#define MSC_SCAN 0x04 +#define MSC_TIMESTAMP 0x05 +#define MSC_MAX 0x07 +#define MSC_CNT (MSC_MAX+1) + +/* + * LEDs + */ + +#define LED_NUML 0x00 +#define LED_CAPSL 0x01 +#define LED_SCROLLL 0x02 +#define LED_COMPOSE 0x03 +#define LED_KANA 0x04 +#define LED_SLEEP 0x05 +#define LED_SUSPEND 0x06 +#define LED_MUTE 0x07 +#define LED_MISC 0x08 +#define LED_MAIL 0x09 +#define LED_CHARGING 0x0a +#define LED_MAX 0x0f +#define LED_CNT (LED_MAX+1) + +/* + * Autorepeat values + */ + +#define REP_DELAY 0x00 +#define REP_PERIOD 0x01 +#define REP_MAX 0x01 +#define REP_CNT (REP_MAX+1) + +/* + * Sounds + */ + +#define SND_CLICK 0x00 +#define SND_BELL 0x01 +#define SND_TONE 0x02 +#define SND_MAX 0x07 +#define SND_CNT (SND_MAX+1) /* * IDs. @@ -248,9 +962,6 @@ #define BUS_GSC 0x1A #define BUS_ATARI 0x1B #define BUS_SPI 0x1C -#define BUS_RMI 0x1D -#define BUS_CEC 0x1E -#define BUS_INTEL_ISHTP 0x1F /* * MT_TOOL types @@ -479,14 +1190,6 @@ #define FF_GAIN 0x60 #define FF_AUTOCENTER 0x61 -/* - * ff->playback(effect_id = FF_GAIN) is the first effect_id to - * cause a collision with another ff method, in this case ff->set_gain(). - * Therefore the greatest safe value for effect_id is FF_GAIN - 1, - * and thus the total number of effects should never exceed FF_GAIN. - */ -#define FF_MAX_EFFECTS FF_GAIN - #define FF_MAX 0x7f #define FF_CNT (FF_MAX+1) diff -Nru libinput-1.10.3/install-sh libinput-0.21.0/install-sh --- libinput-1.10.3/install-sh 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/install-sh 2015-08-04 00:31:39.000000000 +0000 @@ -0,0 +1,501 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2013-12-25.23; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# 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 +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru libinput-1.10.3/ltmain.sh libinput-0.21.0/ltmain.sh --- libinput-1.10.3/ltmain.sh 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/ltmain.sh 2015-08-04 00:31:35.000000000 +0000 @@ -0,0 +1,9655 @@ + +# libtool (GNU libtool) 2.4.2 +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --no-warn don't display warning messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4.2 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . +# GNU libtool home page: . +# General help using GNU software: . + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4.2 +TIMESTAMP="" +package_revision=1.3337 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# NLS nuisances: We save the old values to restore during execute mode. +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL + +$lt_unset CDPATH + + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + + + +: ${CP="cp -f"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation + + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} + fi + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} + +# The name of this program: +func_dirname_and_basename "$progpath" +progname=$func_basename_result + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` + done + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "$my_tmpdir" +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "$1" | $SED \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $opt_debug + + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + echo + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. +func_help () +{ + $opt_debug + + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ + p + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $opt_debug + + func_error "missing argument for $1." + exit_cmd=exit +} + + +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + +exit_cmd=: + + + + + +magic="%%%MAGIC variable%%%" +magic_exe="%%%MAGIC EXE variable%%%" + +# Global variables. +nonopt= +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "${1}=\$${1}\${2}" +} # func_append may be replaced by extended shell implementation + +# func_append_quoted var value +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +func_append_quoted () +{ + func_quote_for_eval "${2}" + eval "${1}=\$${1}\\ \$func_quote_for_eval_result" +} # func_append_quoted may be replaced by extended shell implementation + + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "${@}"` +} # func_arith may be replaced by extended shell implementation + + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + +# func_fatal_configuration arg... +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_error ${1+"$@"} + func_error "See the $PACKAGE documentation for more information." + func_fatal_error "Fatal configuration error." +} + + +# func_config +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + +# func_features +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + +# func_enable_tag tagname +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname="$1" + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf="/$re_begincf/,/$re_endcf/p" + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_warning=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do + opt="$1" + shift + case $opt in + --debug|-x) opt_debug='set -x' + func_echo "enabling shell trace mode" + $opt_debug + ;; + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" + shift + ;; + --preserve-dup-deps) + opt_preserve_dup_deps=: + ;; + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) + opt_silent=false +func_append preserve_args " $opt" + ;; + --no-warning|--no-warn) + opt_warning=false +func_append preserve_args " $opt" + ;; + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" + shift + ;; + + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + + # Separate optargs to long options: + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; + esac + done + + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } + + + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} + + + + +## ----------- ## +## Main. ## +## ----------- ## + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_mode_compile arg... +func_mode_compile () +{ + $opt_debug + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify \`-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + func_append_quoted lastarg "$arg" + done + IFS="$save_ifs" + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with \`-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj="$func_basename_result" + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from \`$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$opt_mode'" + ;; + esac + + echo + $ECHO "Try \`$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test "$opt_help" = :; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | sed -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + sed '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps ; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + else + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + echo + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$opt_mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$absdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$opt_mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|qnx|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) # correct to gnu/linux during the next big refactor + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + func_append verstring ":${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + func_append libobjs " $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$opt_mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + # Remove ${wl} instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd1 in $cmds; do + IFS="$save_ifs" + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + func_append oldobjs " $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + func_resolve_sysroot "$deplib" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + odir="$objdir" + else + odir="$dir/$objdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$opt_mode" = uninstall && odir="$dir" + + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case "$opt_mode" in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$opt_mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + func_append rmfiles " $odir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$opt_mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff -Nru libinput-1.10.3/m4/libtool.m4 libinput-0.21.0/m4/libtool.m4 --- libinput-1.10.3/m4/libtool.m4 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/m4/libtool.m4 2015-08-04 00:31:35.000000000 +0000 @@ -0,0 +1,7992 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file 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. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +]) + +# serial 57 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +m4_defun([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from `configure', and `config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# `config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain="$ac_aux_dir/ltmain.sh" +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the `libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to `config.status' so that its +# declaration there will have the same value as in `configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags="_LT_TAGS"dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into `config.status', and then the shell code to quote escape them in +# for loops in `config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# `#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test $lt_write_fail = 0 && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +\`$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test $[#] != 0 +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try \`$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try \`$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +_LT_COPYING +_LT_LIBTOOL_TAGS + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_REPLACE_SHELLFNS + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test $_lt_result -eq 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + m4_if([$1], [CXX], +[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script which will find a shell with a builtin +# printf (which we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case "$ECHO" in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and in which our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD="${LD-ld}_sol2" + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test x"[$]$2" = xyes; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links="nottested" +if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", + [Define to the sub-directory in which libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || + test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Add ABI-specific directories to the system library path. + sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" + + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], + [Run-time system search path for libraries]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program which can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program which can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi]) +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting ${shlibpath_var} if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report which library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC="$lt_save_CC" +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + gnu*) + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + + _LT_TAGVAR(GCC, $1)="$GXX" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case ${prev}${p} in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test "$pre_test_object_deps_done" = no; then + case ${prev} in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)="$p" + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)="$p" + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC* | sunCC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_F77" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$G77" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" +fi # test "$_lt_disable_F77" != yes + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_FC" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test "$_lt_disable_FC" != yes + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +AC_MSG_RESULT([$xsi_shell]) +_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) + +AC_MSG_CHECKING([whether the shell understands "+="]) +lt_shell_append=no +( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +AC_MSG_RESULT([$lt_shell_append]) +_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) + + +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) + + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) + + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) + + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi + +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) + + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine which file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff -Nru libinput-1.10.3/m4/lt~obsolete.m4 libinput-0.21.0/m4/lt~obsolete.m4 --- libinput-1.10.3/m4/lt~obsolete.m4 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/m4/lt~obsolete.m4 2015-08-04 00:31:35.000000000 +0000 @@ -0,0 +1,98 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file 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. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff -Nru libinput-1.10.3/m4/ltoptions.m4 libinput-0.21.0/m4/ltoptions.m4 --- libinput-1.10.3/m4/ltoptions.m4 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/m4/ltoptions.m4 2015-08-04 00:31:35.000000000 +0000 @@ -0,0 +1,384 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file 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. + +# serial 7 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option `$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl `shared' nor `disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the `shared' and +# `disable-shared' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the `static' and +# `disable-static' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the `fast-install' +# and `disable-fast-install' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the `pic-only' and `no-pic' +# LT_INIT options. +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for lt_pkg in $withval; do + IFS="$lt_save_ifs" + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [pic_mode=default]) + +test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff -Nru libinput-1.10.3/m4/ltsugar.m4 libinput-0.21.0/m4/ltsugar.m4 --- libinput-1.10.3/m4/ltsugar.m4 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/m4/ltsugar.m4 2015-08-04 00:31:35.000000000 +0000 @@ -0,0 +1,123 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file 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. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59 which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff -Nru libinput-1.10.3/m4/ltversion.m4 libinput-0.21.0/m4/ltversion.m4 --- libinput-1.10.3/m4/ltversion.m4 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/m4/ltversion.m4 2015-08-04 00:31:35.000000000 +0000 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file 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. + +# @configure_input@ + +# serial 3337 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.2]) +m4_define([LT_PACKAGE_REVISION], [1.3337]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.2' +macro_revision='1.3337' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff -Nru libinput-1.10.3/Makefile.am libinput-0.21.0/Makefile.am --- libinput-1.10.3/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/Makefile.am 2015-07-09 02:52:56.000000000 +0000 @@ -0,0 +1,6 @@ +SUBDIRS = src doc test tools udev + +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} + +valgrind: + (cd test; $(MAKE) valgrind) diff -Nru libinput-1.10.3/Makefile.in libinput-0.21.0/Makefile.in --- libinput-1.10.3/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/Makefile.in 2015-08-04 00:58:30.000000000 +0000 @@ -0,0 +1,846 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 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__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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 = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(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)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ + $(am__configure_deps) $(am__DIST_COMMON) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +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 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + cscope distdir dist dist-all distcheck +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \ + $(LISP)config.h.in +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +CSCOPE = cscope +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in COPYING \ + compile config.guess config.sub depcomp install-sh ltmain.sh \ + missing +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + if test -d "$(distdir)"; then \ + find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -rf "$(distdir)" \ + || { sleep 5 && rm -rf "$(distdir)"; }; \ + else :; fi +am__post_remove_distdir = $(am__remove_distdir) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +GZIP_ENV = --best +DIST_ARCHIVES = $(distdir).tar.xz +DIST_TARGETS = dist-xz +distuninstallcheck_listfiles = find . -type f -print +am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ + | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +ADDR2LINE = @ADDR2LINE@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GCC_CFLAGS = @GCC_CFLAGS@ +GCC_CXXFLAGS = @GCC_CXXFLAGS@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBEVDEV_CFLAGS = @LIBEVDEV_CFLAGS@ +LIBEVDEV_LIBS = @LIBEVDEV_LIBS@ +LIBINPUT_LT_VERSION = @LIBINPUT_LT_VERSION@ +LIBINPUT_VERSION = @LIBINPUT_VERSION@ +LIBINPUT_VERSION_MAJOR = @LIBINPUT_VERSION_MAJOR@ +LIBINPUT_VERSION_MICRO = @LIBINPUT_VERSION_MICRO@ +LIBINPUT_VERSION_MINOR = @LIBINPUT_VERSION_MINOR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@ +LIBUDEV_LIBS = @LIBUDEV_LIBS@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MTDEV_CFLAGS = @MTDEV_CFLAGS@ +MTDEV_LIBS = @MTDEV_LIBS@ +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@ +STRIP = @STRIP@ +UDEV_DIR = @UDEV_DIR@ +UDEV_TEST_PATH = @UDEV_TEST_PATH@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +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_CXX = @ac_ct_CXX@ +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@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = src doc test tools udev +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: Makefile + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +config.h: stamp-h1 + @test -f $@ || rm -f stamp-h1 + @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + 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-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + 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" +cscope: cscope.files + test ! -s cscope.files \ + || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) +clean-cscope: + -rm -f cscope.files +cscope.files: clean-cscope cscopelist +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + 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 + -rm -f cscope.out cscope.in.out cscope.po.out cscope.files + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @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 + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__post_remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 + $(am__post_remove_distdir) + +dist-lzip: distdir + tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz + $(am__post_remove_distdir) +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz + $(am__post_remove_distdir) + +dist-tarZ: distdir + @echo WARNING: "Support for distribution archives compressed with" \ + "legacy program 'compress' is deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__post_remove_distdir) + +dist-shar: distdir + @echo WARNING: "Support for shar distribution archives is" \ + "deprecated." >&2 + @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__post_remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__post_remove_distdir) + +dist dist-all: + $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' + $(am__post_remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lz*) \ + lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir) + chmod u+w $(distdir) + mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build/sub \ + && ../../configure \ + $(AM_DISTCHECK_CONFIGURE_FLAGS) \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + --srcdir=../.. --prefix="$$dc_install_base" \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__post_remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @test -n '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: trying to run $@ with an empty' \ + '$$(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + $(am__cd) '$(distuninstallcheck_dir)' || { \ + echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ + exit 1; \ + }; \ + test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +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-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) all install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--refresh check check-am clean clean-cscope clean-generic \ + clean-libtool cscope cscopelist-am ctags ctags-am dist \ + dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ + dist-xz dist-zip distcheck distclean distclean-generic \ + distclean-hdr distclean-libtool distclean-tags distcleancheck \ + distdir distuninstallcheck 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-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +valgrind: + (cd test; $(MAKE) valgrind) + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru libinput-1.10.3/meson.build libinput-0.21.0/meson.build --- libinput-1.10.3/meson.build 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/meson.build 1970-01-01 00:00:00.000000000 +0000 @@ -1,739 +0,0 @@ -project('libinput', 'c', 'cpp', - version : '1.10.3', - license : 'MIT/Expat', - default_options : [ 'c_std=gnu99', 'warning_level=2' ], - meson_version : '>= 0.40.0') - -libinput_version = meson.project_version().split('.') - -# We use libtool-version numbers because it's easier to understand. -# Before making a release, the libinput_so_* -# numbers should be modified. The components are of the form C:R:A. -# a) If binary compatibility has been broken (eg removed or changed interfaces) -# change to C+1:0:0. -# b) If interfaces have been changed or added, but binary compatibility has -# been preserved, change to C+1:0:A+1 -# c) If the interface is the same as the previous version, change to C:R+1:A -libinput_lt_c=23 -libinput_lt_r=0 -libinput_lt_a=13 - -# convert to soname -libinput_so_version = '@0@.@1@.@2@'.format((libinput_lt_c - libinput_lt_a), - libinput_lt_a, libinput_lt_r) - -# Compiler setup -cc = meson.get_compiler('c') -cppflags = ['-Wno-unused-parameter', '-g', '-fvisibility=hidden'] -cflags = cppflags + ['-Wmissing-prototypes', '-Wstrict-prototypes'] -add_project_arguments(cflags, language : 'c') -add_project_arguments(cppflags, language : 'cpp') - -config_h = configuration_data() -config_h.set('_GNU_SOURCE', '1') - -prefix = '''#define _GNU_SOURCE 1 -#include -''' -if cc.get_define('static_assert', prefix : prefix) == '' - config_h.set('static_assert(...)', '/* */') -endif - -# Dependencies -pkgconfig = import('pkgconfig') -dep_udev = dependency('libudev') -dep_mtdev = dependency('mtdev', version : '>= 1.1.0') -dep_libevdev = dependency('libevdev', version : '>= 0.4') -dep_lm = cc.find_library('m', required : false) -dep_rt = cc.find_library('rt', required : false) - -# Include directories -includes_include = include_directories('include') -includes_src = include_directories('src') - -############ libwacom configuration ############ - -have_libwacom = get_option('libwacom') -config_h.set10('HAVE_LIBWACOM', have_libwacom) -if have_libwacom - dep_libwacom = dependency('libwacom', version : '>= 0.20') - - code = ''' - #include - int main(void) { libwacom_get_paired_device(NULL); } - ''' - result = cc.links(code, - name : 'libwacom_get_paired_device check', - dependencies : dep_libwacom) - config_h.set10('HAVE_LIBWACOM_GET_PAIRED_DEVICE', result) -else - dep_libwacom = declare_dependency() -endif - -############ udev bits ############ - -udev_dir = get_option('udev-dir') -if udev_dir == '' - udev_dir = join_paths(get_option('prefix'), 'lib', 'udev') -endif -udev_rules_dir = join_paths(udev_dir, 'rules.d') -udev_hwdb_dir = join_paths(udev_dir, 'hwdb.d') - -executable('libinput-device-group', - 'udev/libinput-device-group.c', - dependencies : [dep_udev, dep_libwacom], - include_directories : [includes_src, includes_include], - install : true, - install_dir : udev_dir) -executable('libinput-model-quirks', - 'udev/libinput-model-quirks.c', - dependencies : dep_udev, - include_directories : [includes_src, includes_include], - install : true, - install_dir : udev_dir) - -model_quirks = files('udev/90-libinput-model-quirks.hwdb') - -parse_hwdb_py = find_program('udev/parse_hwdb.py') -test('parse-hwdb', - parse_hwdb_py, - args : model_quirks) - -udev_rules_config = configuration_data() -udev_rules_config.set('UDEV_TEST_PATH', '') -configure_file(input : 'udev/80-libinput-device-groups.rules.in', - output : '80-libinput-device-groups.rules', - install : true, - install_dir : udev_rules_dir, - configuration : udev_rules_config) -configure_file(input : 'udev/90-libinput-model-quirks.rules.in', - output : '90-libinput-model-quirks.rules', - install : true, - install_dir : udev_rules_dir, - configuration : udev_rules_config) -configure_file(input : model_quirks, - output : '90-libinput-model-quirks.hwdb', - install : true, - install_dir : udev_hwdb_dir, - configuration : udev_rules_config) - -litest_udev_rules_config = configuration_data() -litest_udev_rules_config.set('UDEV_TEST_PATH', meson.build_root() + '/') -litest_groups_rules_file = configure_file(input : 'udev/80-libinput-device-groups.rules.in', - output : '80-libinput-device-groups-litest.rules', - install : false, - configuration : litest_udev_rules_config) -litest_model_quirks_file = configure_file(input : 'udev/90-libinput-model-quirks.rules.in', - output : '90-libinput-model-quirks-litest.rules', - install : false, - configuration : litest_udev_rules_config) - -############ libinput-util.a ############ -src_libinput_util = [ - 'src/libinput-util.c', - 'src/libinput-util.h' -] -libinput_util = static_library('libinput-util', - src_libinput_util, - dependencies : dep_udev, - include_directories : includes_include) -dep_libinput_util = declare_dependency(link_with : libinput_util) - -############ libfilter.a ############ -src_libfilter = [ - 'src/filter.c', - 'src/filter.h', - 'src/filter-private.h' -] -libfilter = static_library('filter', src_libfilter, - dependencies : dep_udev, - include_directories : includes_include) -dep_libfilter = declare_dependency(link_with : libfilter) - -############ libinput.so ############ -install_headers('src/libinput.h') -src_libinput = [ - 'src/libinput.c', - 'src/libinput.h', - 'src/libinput-private.h', - 'src/evdev.c', - 'src/evdev.h', - 'src/evdev-debounce.c', - 'src/evdev-fallback.c', - 'src/evdev-fallback.h', - 'src/evdev-middle-button.c', - 'src/evdev-mt-touchpad.c', - 'src/evdev-mt-touchpad.h', - 'src/evdev-mt-touchpad-tap.c', - 'src/evdev-mt-touchpad-buttons.c', - 'src/evdev-mt-touchpad-edge-scroll.c', - 'src/evdev-mt-touchpad-gestures.c', - 'src/evdev-tablet.c', - 'src/evdev-tablet.h', - 'src/evdev-tablet-pad.c', - 'src/evdev-tablet-pad.h', - 'src/evdev-tablet-pad-leds.c', - 'src/filter.c', - 'src/filter.h', - 'src/filter-private.h', - 'src/path-seat.h', - 'src/path-seat.c', - 'src/udev-seat.c', - 'src/udev-seat.h', - 'src/timer.c', - 'src/timer.h', - 'include/linux/input.h' -] -deps_libinput = [ - dep_mtdev, - dep_udev, - dep_libevdev, - dep_lm, - dep_rt, - dep_libwacom, - dep_libinput_util -] - -libinput_version_h_config = configuration_data() -libinput_version_h_config.set('LIBINPUT_VERSION_MAJOR', libinput_version[0]) -libinput_version_h_config.set('LIBINPUT_VERSION_MINOR', libinput_version[1]) -libinput_version_h_config.set('LIBINPUT_VERSION_MICRO', libinput_version[2]) -libinput_version_h_config.set('LIBINPUT_VERSION', meson.project_version()) - -libinput_version_h = configure_file( - input : 'src/libinput-version.h.in', - output : 'libinput-version.h', - configuration : libinput_version_h_config, - install : false, -) - -mapfile = join_paths(meson.source_root(), 'src', 'libinput.sym') -version_flag = '-Wl,--version-script,@0@'.format(mapfile) -lib_libinput = shared_library('input', - src_libinput, - include_directories : [include_directories('.'), includes_include], - dependencies : deps_libinput, - version : libinput_so_version, - link_args : version_flag, - link_depends : mapfile, - install : true - ) - -dep_libinput = declare_dependency( - link_with : lib_libinput, - dependencies : deps_libinput) - -pkgconfig.generate( - filebase : 'libinput', - name : 'Libinput', - description : 'Input device library', - version : meson.project_version(), - libraries : lib_libinput -) - -# Restore the SELinux context for the libinput.so.a.b.c on install -# meson bug https://github.com/mesonbuild/meson/issues/1967 -meson.add_install_script('src/libinput-restore-selinux-context.sh', - join_paths(get_option('prefix'), get_option('libdir')), - lib_libinput.full_path()) - -############ documentation ############ - -if get_option('documentation') - doxygen = find_program('doxygen') - doxygen_version_cmd = run_command(doxygen.path(), '--version') - if doxygen_version_cmd.returncode() != 0 - error('Command "doxygen --version" failed.') - endif - doxygen_version = doxygen_version_cmd.stdout() - if doxygen_version.version_compare('< 1.8.3') - error('doxygen needs to be at least version 1.8.3 (have @0@)'.format(doxygen_version)) - endif - dot = find_program('dot') - grep = find_program('grep') - dot_version_cmd = run_command(dot.path(), '-V') - if dot_version_cmd.returncode() != 0 - error('Command "dot -V" failed.') - endif - # dot -V output is (to stderr): - # dot - graphviz version 2.38.0 (20140413.2041) - dot_version = dot_version_cmd.stderr().split(' ')[4] - if dot_version.version_compare('< 2.26') - error('Graphviz dot needs to be at least version 2.26 (have @0@)'.format(dot_version)) - endif - - src_doxygen = [ - # source files - meson.source_root() + '/src/libinput.h', - # written docs - meson.source_root() + '/doc/absolute-axes.dox', - meson.source_root() + '/doc/absolute-coordinate-ranges.dox', - meson.source_root() + '/doc/building.dox', - meson.source_root() + '/doc/button_debouncing.dox', - meson.source_root() + '/doc/clickpad-softbuttons.dox', - meson.source_root() + '/doc/contributing.dox', - meson.source_root() + '/doc/device-configuration-via-udev.dox', - meson.source_root() + '/doc/faqs.dox', - meson.source_root() + '/doc/gestures.dox', - meson.source_root() + '/doc/middle-button-emulation.dox', - meson.source_root() + '/doc/normalization-of-relative-motion.dox', - meson.source_root() + '/doc/palm-detection.dox', - meson.source_root() + '/doc/page-hierarchy.dox', - meson.source_root() + '/doc/pointer-acceleration.dox', - meson.source_root() + '/doc/reporting-bugs.dox', - meson.source_root() + '/doc/scrolling.dox', - meson.source_root() + '/doc/seats.dox', - meson.source_root() + '/doc/switches.dox', - meson.source_root() + '/doc/t440-support.dox', - meson.source_root() + '/doc/tablet-support.dox', - meson.source_root() + '/doc/tapping.dox', - meson.source_root() + '/doc/test-suite.dox', - meson.source_root() + '/doc/timestamps.dox', - meson.source_root() + '/doc/tools.dox', - meson.source_root() + '/doc/touchpad-jumping-cursors.dox', - meson.source_root() + '/doc/touchpad-pressure.dox', - meson.source_root() + '/doc/touchpads.dox', - meson.source_root() + '/doc/trackpoints.dox', - meson.source_root() + '/doc/what-is-libinput.dox', - # dot drawings - meson.source_root() + '/doc/dot/seats-sketch.gv', - meson.source_root() + '/doc/dot/seats-sketch-libinput.gv', - meson.source_root() + '/doc/dot/libinput-stack-wayland.gv', - meson.source_root() + '/doc/dot/libinput-stack-xorg.gv', - meson.source_root() + '/doc/dot/libinput-stack-gnome.gv', - meson.source_root() + '/doc/dot/evemu.gv', - # svgs - meson.source_root() + '/doc/svg/button-debouncing-wave-diagram.svg', - meson.source_root() + '/doc/svg/button-scrolling.svg', - meson.source_root() + '/doc/svg/clickfinger.svg', - meson.source_root() + '/doc/svg/clickfinger-distance.svg', - meson.source_root() + '/doc/svg/edge-scrolling.svg', - meson.source_root() + '/doc/svg/gesture-2fg-ambiguity.svg', - meson.source_root() + '/doc/svg/palm-detection.svg', - meson.source_root() + '/doc/svg/pinch-gestures.svg', - meson.source_root() + '/doc/svg/pinch-gestures-softbuttons.svg', - meson.source_root() + '/doc/svg/ptraccel-linear.svg', - meson.source_root() + '/doc/svg/ptraccel-low-dpi.svg', - meson.source_root() + '/doc/svg/ptraccel-touchpad.svg', - meson.source_root() + '/doc/svg/ptraccel-trackpoint.svg', - meson.source_root() + '/doc/svg/software-buttons.svg', - meson.source_root() + '/doc/svg/swipe-gestures.svg', - meson.source_root() + '/doc/svg/tablet-axes.svg', - meson.source_root() + '/doc/svg/tablet-cintiq24hd-modes.svg', - meson.source_root() + '/doc/svg/tablet-interfaces.svg', - meson.source_root() + '/doc/svg/tablet-intuos-modes.svg', - meson.source_root() + '/doc/svg/tablet-left-handed.svg', - meson.source_root() + '/doc/svg/tablet-out-of-bounds.svg', - meson.source_root() + '/doc/svg/tablet.svg', - meson.source_root() + '/doc/svg/tap-n-drag.svg', - meson.source_root() + '/doc/svg/thumb-detection.svg', - meson.source_root() + '/doc/svg/top-software-buttons.svg', - meson.source_root() + '/doc/svg/touchscreen-gestures.svg', - meson.source_root() + '/doc/svg/twofinger-scrolling.svg', - # style files - meson.source_root() + '/doc/style/header.html', - meson.source_root() + '/doc/style/footer.html', - meson.source_root() + '/doc/style/customdoxygen.css', - meson.source_root() + '/doc/style/bootstrap.css', - meson.source_root() + '/doc/style/libinputdoxygen.css', - meson.source_root() + '/README.md' - ] - - doc_config = configuration_data() - doc_config.set('PACKAGE_NAME', meson.project_name()) - doc_config.set('PACKAGE_VERSION', meson.project_version()) - doc_config.set('top_srcdir', meson.source_root()) - doc_config.set('INPUT', ' '.join(src_doxygen)) - - doxyfile = configure_file(input : 'doc/libinput.doxygen.in', - output : 'libinput.doxygen', - configuration : doc_config, - install : false) - custom_target('doxygen', - input : [ doxyfile ] + src_doxygen, - output : [ 'html' ], - command : [ doxygen, doxyfile ], - install : false, - build_by_default : true) - -endif - -############ tools ############ -libinput_tool_path = join_paths(get_option('prefix'), get_option('libexecdir'), 'libinput') -config_h.set_quoted('LIBINPUT_TOOL_PATH', libinput_tool_path) -tools_shared_sources = [ 'tools/shared.c', - 'tools/shared.h' ] -deps_tools_shared = [ dep_libinput, dep_libevdev ] -lib_tools_shared = static_library('tools_shared', - tools_shared_sources, - include_directories : [includes_src, includes_include], - dependencies : deps_tools_shared) -dep_tools_shared = declare_dependency(link_with : lib_tools_shared, - dependencies : deps_tools_shared) - -man_config = configuration_data() -man_config.set('LIBINPUT_VERSION', meson.project_version()) - -deps_tools = [ dep_tools_shared, dep_libinput ] -libinput_debug_events_sources = [ 'tools/libinput-debug-events.c' ] -executable('libinput-debug-events', - libinput_debug_events_sources, - dependencies : deps_tools, - include_directories : [includes_src, includes_include], - install_dir : libinput_tool_path, - install : true - ) -configure_file(input : 'tools/libinput-debug-events.man', - output : 'libinput-debug-events.1', - configuration : man_config, - install : true, - install_dir : join_paths(get_option('mandir'), 'man1') - ) - -libinput_list_devices_sources = [ 'tools/libinput-list-devices.c' ] -executable('libinput-list-devices', - libinput_list_devices_sources, - dependencies : deps_tools, - include_directories : [includes_src, includes_include], - install_dir : libinput_tool_path, - install : true, - ) -configure_file(input : 'tools/libinput-list-devices.man', - output : 'libinput-list-devices.1', - configuration : man_config, - install : true, - install_dir : join_paths(get_option('mandir'), 'man1') - ) - -libinput_measure_sources = [ 'tools/libinput-measure.c' ] -executable('libinput-measure', - libinput_measure_sources, - dependencies : deps_tools, - include_directories : [includes_src, includes_include], - install_dir : libinput_tool_path, - install : true, - ) -configure_file(input : 'tools/libinput-measure.man', - output : 'libinput-measure.1', - configuration : man_config, - install : true, - install_dir : join_paths(get_option('mandir'), 'man1') - ) - -install_data('tools/libinput-measure-touchpad-tap', - install_dir : libinput_tool_path) -configure_file(input : 'tools/libinput-measure-touchpad-tap.man', - output : 'libinput-measure-touchpad-tap.1', - configuration : man_config, - install : true, - install_dir : join_paths(get_option('mandir'), 'man1') - ) - -install_data('tools/libinput-measure-touchpad-pressure', - install_dir : libinput_tool_path) -configure_file(input : 'tools/libinput-measure-touchpad-pressure.man', - output : 'libinput-measure-touchpad-pressure.1', - configuration : man_config, - install : true, - install_dir : join_paths(get_option('mandir'), 'man1') - ) -install_data('tools/libinput-measure-touch-size', - install_dir : libinput_tool_path) -configure_file(input : 'tools/libinput-measure-touch-size.man', - output : 'libinput-measure-touch-size.1', - configuration : man_config, - install : true, - install_dir : join_paths(get_option('mandir'), 'man1') - ) - -install_data('tools/libinput-measure-trackpoint-range', - install_dir : libinput_tool_path) -configure_file(input : 'tools/libinput-measure-trackpoint-range.man', - output : 'libinput-measure-trackpoint-range.1', - configuration : man_config, - install : true, - install_dir : join_paths(get_option('mandir'), 'man1') - ) - -if get_option('debug-gui') - dep_gtk = dependency('gtk+-3.0', version : '>= 3.20') - dep_cairo = dependency('cairo') - dep_glib = dependency('glib-2.0') - - debug_gui_sources = [ 'tools/libinput-debug-gui.c' ] - deps_debug_gui = [ - dep_gtk, - dep_cairo, - dep_glib, - ] + deps_tools - executable('libinput-debug-gui', - debug_gui_sources, - dependencies : deps_debug_gui, - include_directories : [includes_src, includes_include], - install_dir : libinput_tool_path, - install : true - ) - configure_file(input : 'tools/libinput-debug-gui.man', - output : 'libinput-debug-gui.1', - configuration : man_config, - install : true, - install_dir : join_paths(get_option('mandir'), 'man1') - ) -endif - -libinput_sources = [ 'tools/libinput-tool.c' ] - -executable('libinput', - libinput_sources, - dependencies : deps_tools, - include_directories : [includes_src, includes_include], - install : true - ) -configure_file(input : 'tools/libinput.man', - output : 'libinput.1', - configuration : man_config, - install : true, - install_dir : join_paths(get_option('mandir'), 'man1') - ) - -meson.add_install_script('tools/install-compat-scripts.sh', - join_paths(get_option('prefix'), get_option('bindir'))) - -ptraccel_debug_sources = [ 'tools/ptraccel-debug.c' ] -executable('ptraccel-debug', - ptraccel_debug_sources, - dependencies : [ dep_libfilter, dep_libinput ], - include_directories : [includes_src, includes_include], - install : false - ) - -############ tests ############ - -if get_option('tests') - dep_check = dependency('check', version : '>= 0.9.10') - valgrind = find_program('valgrind') - addr2line = find_program('addr2line') - - if addr2line.found() - config_h.set('HAVE_ADDR2LINE', '1') - config_h.set_quoted('ADDR2LINE', addr2line.path()) - endif - - dep_libunwind = dependency('libunwind', required : false) - config_h.set10('HAVE_LIBUNWIND', dep_libunwind.found()) - - # for inhibit support during test run - dep_libsystemd = dependency('libsystemd', version : '>= 221', required : false) - config_h.set10('HAVE_LIBSYSTEMD', dep_libsystemd.found()) - - lib_litest_sources = [ - 'test/litest.h', - 'test/litest-int.h', - 'test/litest-device-acer-hawaii-keyboard.c', - 'test/litest-device-acer-hawaii-touchpad.c', - 'test/litest-device-alps-semi-mt.c', - 'test/litest-device-alps-dualpoint.c', - 'test/litest-device-anker-mouse-kbd.c', - 'test/litest-device-apple-appletouch.c', - 'test/litest-device-apple-internal-keyboard.c', - 'test/litest-device-apple-magicmouse.c', - 'test/litest-device-asus-rog-gladius.c', - 'test/litest-device-atmel-hover.c', - 'test/litest-device-bcm5974.c', - 'test/litest-device-calibrated-touchscreen.c', - 'test/litest-device-cyborg-rat-5.c', - 'test/litest-device-elantech-touchpad.c', - 'test/litest-device-generic-singletouch.c', - 'test/litest-device-gpio-keys.c', - 'test/litest-device-huion-pentablet.c', - 'test/litest-device-hp-wmi-hotkeys.c', - 'test/litest-device-ignored-mouse.c', - 'test/litest-device-keyboard.c', - 'test/litest-device-keyboard-all-codes.c', - 'test/litest-device-keyboard-razer-blackwidow.c', - 'test/litest-device-keyboard-razer-blade-stealth.c', - 'test/litest-device-keyboard-razer-blade-stealth-videoswitch.c', - 'test/litest-device-lid-switch.c', - 'test/litest-device-lid-switch-surface3.c', - 'test/litest-device-logitech-trackball.c', - 'test/litest-device-nexus4-touch-screen.c', - 'test/litest-device-magic-trackpad.c', - 'test/litest-device-mouse.c', - 'test/litest-device-mouse-wheel-tilt.c', - 'test/litest-device-mouse-roccat.c', - 'test/litest-device-mouse-low-dpi.c', - 'test/litest-device-mouse-wheel-click-angle.c', - 'test/litest-device-mouse-wheel-click-count.c', - 'test/litest-device-ms-nano-transceiver-mouse.c', - 'test/litest-device-ms-surface-cover.c', - 'test/litest-device-protocol-a-touch-screen.c', - 'test/litest-device-qemu-usb-tablet.c', - 'test/litest-device-synaptics.c', - 'test/litest-device-synaptics-hover.c', - 'test/litest-device-synaptics-i2c.c', - 'test/litest-device-synaptics-rmi4.c', - 'test/litest-device-synaptics-st.c', - 'test/litest-device-synaptics-t440.c', - 'test/litest-device-synaptics-x1-carbon-3rd.c', - 'test/litest-device-thinkpad-extrabuttons.c', - 'test/litest-device-trackpoint.c', - 'test/litest-device-touch-screen.c', - 'test/litest-device-touchscreen-fuzz.c', - 'test/litest-device-uclogic-tablet.c', - 'test/litest-device-wacom-bamboo-2fg-finger.c', - 'test/litest-device-wacom-bamboo-2fg-pad.c', - 'test/litest-device-wacom-bamboo-2fg-pen.c', - 'test/litest-device-wacom-bamboo-16fg-pen.c', - 'test/litest-device-wacom-cintiq-12wx-pen.c', - 'test/litest-device-wacom-cintiq-13hdt-finger.c', - 'test/litest-device-wacom-cintiq-13hdt-pad.c', - 'test/litest-device-wacom-cintiq-13hdt-pen.c', - 'test/litest-device-wacom-cintiq-24hd-pen.c', - 'test/litest-device-wacom-cintiq-24hdt-pad.c', - 'test/litest-device-wacom-ekr.c', - 'test/litest-device-wacom-hid4800-pen.c', - 'test/litest-device-wacom-intuos3-pad.c', - 'test/litest-device-wacom-intuos5-finger.c', - 'test/litest-device-wacom-intuos5-pad.c', - 'test/litest-device-wacom-intuos5-pen.c', - 'test/litest-device-wacom-isdv4-e6-pen.c', - 'test/litest-device-wacom-isdv4-e6-finger.c', - 'test/litest-device-wacom-mobilestudio-pro-pad.c', - 'test/litest-device-waltop-tablet.c', - 'test/litest-device-wheel-only.c', - 'test/litest-device-xen-virtual-pointer.c', - 'test/litest-device-vmware-virtual-usb-mouse.c', - 'test/litest-device-yubikey.c', - 'test/litest.c' - ] - - dep_dl = cc.find_library('dl') - deps_litest = [ - dep_libinput, - dep_check, - dep_libunwind, - dep_udev, - dep_libevdev, - dep_dl, - dep_lm, - dep_libsystemd, - ] - - configure_file(input : 'udev/80-libinput-test-device.rules', - output : '80-libinput-test-device.rules', - install : false, - configuration : udev_rules_config) - - config_h.set_quoted('LIBINPUT_MODEL_QUIRKS_UDEV_RULES_FILE', - join_paths(meson.build_root(), '90-libinput-model-quirks.rules')) - config_h.set_quoted('LIBINPUT_MODEL_QUIRKS_UDEV_HWDB_FILE', - join_paths(meson.build_root(), '90-libinput-model-quirks.hwdb')) - config_h.set_quoted('LIBINPUT_TEST_DEVICE_RULES_FILE', - join_paths(meson.build_root(), '80-libinput-test-device.rules')) - config_h.set_quoted('LIBINPUT_DEVICE_GROUPS_RULES_FILE', - join_paths(meson.build_root(), '80-libinput-device-groups.rules')) - lib_litest = static_library('litest', - lib_litest_sources, - include_directories : [includes_src, includes_include], - dependencies : deps_litest) - dep_litest = declare_dependency(link_with : lib_litest, - dependencies : deps_litest) - - def_no_main = '-DLITEST_NO_MAIN' - def_disable_backtrace = '-DLITEST_DISABLE_BACKTRACE_LOGGING' - defs_litest_selftest = [ - def_no_main, - def_disable_backtrace - ] - test_litest_selftest_sources = lib_litest_sources + [ - 'test/litest-selftest.c', - 'test/litest.c', - 'test/litest-int.h', - 'test/litest.h' - ] - test_litest_selftest = executable('test-litest-selftest', - test_litest_selftest_sources, - include_directories : [includes_src, includes_include], - dependencies : deps_litest, - c_args : defs_litest_selftest, - install : false) - test('test-litest-selftest', test_litest_selftest) - - test_symbols_leak = find_program('test/symbols-leak-test.in') - test('symbols-leak-test', - test_symbols_leak, - args : [ meson.current_source_dir() ]) - - libinput_test_runner_sources = lib_litest_sources + [ - 'src/libinput-util.h', - 'src/libinput-util.c', - 'test/test-udev.c', - 'test/test-path.c', - 'test/test-pointer.c', - 'test/test-touch.c', - 'test/test-log.c', - 'test/test-tablet.c', - 'test/test-pad.c', - 'test/test-touchpad.c', - 'test/test-touchpad-tap.c', - 'test/test-touchpad-buttons.c', - 'test/test-trackpoint.c', - 'test/test-trackball.c', - 'test/test-misc.c', - 'test/test-keyboard.c', - 'test/test-device.c', - 'test/test-gestures.c', - 'test/test-switch.c' - ] - def_LT_VERSION = '-DLIBINPUT_LT_VERSION="@0@:@1@:@2@"'.format(libinput_lt_c, libinput_lt_r, libinput_lt_a) - libinput_test_runner = executable('libinput-test-suite-runner', - libinput_test_runner_sources, - include_directories : [includes_src, includes_include], - dependencies : deps_litest, - c_args : [ def_LT_VERSION ], - install : false) - test('libinput-test-suite-runner', - libinput_test_runner, - timeout : 1200) - - # build-test only - executable('test-build-pedantic', - 'test/build-pedantic.c', - dependencies : [dep_udev], - include_directories : [includes_src, includes_include], - c_args : ['-std=c99', '-pedantic', '-Werror'], - install : false) - # build-test only - executable('test-build-std-gnuc90', - 'test/build-pedantic.c', - dependencies : [dep_udev], - include_directories : [includes_src, includes_include], - c_args : ['-std=gnu90', '-Werror'], - install : false) - # test for linking with the minimal linker flags - executable('test-build-linker', - 'test/build-pedantic.c', - include_directories : [includes_src, includes_include], - dependencies : [ dep_libinput, dep_libinput_util ], - install : false) - # test including from C++ - executable('test-build-cxx', - 'test/build-cxx.cc', - dependencies : [dep_udev], - include_directories : [includes_src, includes_include], - install : false) - - valgrind_env = environment() - valgrind_env.set('CK_FORK', 'no') - valgrind_env.set('USING_VALGRIND', '1') - valgrind_suppressions_file = join_paths(meson.source_root(), 'test', 'valgrind.suppressions') - add_test_setup('valgrind', - exe_wrapper : [ valgrind, - '--leak-check=full', - '--error-exitcode=3', - '--suppressions=' + valgrind_suppressions_file ], - env : valgrind_env, - timeout_multiplier : 100) -endif -############ output files ############ -configure_file(output : 'config.h', install : false, configuration : config_h) diff -Nru libinput-1.10.3/meson_options.txt libinput-0.21.0/meson_options.txt --- libinput-1.10.3/meson_options.txt 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/meson_options.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -option('udev-dir', - type: 'string', - value: '', - description: 'udev base directory [default=$prefix/lib/udev]') -option('libwacom', - type: 'boolean', - value: true, - description: 'Use libwacom for tablet identification (default=true)') -option('debug-gui', - type: 'boolean', - value: true, - description: 'Enable the "debug-gui" feature in the libinput tool [default=true]') -option('tests', - type: 'boolean', - value: true, - description: 'Build the tests [default=true]') -option('documentation', - type: 'boolean', - value: true, - description: 'Build the documentation [default=true]') diff -Nru libinput-1.10.3/missing libinput-0.21.0/missing --- libinput-1.10.3/missing 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/missing 2015-08-04 00:31:39.000000000 +0000 @@ -0,0 +1,215 @@ +#! /bin/sh +# Common wrapper for a few potentially missing GNU programs. + +scriptversion=2013-10-28.13; # UTC + +# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Originally written by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try '$0 --help' for more information" + exit 1 +fi + +case $1 in + + --is-lightweight) + # Used by our autoconf macros to check whether the available missing + # script is modern enough. + exit 0 + ;; + + --run) + # Back-compat with the calling convention used by older automake. + shift + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due +to PROGRAM being missing or too old. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man + +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" + exit 1 + ;; + +esac + +# Run the given program, remember its exit status. +"$@"; st=$? + +# If it succeeded, we are done. +test $st -eq 0 && exit 0 + +# Also exit now if we it failed (or wasn't found), and '--version' was +# passed; such an option is passed most likely to detect whether the +# program is present and works. +case $2 in --version|--help) exit $st;; esac + +# Exit code 63 means version mismatch. This often happens when the user +# tries to use an ancient version of a tool on a file that requires a +# minimum version. +if test $st -eq 63; then + msg="probably too old" +elif test $st -eq 127; then + # Program was missing. + msg="missing on your system" +else + # Program was found and executed, but failed. Give up. + exit $st +fi + +perl_URL=http://www.perl.org/ +flex_URL=http://flex.sourceforge.net/ +gnu_software_URL=http://www.gnu.org/software + +program_details () +{ + case $1 in + aclocal|automake) + echo "The '$1' program is part of the GNU Automake package:" + echo "<$gnu_software_URL/automake>" + echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/autoconf>" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + autoconf|autom4te|autoheader) + echo "The '$1' program is part of the GNU Autoconf package:" + echo "<$gnu_software_URL/autoconf/>" + echo "It also requires GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + esac +} + +give_advice () +{ + # Normalize program name to check for. + normalized_program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + + printf '%s\n' "'$1' is $msg." + + configure_deps="'configure.ac' or m4 files included by 'configure.ac'" + case $normalized_program in + autoconf*) + echo "You should only need it if you modified 'configure.ac'," + echo "or m4 files included by it." + program_details 'autoconf' + ;; + autoheader*) + echo "You should only need it if you modified 'acconfig.h' or" + echo "$configure_deps." + program_details 'autoheader' + ;; + automake*) + echo "You should only need it if you modified 'Makefile.am' or" + echo "$configure_deps." + program_details 'automake' + ;; + aclocal*) + echo "You should only need it if you modified 'acinclude.m4' or" + echo "$configure_deps." + program_details 'aclocal' + ;; + autom4te*) + echo "You might have modified some maintainer files that require" + echo "the 'autom4te' program to be rebuilt." + program_details 'autom4te' + ;; + bison*|yacc*) + echo "You should only need it if you modified a '.y' file." + echo "You may want to install the GNU Bison package:" + echo "<$gnu_software_URL/bison/>" + ;; + lex*|flex*) + echo "You should only need it if you modified a '.l' file." + echo "You may want to install the Fast Lexical Analyzer package:" + echo "<$flex_URL>" + ;; + help2man*) + echo "You should only need it if you modified a dependency" \ + "of a man page." + echo "You may want to install the GNU Help2man package:" + echo "<$gnu_software_URL/help2man/>" + ;; + makeinfo*) + echo "You should only need it if you modified a '.texi' file, or" + echo "any other file indirectly affecting the aspect of the manual." + echo "You might want to install the Texinfo package:" + echo "<$gnu_software_URL/texinfo/>" + echo "The spurious makeinfo call might also be the consequence of" + echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" + echo "want to install GNU make:" + echo "<$gnu_software_URL/make/>" + ;; + *) + echo "You might have modified some files without having the proper" + echo "tools for further handling them. Check the 'README' file, it" + echo "often tells you about the needed prerequisites for installing" + echo "this package. You may also peek at any GNU archive site, in" + echo "case some other package contains this missing '$1' program." + ;; + esac +} + +give_advice "$1" | sed -e '1s/^/WARNING: /' \ + -e '2,$s/^/ /' >&2 + +# Propagate the correct exit status (expected to be 127 for a program +# not found, 63 for a program that failed due to version mismatch). +exit $st + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru libinput-1.10.3/README.md libinput-0.21.0/README.md --- libinput-1.10.3/README.md 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/README.md 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -libinput -======== - -libinput is a library that handles input devices for display servers and other -applications that need to directly deal with input devices. - -It provides device detection, device handling, input device event processing -and abstraction so minimize the amount of custom input code the user of -libinput need to provide the common set of functionality that users expect. -Input event processing includes scaling touch coordinates, generating -pointer events from touchpads, pointer acceleration, etc. - -libinput originates from -[weston](http://cgit.freedesktop.org/wayland/weston/), the Wayland reference -compositor. - -Architecture ------------- - -libinput is not used directly by applications, rather it is used by the -xf86-input-libinput X.Org driver or wayland compositors. The typical -software stack for a system running Wayland is: - -@dotfile libinput-stack-wayland.gv - -Where the Wayland compositor may be Weston, mutter, KWin, etc. Note that -Wayland encourages the use of toolkits, so the Wayland client (your -application) does not usually talk directly to the compositor but rather -employs a toolkit (e.g. GTK) to do so. - -The simplified software stack for a system running X.Org is: - -@dotfile libinput-stack-xorg.gv - -Again, on a modern system the application does not usually talk directly to -the X server using Xlib but rather employs a toolkit to do so. - -Source code ------------ - -The source code of libinput can be found at: -http://cgit.freedesktop.org/wayland/libinput - -For a list of current and past releases visit: -http://www.freedesktop.org/wiki/Software/libinput/ - -Build instructions: -http://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html - -Reporting Bugs --------------- - -Bugs can be filed in the libinput component of Wayland: -https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=libinput - -Where possible, please provide an -[evemu](http://www.freedesktop.org/wiki/Evemu/) recording of the input -device and/or the event sequence in question. - -See @ref reporting_bugs for more info. - -Documentation -------------- - -- Developer API documentation: http://wayland.freedesktop.org/libinput/doc/latest/modules.html -- High-level documentation about libinput's features: -http://wayland.freedesktop.org/libinput/doc/latest/pages.html -- Build instructions: -http://wayland.freedesktop.org/libinput/doc/latest/building_libinput.html -- Documentation for previous versions of libinput: https://wayland.freedesktop.org/libinput/doc/ - -Examples of how to use libinput are the debugging tools in the libinput -repository. Developers are encouraged to look at those tools for a -real-world (yet simple) example on how to use libinput. - -- A commandline debugging tool: https://cgit.freedesktop.org/wayland/libinput/tree/tools/libinput-debug-events.c -- A GTK application that draws cursor/touch/tablet positions: https://cgit.freedesktop.org/wayland/libinput/tree/tools/libinput-debug-gui.c - -License -------- - -libinput is licensed under the MIT license. - -> 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: [...] - -See the [COPYING](http://cgit.freedesktop.org/wayland/libinput/tree/COPYING) -file for the full license information. diff -Nru libinput-1.10.3/README.txt libinput-0.21.0/README.txt --- libinput-1.10.3/README.txt 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/README.txt 2015-08-03 03:44:47.000000000 +0000 @@ -0,0 +1,85 @@ +/*!@mainpage + +libinput +======== + +libinput is a library that handles input devices for display servers and other +applications that need to directly deal with input devices. + +It provides device detection, device handling, input device event processing +and abstraction so minimize the amount of custom input code the user of +libinput need to provide the common set of functionality that users expect. +Input event processing includes scaling touch coordinates, generating +pointer events from touchpads, pointer acceleration, etc. + +libinput originates from +[weston](http://cgit.freedesktop.org/wayland/weston/), the Wayland reference +compositor. + +Architecture +------------ + +libinput is not used directly by applications, rather it is used by the +xf86-input-libinput X.Org driver or wayland compositors. The typical +software stack for a system running Wayland is: + +@dotfile libinput-stack-wayland.gv + +Where the Wayland compositor may be Weston, mutter, KWin, etc. Note that +Wayland encourages the use of toolkits, so the Wayland client (your +application) does not usually talk directly to the compositor but rather +employs a toolkit (e.g. GTK) to do so. + +The simplified software stack for a system running X.Org is: + +@dotfile libinput-stack-xorg.gv + +Again, on a modern system the application does not usually talk directly to +the X server using Xlib but rather employs a toolkit to do so. + +Source code +----------- + +The source code of libinput can be found at: +http://cgit.freedesktop.org/wayland/libinput + +For a list of current and past releases visit: +http://www.freedesktop.org/wiki/Software/libinput/ + +Reporting Bugs +-------------- + +Bugs can be filed in the libinput component of Wayland: +https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=libinput + +Where possible, please provide an +[evemu](http://www.freedesktop.org/wiki/Evemu/) recording of the input +device and/or the event sequence in question. + +See @ref reporting_bugs for more info. + +Documentation +------------- + +Developer API documentation: +http://wayland.freedesktop.org/libinput/doc/latest/modules.html + +High-level documentation about libinput's features: +http://wayland.freedesktop.org/libinput/doc/latest/pages.html + +License +------- + +libinput is licensed under the MIT license. + +> 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: [...] + +See the [COPYING](http://cgit.freedesktop.org/wayland/libinput/tree/COPYING) +file for the full license information. + +*/ diff -Nru libinput-1.10.3/src/evdev.c libinput-0.21.0/src/evdev.c --- libinput-1.10.3/src/evdev.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev.c 2015-08-03 04:55:20.000000000 +0000 @@ -1,8 +1,7 @@ /* * Copyright © 2010 Intel Corporation * Copyright © 2013 Jonas Ådahl - * Copyright © 2013-2017 Red Hat, Inc. - * Copyright © 2017 James Ye + * Copyright © 2013-2015 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -44,12 +43,14 @@ #include "filter.h" #include "libinput-private.h" -#if HAVE_LIBWACOM -#include -#endif - #define DEFAULT_WHEEL_CLICK_ANGLE 15 -#define DEFAULT_BUTTON_SCROLL_TIMEOUT ms2us(200) +#define DEFAULT_MIDDLE_BUTTON_SCROLL_TIMEOUT ms2us(200) + +enum evdev_key_type { + EVDEV_KEY_TYPE_NONE, + EVDEV_KEY_TYPE_KEY, + EVDEV_KEY_TYPE_BUTTON, +}; enum evdev_device_udev_tags { EVDEV_UDEV_TAG_INPUT = (1 << 0), @@ -60,10 +61,8 @@ EVDEV_UDEV_TAG_TABLET = (1 << 5), EVDEV_UDEV_TAG_JOYSTICK = (1 << 6), EVDEV_UDEV_TAG_ACCELEROMETER = (1 << 7), - EVDEV_UDEV_TAG_TABLET_PAD = (1 << 8), + EVDEV_UDEV_TAG_BUTTONSET = (1 << 8), EVDEV_UDEV_TAG_POINTINGSTICK = (1 << 9), - EVDEV_UDEV_TAG_TRACKBALL = (1 << 10), - EVDEV_UDEV_TAG_SWITCH = (1 << 11), }; struct evdev_udev_tag_match { @@ -79,39 +78,35 @@ {"ID_INPUT_TOUCHPAD", EVDEV_UDEV_TAG_TOUCHPAD}, {"ID_INPUT_TOUCHSCREEN", EVDEV_UDEV_TAG_TOUCHSCREEN}, {"ID_INPUT_TABLET", EVDEV_UDEV_TAG_TABLET}, - {"ID_INPUT_TABLET_PAD", EVDEV_UDEV_TAG_TABLET_PAD}, + {"ID_INPUT_TABLET_PAD", EVDEV_UDEV_TAG_BUTTONSET}, {"ID_INPUT_JOYSTICK", EVDEV_UDEV_TAG_JOYSTICK}, {"ID_INPUT_ACCELEROMETER", EVDEV_UDEV_TAG_ACCELEROMETER}, {"ID_INPUT_POINTINGSTICK", EVDEV_UDEV_TAG_POINTINGSTICK}, - {"ID_INPUT_TRACKBALL", EVDEV_UDEV_TAG_TRACKBALL}, - {"ID_INPUT_SWITCH", EVDEV_UDEV_TAG_SWITCH}, + + /* sentinel value */ + { 0 }, }; -static inline bool -parse_udev_flag(struct evdev_device *device, - struct udev_device *udev_device, - const char *property) +static void +hw_set_key_down(struct evdev_device *device, int code, int pressed) { - const char *val; + long_set_bit_state(device->hw_key_mask, code, pressed); +} - val = udev_device_get_property_value(udev_device, property); - if (!val) - return false; +static int +hw_is_key_down(struct evdev_device *device, int code) +{ + return long_bit_is_set(device->hw_key_mask, code); +} - if (streq(val, "1")) - return true; - if (!streq(val, "0")) - evdev_log_error(device, - "property %s has invalid value '%s'\n", - property, - val); - return false; +static int +get_key_down_count(struct evdev_device *device, int code) +{ + return device->key_count[code]; } -int -evdev_update_key_down_count(struct evdev_device *device, - int code, - int pressed) +static int +update_key_down_count(struct evdev_device *device, int code, int pressed) { int key_count; assert(code >= 0 && code < KEY_CNT); @@ -124,23 +119,27 @@ } if (key_count > 32) { - evdev_log_bug_libinput(device, - "key count for %s reached abnormal values\n", - libevdev_event_code_get_name(EV_KEY, code)); + log_bug_libinput(device->base.seat->libinput, + "Key count for %s reached abnormal values\n", + libevdev_event_code_get_name(EV_KEY, code)); } return key_count; } -enum libinput_switch_state -evdev_device_switch_get_state(struct evdev_device *device, - enum libinput_switch sw) +void +evdev_keyboard_notify_key(struct evdev_device *device, + uint64_t time, + int key, + enum libinput_key_state state) { - struct evdev_dispatch *dispatch = device->dispatch; + int down_count; - assert(dispatch->interface->get_switch_state); + down_count = update_key_down_count(device, key, state); - return dispatch->interface->get_switch_state(dispatch, sw); + if ((state == LIBINPUT_KEY_STATE_PRESSED && down_count == 1) || + (state == LIBINPUT_KEY_STATE_RELEASED && down_count == 0)) + keyboard_notify_key(&device->base, time, key, state); } void @@ -155,21 +154,18 @@ state)) return; - evdev_pointer_notify_button(device, - time, - (unsigned int)button, - state); + evdev_pointer_notify_button(device, time, button, state); } -static void -evdev_pointer_post_button(struct evdev_device *device, - uint64_t time, - unsigned int button, - enum libinput_button_state state) +void +evdev_pointer_notify_button(struct evdev_device *device, + uint64_t time, + int button, + enum libinput_button_state state) { int down_count; - down_count = evdev_update_key_down_count(device, button, state); + down_count = update_key_down_count(device, button, state); if ((state == LIBINPUT_BUTTON_STATE_PRESSED && down_count == 1) || (state == LIBINPUT_BUTTON_STATE_RELEASED && down_count == 0)) { @@ -186,94 +182,11 @@ } -static void -evdev_button_scroll_timeout(uint64_t time, void *data) -{ - struct evdev_device *device = data; - - device->scroll.button_scroll_state = BUTTONSCROLL_READY; -} - -static void -evdev_button_scroll_button(struct evdev_device *device, - uint64_t time, int is_press) -{ - if (is_press) { - enum timer_flags flags = TIMER_FLAG_NONE; - - device->scroll.button_scroll_state = BUTTONSCROLL_BUTTON_DOWN; - - /* Special case: if middle button emulation is enabled and - * our scroll button is the left or right button, we only - * get here *after* the middle button timeout has expired - * for that button press. The time passed is the button-down - * time though (which is in the past), so we have to allow - * for a negative timer to be set. - */ - if (device->middlebutton.enabled && - (device->scroll.button == BTN_LEFT || - device->scroll.button == BTN_RIGHT)) { - flags = TIMER_FLAG_ALLOW_NEGATIVE; - } - - libinput_timer_set_flags(&device->scroll.timer, - time + DEFAULT_BUTTON_SCROLL_TIMEOUT, - flags); - device->scroll.button_down_time = time; - evdev_log_debug(device, "btnscroll: down\n"); - } else { - libinput_timer_cancel(&device->scroll.timer); - switch(device->scroll.button_scroll_state) { - case BUTTONSCROLL_IDLE: - evdev_log_bug_libinput(device, - "invalid state IDLE for button up\n"); - break; - case BUTTONSCROLL_BUTTON_DOWN: - case BUTTONSCROLL_READY: - evdev_log_debug(device, "btnscroll: cancel\n"); - - /* If the button is released quickly enough or - * without scroll events, emit the - * button press/release events. */ - evdev_pointer_post_button(device, - device->scroll.button_down_time, - device->scroll.button, - LIBINPUT_BUTTON_STATE_PRESSED); - evdev_pointer_post_button(device, time, - device->scroll.button, - LIBINPUT_BUTTON_STATE_RELEASED); - break; - case BUTTONSCROLL_SCROLLING: - evdev_log_debug(device, "btnscroll: up\n"); - evdev_stop_scroll(device, time, - LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS); - break; - } - - device->scroll.button_scroll_state = BUTTONSCROLL_IDLE; - } -} - -void -evdev_pointer_notify_button(struct evdev_device *device, - uint64_t time, - unsigned int button, - enum libinput_button_state state) -{ - if (device->scroll.method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN && - button == device->scroll.button) { - evdev_button_scroll_button(device, time, state); - return; - } - - evdev_pointer_post_button(device, time, button, state); -} - void evdev_device_led_update(struct evdev_device *device, enum libinput_led leds) { static const struct { - enum libinput_led libinput; + enum libinput_led weston; int evdev; } map[] = { { LIBINPUT_LED_NUM_LOCK, LED_NUML }, @@ -290,7 +203,7 @@ for (i = 0; i < ARRAY_LENGTH(map); i++) { ev[i].type = EV_LED; ev[i].code = map[i].evdev; - ev[i].value = !!(leds & map[i].libinput); + ev[i].value = !!(leds & map[i].weston); } ev[i].type = EV_SYN; ev[i].code = SYN_REPORT; @@ -299,9 +212,9 @@ (void)i; /* no, we really don't care about the return value */ } -void -evdev_transform_absolute(struct evdev_device *device, - struct device_coords *point) +static void +transform_absolute(struct evdev_device *device, + struct device_coords *point) { if (!device->abs.apply_calibration) return; @@ -309,19 +222,6 @@ matrix_mult_vec(&device->abs.calibration, &point->x, &point->y); } -void -evdev_transform_relative(struct evdev_device *device, - struct device_coords *point) -{ - struct matrix rel_matrix; - - if (!device->abs.apply_calibration) - return; - - matrix_to_relative(&rel_matrix, &device->abs.calibration); - matrix_mult_vec(&rel_matrix, &point->x, &point->y); -} - static inline double scale_axis(const struct input_absinfo *absinfo, double val, double to_range) { @@ -345,7 +245,374 @@ return scale_axis(device->abs.absinfo_y, y, height); } -void +static inline void +normalize_delta(struct evdev_device *device, + const struct device_coords *delta, + struct normalized_coords *normalized) +{ + normalized->x = delta->x * DEFAULT_MOUSE_DPI / (double)device->dpi; + normalized->y = delta->y * DEFAULT_MOUSE_DPI / (double)device->dpi; +} + +static inline bool +evdev_post_trackpoint_scroll(struct evdev_device *device, + struct normalized_coords unaccel, + uint64_t time) +{ + if (device->scroll.method != LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN || + !hw_is_key_down(device, device->scroll.button)) + return false; + + if (device->scroll.button_scroll_active) + evdev_post_scroll(device, time, + LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS, + &unaccel); + + return true; +} + +static void +evdev_flush_pending_event(struct evdev_device *device, uint64_t time) +{ + struct libinput *libinput = device->base.seat->libinput; + int slot; + int seat_slot; + struct libinput_device *base = &device->base; + struct libinput_seat *seat = base->seat; + struct normalized_coords accel, unaccel; + struct device_coords point; + struct device_float_coords raw; + + slot = device->mt.slot; + + switch (device->pending_event) { + case EVDEV_NONE: + return; + case EVDEV_RELATIVE_MOTION: + normalize_delta(device, &device->rel, &unaccel); + raw.x = device->rel.x; + raw.y = device->rel.y; + device->rel.x = 0; + device->rel.y = 0; + + /* Use unaccelerated deltas for pointing stick scroll */ + if (evdev_post_trackpoint_scroll(device, unaccel, time)) + break; + + /* Apply pointer acceleration. */ + accel = filter_dispatch(device->pointer.filter, + &unaccel, + device, + time); + + if (normalized_is_zero(accel) && normalized_is_zero(unaccel)) + break; + + pointer_notify_motion(base, time, &accel, &raw); + break; + case EVDEV_ABSOLUTE_MT_DOWN: + if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) + break; + + if (device->mt.slots[slot].seat_slot != -1) { + log_bug_kernel(libinput, + "%s: Driver sent multiple touch down for the " + "same slot", + udev_device_get_devnode(device->udev_device)); + break; + } + + seat_slot = ffs(~seat->slot_map) - 1; + device->mt.slots[slot].seat_slot = seat_slot; + + if (seat_slot == -1) + break; + + seat->slot_map |= 1 << seat_slot; + point = device->mt.slots[slot].point; + transform_absolute(device, &point); + + touch_notify_touch_down(base, time, slot, seat_slot, + &point); + break; + case EVDEV_ABSOLUTE_MT_MOTION: + if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) + break; + + seat_slot = device->mt.slots[slot].seat_slot; + point = device->mt.slots[slot].point; + + if (seat_slot == -1) + break; + + transform_absolute(device, &point); + touch_notify_touch_motion(base, time, slot, seat_slot, + &point); + break; + case EVDEV_ABSOLUTE_MT_UP: + if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) + break; + + seat_slot = device->mt.slots[slot].seat_slot; + device->mt.slots[slot].seat_slot = -1; + + if (seat_slot == -1) + break; + + seat->slot_map &= ~(1 << seat_slot); + + touch_notify_touch_up(base, time, slot, seat_slot); + break; + case EVDEV_ABSOLUTE_TOUCH_DOWN: + if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) + break; + + if (device->abs.seat_slot != -1) { + log_bug_kernel(libinput, + "%s: Driver sent multiple touch down for the " + "same slot", + udev_device_get_devnode(device->udev_device)); + break; + } + + seat_slot = ffs(~seat->slot_map) - 1; + device->abs.seat_slot = seat_slot; + + if (seat_slot == -1) + break; + + seat->slot_map |= 1 << seat_slot; + + point = device->abs.point; + transform_absolute(device, &point); + + touch_notify_touch_down(base, time, -1, seat_slot, &point); + break; + case EVDEV_ABSOLUTE_MOTION: + point = device->abs.point; + transform_absolute(device, &point); + + if (device->seat_caps & EVDEV_DEVICE_TOUCH) { + seat_slot = device->abs.seat_slot; + + if (seat_slot == -1) + break; + + touch_notify_touch_motion(base, time, -1, seat_slot, + &point); + } else if (device->seat_caps & EVDEV_DEVICE_POINTER) { + pointer_notify_motion_absolute(base, time, &point); + } + break; + case EVDEV_ABSOLUTE_TOUCH_UP: + if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) + break; + + seat_slot = device->abs.seat_slot; + device->abs.seat_slot = -1; + + if (seat_slot == -1) + break; + + seat->slot_map &= ~(1 << seat_slot); + + touch_notify_touch_up(base, time, -1, seat_slot); + break; + default: + assert(0 && "Unknown pending event type"); + break; + } + + device->pending_event = EVDEV_NONE; +} + +static enum evdev_key_type +get_key_type(uint16_t code) +{ + if (code == BTN_TOUCH) + return EVDEV_KEY_TYPE_NONE; + + if (code >= KEY_ESC && code <= KEY_MICMUTE) + return EVDEV_KEY_TYPE_KEY; + if (code >= BTN_MISC && code <= BTN_GEAR_UP) + return EVDEV_KEY_TYPE_BUTTON; + if (code >= KEY_OK && code <= KEY_LIGHTS_TOGGLE) + return EVDEV_KEY_TYPE_KEY; + if (code >= BTN_DPAD_UP && code <= BTN_TRIGGER_HAPPY40) + return EVDEV_KEY_TYPE_BUTTON; + return EVDEV_KEY_TYPE_NONE; +} + +static void +evdev_button_scroll_timeout(uint64_t time, void *data) +{ + struct evdev_device *device = data; + + device->scroll.button_scroll_active = true; +} + +static void +evdev_button_scroll_button(struct evdev_device *device, + uint64_t time, int is_press) +{ + if (is_press) { + libinput_timer_set(&device->scroll.timer, + time + DEFAULT_MIDDLE_BUTTON_SCROLL_TIMEOUT); + device->scroll.button_down_time = time; + } else { + libinput_timer_cancel(&device->scroll.timer); + if (device->scroll.button_scroll_active) { + evdev_stop_scroll(device, time, + LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS); + device->scroll.button_scroll_active = false; + } else { + /* If the button is released quickly enough emit the + * button press/release events. */ + evdev_pointer_notify_physical_button(device, + device->scroll.button_down_time, + device->scroll.button, + LIBINPUT_BUTTON_STATE_PRESSED); + evdev_pointer_notify_physical_button(device, time, + device->scroll.button, + LIBINPUT_BUTTON_STATE_RELEASED); + } + } +} + +static void +evdev_process_touch_button(struct evdev_device *device, + uint64_t time, int value) +{ + if (device->pending_event != EVDEV_NONE && + device->pending_event != EVDEV_ABSOLUTE_MOTION) + evdev_flush_pending_event(device, time); + + device->pending_event = (value ? + EVDEV_ABSOLUTE_TOUCH_DOWN : + EVDEV_ABSOLUTE_TOUCH_UP); +} + +static inline void +evdev_process_key(struct evdev_device *device, + struct input_event *e, uint64_t time) +{ + enum evdev_key_type type; + + /* ignore kernel key repeat */ + if (e->value == 2) + return; + + if (e->code == BTN_TOUCH) { + if (!device->is_mt) + evdev_process_touch_button(device, time, e->value); + return; + } + + evdev_flush_pending_event(device, time); + + type = get_key_type(e->code); + + /* Ignore key release events from the kernel for keys that libinput + * never got a pressed event for. */ + if (e->value == 0) { + switch (type) { + case EVDEV_KEY_TYPE_NONE: + break; + case EVDEV_KEY_TYPE_KEY: + case EVDEV_KEY_TYPE_BUTTON: + if (!hw_is_key_down(device, e->code)) + return; + } + } + + hw_set_key_down(device, e->code, e->value); + + switch (type) { + case EVDEV_KEY_TYPE_NONE: + break; + case EVDEV_KEY_TYPE_KEY: + evdev_keyboard_notify_key( + device, + time, + e->code, + e->value ? LIBINPUT_KEY_STATE_PRESSED : + LIBINPUT_KEY_STATE_RELEASED); + break; + case EVDEV_KEY_TYPE_BUTTON: + if (device->scroll.method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN && + e->code == device->scroll.button) { + evdev_button_scroll_button(device, time, e->value); + break; + } + evdev_pointer_notify_physical_button( + device, + time, + evdev_to_left_handed(device, e->code), + e->value ? LIBINPUT_BUTTON_STATE_PRESSED : + LIBINPUT_BUTTON_STATE_RELEASED); + break; + } +} + +static void +evdev_process_touch(struct evdev_device *device, + struct input_event *e, + uint64_t time) +{ + switch (e->code) { + case ABS_MT_SLOT: + if ((size_t)e->value >= device->mt.slots_len) { + log_bug_libinput(device->base.seat->libinput, + "%s exceeds slots (%d of %zd)\n", + device->devname, + e->value, + device->mt.slots_len); + e->value = device->mt.slots_len - 1; + } + evdev_flush_pending_event(device, time); + device->mt.slot = e->value; + break; + case ABS_MT_TRACKING_ID: + if (device->pending_event != EVDEV_NONE && + device->pending_event != EVDEV_ABSOLUTE_MT_MOTION) + evdev_flush_pending_event(device, time); + if (e->value >= 0) + device->pending_event = EVDEV_ABSOLUTE_MT_DOWN; + else + device->pending_event = EVDEV_ABSOLUTE_MT_UP; + break; + case ABS_MT_POSITION_X: + device->mt.slots[device->mt.slot].point.x = e->value; + if (device->pending_event == EVDEV_NONE) + device->pending_event = EVDEV_ABSOLUTE_MT_MOTION; + break; + case ABS_MT_POSITION_Y: + device->mt.slots[device->mt.slot].point.y = e->value; + if (device->pending_event == EVDEV_NONE) + device->pending_event = EVDEV_ABSOLUTE_MT_MOTION; + break; + } +} + +static inline void +evdev_process_absolute_motion(struct evdev_device *device, + struct input_event *e) +{ + switch (e->code) { + case ABS_X: + device->abs.point.x = e->value; + if (device->pending_event == EVDEV_NONE) + device->pending_event = EVDEV_ABSOLUTE_MOTION; + break; + case ABS_Y: + device->abs.point.y = e->value; + if (device->pending_event == EVDEV_NONE) + device->pending_event = EVDEV_ABSOLUTE_MOTION; + break; + } +} + +static void evdev_notify_axis(struct evdev_device *device, uint64_t time, uint32_t axes, @@ -371,6 +638,101 @@ &discrete); } +static inline void +evdev_process_relative(struct evdev_device *device, + struct input_event *e, uint64_t time) +{ + struct normalized_coords wheel_degrees = { 0.0, 0.0 }; + struct discrete_coords discrete = { 0.0, 0.0 }; + + switch (e->code) { + case REL_X: + if (device->pending_event != EVDEV_RELATIVE_MOTION) + evdev_flush_pending_event(device, time); + device->rel.x += e->value; + device->pending_event = EVDEV_RELATIVE_MOTION; + break; + case REL_Y: + if (device->pending_event != EVDEV_RELATIVE_MOTION) + evdev_flush_pending_event(device, time); + device->rel.y += e->value; + device->pending_event = EVDEV_RELATIVE_MOTION; + break; + case REL_WHEEL: + evdev_flush_pending_event(device, time); + wheel_degrees.y = -1 * e->value * + device->scroll.wheel_click_angle; + discrete.y = -1 * e->value; + evdev_notify_axis( + device, + time, + AS_MASK(LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL), + LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, + &wheel_degrees, + &discrete); + break; + case REL_HWHEEL: + evdev_flush_pending_event(device, time); + wheel_degrees.x = e->value * device->scroll.wheel_click_angle; + discrete.x = e->value; + evdev_notify_axis( + device, + time, + AS_MASK(LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL), + LIBINPUT_POINTER_AXIS_SOURCE_WHEEL, + &wheel_degrees, + &discrete); + break; + } +} + +static inline void +evdev_process_absolute(struct evdev_device *device, + struct input_event *e, + uint64_t time) +{ + if (device->is_mt) { + evdev_process_touch(device, e, time); + } else { + evdev_process_absolute_motion(device, e); + } +} + +static inline bool +evdev_any_button_down(struct evdev_device *device) +{ + unsigned int button; + + for (button = BTN_LEFT; button < BTN_JOYSTICK; button++) { + if (libevdev_has_event_code(device->evdev, EV_KEY, button) && + hw_is_key_down(device, button)) + return true; + } + return false; +} + +static inline bool +evdev_need_touch_frame(struct evdev_device *device) +{ + if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) + return false; + + switch (device->pending_event) { + case EVDEV_NONE: + case EVDEV_RELATIVE_MOTION: + break; + case EVDEV_ABSOLUTE_MT_DOWN: + case EVDEV_ABSOLUTE_MT_MOTION: + case EVDEV_ABSOLUTE_MT_UP: + case EVDEV_ABSOLUTE_TOUCH_DOWN: + case EVDEV_ABSOLUTE_TOUCH_UP: + case EVDEV_ABSOLUTE_MOTION: + return true; + } + + return false; +} + static void evdev_tag_external_mouse(struct evdev_device *device, struct udev_device *udev_device) @@ -388,29 +750,15 @@ { if (libevdev_has_property(device->evdev, INPUT_PROP_POINTING_STICK) || - parse_udev_flag(device, udev_device, "ID_INPUT_POINTINGSTICK")) + udev_device_get_property_value(udev_device, + "ID_INPUT_POINTINGSTICK")) device->tags |= EVDEV_TAG_TRACKPOINT; } -static inline void -evdev_tag_keyboard_internal(struct evdev_device *device) -{ - device->tags |= EVDEV_TAG_INTERNAL_KEYBOARD; - device->tags &= ~EVDEV_TAG_EXTERNAL_KEYBOARD; -} - -static inline void -evdev_tag_keyboard_external(struct evdev_device *device) -{ - device->tags |= EVDEV_TAG_EXTERNAL_KEYBOARD; - device->tags &= ~EVDEV_TAG_INTERNAL_KEYBOARD; -} - static void evdev_tag_keyboard(struct evdev_device *device, struct udev_device *udev_device) { - const char *prop; int code; if (!libevdev_has_event_type(device->evdev, EV_KEY)) @@ -423,28 +771,105 @@ return; } - /* This should eventually become ID_INPUT_KEYBOARD_INTEGRATION */ - prop = udev_device_get_property_value(udev_device, - "LIBINPUT_ATTR_KEYBOARD_INTEGRATION"); - if (prop) { - if (streq(prop, "internal")) { - evdev_tag_keyboard_internal(device); - } else if (streq(prop, "external")) { - evdev_tag_keyboard_external(device); - } else { - evdev_log_info(device, - "tagged with unknown value %s\n", - prop); + device->tags |= EVDEV_TAG_KEYBOARD; +} + +static void +fallback_process(struct evdev_dispatch *dispatch, + struct evdev_device *device, + struct input_event *event, + uint64_t time) +{ + bool need_frame = false; + + switch (event->type) { + case EV_REL: + evdev_process_relative(device, event, time); + break; + case EV_ABS: + evdev_process_absolute(device, event, time); + break; + case EV_KEY: + evdev_process_key(device, event, time); + break; + case EV_SYN: + need_frame = evdev_need_touch_frame(device); + evdev_flush_pending_event(device, time); + if (need_frame) + touch_notify_frame(&device->base, time); + break; + } +} + +static void +release_pressed_keys(struct evdev_device *device) +{ + struct libinput *libinput = device->base.seat->libinput; + uint64_t time; + int code; + + if ((time = libinput_now(libinput)) == 0) + return; + + for (code = 0; code < KEY_CNT; code++) { + int count = get_key_down_count(device, code); + + if (count == 0) + continue; + + if (count > 1) { + log_bug_libinput(libinput, + "Key %d is down %d times.\n", + code, + count); + } + + switch (get_key_type(code)) { + case EVDEV_KEY_TYPE_NONE: + break; + case EVDEV_KEY_TYPE_KEY: + evdev_keyboard_notify_key( + device, + time, + code, + LIBINPUT_KEY_STATE_RELEASED); + break; + case EVDEV_KEY_TYPE_BUTTON: + evdev_pointer_notify_physical_button( + device, + time, + evdev_to_left_handed(device, code), + LIBINPUT_BUTTON_STATE_RELEASED); + break; + } + + count = get_key_down_count(device, code); + if (count != 0) { + log_bug_libinput(libinput, + "Releasing key %d failed.\n", + code); + break; } } +} - device->tags |= EVDEV_TAG_KEYBOARD; +static void +fallback_suspend(struct evdev_dispatch *dispatch, + struct evdev_device *device) +{ + release_pressed_keys(device); +} + +static void +fallback_destroy(struct evdev_dispatch *dispatch) +{ + free(dispatch); } static int evdev_calibration_has_matrix(struct libinput_device *libinput_device) { - struct evdev_device *device = evdev_device(libinput_device); + struct evdev_device *device = (struct evdev_device*)libinput_device; return device->abs.absinfo_x && device->abs.absinfo_y; } @@ -453,7 +878,7 @@ evdev_calibration_set_matrix(struct libinput_device *libinput_device, const float matrix[6]) { - struct evdev_device *device = evdev_device(libinput_device); + struct evdev_device *device = (struct evdev_device*)libinput_device; evdev_device_calibrate(device, matrix); @@ -464,7 +889,7 @@ evdev_calibration_get_matrix(struct libinput_device *libinput_device, float matrix[6]) { - struct evdev_device *device = evdev_device(libinput_device); + struct evdev_device *device = (struct evdev_device*)libinput_device; matrix_to_farray6(&device->abs.usermatrix, matrix); @@ -475,13 +900,24 @@ evdev_calibration_get_default_matrix(struct libinput_device *libinput_device, float matrix[6]) { - struct evdev_device *device = evdev_device(libinput_device); + struct evdev_device *device = (struct evdev_device*)libinput_device; matrix_to_farray6(&device->abs.default_calibration, matrix); return !matrix_is_identity(&device->abs.default_calibration); } +struct evdev_dispatch_interface fallback_interface = { + fallback_process, + fallback_suspend, + NULL, /* remove */ + fallback_destroy, + NULL, /* device_added */ + NULL, /* device_removed */ + NULL, /* device_suspended */ + NULL, /* device_resumed */ +}; + static uint32_t evdev_sendevents_get_modes(struct libinput_device *device) { @@ -492,7 +928,7 @@ evdev_sendevents_set_mode(struct libinput_device *device, enum libinput_config_send_events_mode mode) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct evdev_dispatch *dispatch = evdev->dispatch; if (mode == dispatch->sendevents.current_mode) @@ -517,7 +953,7 @@ static enum libinput_config_send_events_mode evdev_sendevents_get_mode(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct evdev_dispatch *dispatch = evdev->dispatch; return dispatch->sendevents.current_mode; @@ -537,14 +973,26 @@ return 1; } +static void +evdev_change_to_left_handed(struct evdev_device *device) +{ + if (device->left_handed.want_enabled == device->left_handed.enabled) + return; + + if (evdev_any_button_down(device)) + return; + + device->left_handed.enabled = device->left_handed.want_enabled; +} + static enum libinput_config_status evdev_left_handed_set(struct libinput_device *device, int left_handed) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev_device = (struct evdev_device *)device; - evdev->left_handed.want_enabled = left_handed ? true : false; + evdev_device->left_handed.want_enabled = left_handed ? true : false; - evdev->left_handed.change_to_enabled(evdev); + evdev_device->left_handed.change_to_enabled(evdev_device); return LIBINPUT_CONFIG_STATUS_SUCCESS; } @@ -552,11 +1000,11 @@ static int evdev_left_handed_get(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev_device = (struct evdev_device *)device; /* return the wanted configuration, even if it hasn't taken * effect yet! */ - return evdev->left_handed.want_enabled; + return evdev_device->left_handed.want_enabled; } static int @@ -565,7 +1013,7 @@ return 0; } -void +int evdev_init_left_handed(struct evdev_device *device, void (*change_to_left_handed)(struct evdev_device *)) { @@ -577,6 +1025,8 @@ device->left_handed.enabled = false; device->left_handed.want_enabled = false; device->left_handed.change_to_enabled = change_to_left_handed; + + return 0; } static uint32_t @@ -585,11 +1035,25 @@ return LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN; } +static void +evdev_change_scroll_method(struct evdev_device *device) +{ + if (device->scroll.want_method == device->scroll.method && + device->scroll.want_button == device->scroll.button) + return; + + if (evdev_any_button_down(device)) + return; + + device->scroll.method = device->scroll.want_method; + device->scroll.button = device->scroll.want_button; +} + static enum libinput_config_status evdev_scroll_set_method(struct libinput_device *device, enum libinput_config_scroll_method method) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; evdev->scroll.want_method = method; evdev->scroll.change_scroll_method(evdev); @@ -600,7 +1064,7 @@ static enum libinput_config_scroll_method evdev_scroll_get_method(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device *)device; /* return the wanted configuration, even if it hasn't taken * effect yet! */ @@ -610,7 +1074,7 @@ static enum libinput_config_scroll_method evdev_scroll_get_default_method(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device *)device; if (evdev->tags & EVDEV_TAG_TRACKPOINT) return LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN; @@ -629,7 +1093,7 @@ evdev_scroll_set_button(struct libinput_device *device, uint32_t button) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; evdev->scroll.want_button = button; evdev->scroll.change_scroll_method(evdev); @@ -640,7 +1104,7 @@ static uint32_t evdev_scroll_get_button(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device *)device; /* return the wanted configuration, even if it hasn't taken * effect yet! */ @@ -650,36 +1114,19 @@ static uint32_t evdev_scroll_get_default_button(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); - unsigned int code; + struct evdev_device *evdev = (struct evdev_device *)device; - if (libevdev_has_event_code(evdev->evdev, EV_KEY, BTN_MIDDLE)) + if( libevdev_has_event_code(evdev->evdev, EV_KEY, BTN_MIDDLE)) return BTN_MIDDLE; - for (code = BTN_SIDE; code <= BTN_TASK; code++) { - if (libevdev_has_event_code(evdev->evdev, EV_KEY, code)) - return code; - } - - if (libevdev_has_event_code(evdev->evdev, EV_KEY, BTN_RIGHT)) - return BTN_RIGHT; - return 0; } -void +static int evdev_init_button_scroll(struct evdev_device *device, void (*change_scroll_method)(struct evdev_device *)) { - char timer_name[64]; - - snprintf(timer_name, - sizeof(timer_name), - "%s btnscroll", - evdev_device_get_sysname(device)); - libinput_timer_init(&device->scroll.timer, - evdev_libinput_context(device), - timer_name, + libinput_timer_init(&device->scroll.timer, device->base.seat->libinput, evdev_button_scroll_timeout, device); device->scroll.config.get_methods = evdev_scroll_get_methods; device->scroll.config.set_method = evdev_scroll_set_method; @@ -694,21 +1141,23 @@ device->scroll.button = evdev_scroll_get_default_button((struct libinput_device *)device); device->scroll.want_button = device->scroll.button; device->scroll.change_scroll_method = change_scroll_method; + + return 0; } -void +static void evdev_init_calibration(struct evdev_device *device, - struct libinput_device_config_calibration *calibration) + struct evdev_dispatch *dispatch) { - device->base.config.calibration = calibration; + device->base.config.calibration = &dispatch->calibration; - calibration->has_matrix = evdev_calibration_has_matrix; - calibration->set_matrix = evdev_calibration_set_matrix; - calibration->get_matrix = evdev_calibration_get_matrix; - calibration->get_default_matrix = evdev_calibration_get_default_matrix; + dispatch->calibration.has_matrix = evdev_calibration_has_matrix; + dispatch->calibration.set_matrix = evdev_calibration_set_matrix; + dispatch->calibration.get_matrix = evdev_calibration_get_matrix; + dispatch->calibration.get_default_matrix = evdev_calibration_get_default_matrix; } -void +static void evdev_init_sendevents(struct evdev_device *device, struct evdev_dispatch *dispatch) { @@ -731,7 +1180,7 @@ evdev_scroll_config_natural_set(struct libinput_device *device, int enabled) { - struct evdev_device *dev = evdev_device(device); + struct evdev_device *dev = (struct evdev_device *)device; dev->scroll.natural_scrolling_enabled = enabled ? true : false; @@ -741,7 +1190,7 @@ static int evdev_scroll_config_natural_get(struct libinput_device *device) { - struct evdev_device *dev = evdev_device(device); + struct evdev_device *dev = (struct evdev_device *)device; return dev->scroll.natural_scrolling_enabled ? 1 : 0; } @@ -765,95 +1214,77 @@ device->base.config.natural_scroll = &device->scroll.config_natural; } -int -evdev_need_mtdev(struct evdev_device *device) +static struct evdev_dispatch * +fallback_dispatch_create(struct libinput_device *device) { - struct libevdev *evdev = device->evdev; + struct evdev_dispatch *dispatch = zalloc(sizeof *dispatch); + struct evdev_device *evdev_device = (struct evdev_device *)device; - return (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) && - libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y) && - !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT)); -} - -/* Fake MT devices have the ABS_MT_SLOT bit set because of - the limited ABS_* range - they aren't MT devices, they - just have too many ABS_ axes */ -bool -evdev_is_fake_mt_device(struct evdev_device *device) -{ - struct libevdev *evdev = device->evdev; + if (dispatch == NULL) + return NULL; - return libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT) && - libevdev_get_num_slots(evdev) == -1; -} + dispatch->interface = &fallback_interface; -enum switch_reliability -evdev_read_switch_reliability_prop(struct evdev_device *device) -{ - const char *prop; - enum switch_reliability r; - - prop = udev_device_get_property_value(device->udev_device, - "LIBINPUT_ATTR_LID_SWITCH_RELIABILITY"); - if (!parse_switch_reliability_property(prop, &r)) { - evdev_log_error(device, - "%s: switch reliability set to unknown value '%s'\n", - device->devname, - prop); - r = RELIABILITY_UNKNOWN; - } else if (r == RELIABILITY_WRITE_OPEN) { - evdev_log_info(device, "will write switch open events\n"); + if (evdev_device->left_handed.want_enabled && + evdev_init_left_handed(evdev_device, + evdev_change_to_left_handed) == -1) { + free(dispatch); + return NULL; } - return r; -} - -static inline void -evdev_print_event(struct evdev_device *device, - const struct input_event *e) -{ - static uint32_t offset = 0; - static uint32_t last_time = 0; - uint32_t time = us2ms(tv2us(&e->time)); - - if (offset == 0) { - offset = time; - last_time = time - offset; + if (evdev_device->scroll.want_button && + evdev_init_button_scroll(evdev_device, + evdev_change_scroll_method) == -1) { + free(dispatch); + return NULL; } - time -= offset; + if (evdev_device->scroll.natural_scrolling_enabled) + evdev_init_natural_scroll(evdev_device); - if (libevdev_event_is_code(e, EV_SYN, SYN_REPORT)) { - evdev_log_debug(device, - "%u.%03u -------------- EV_SYN ------------ +%ums\n", - time / 1000, - time % 1000, - time - last_time); + evdev_init_calibration(evdev_device, dispatch); + evdev_init_sendevents(evdev_device, dispatch); - last_time = time; - } else { - evdev_log_debug(device, - "%u.%03u %-16s %-20s %4d\n", - time / 1000, - time % 1000, - libevdev_event_type_get_name(e->type), - libevdev_event_code_get_name(e->type, e->code), - e->value); + /* BTN_MIDDLE is set on mice even when it's not present. So + * we can only use the absense of BTN_MIDDLE to mean something, i.e. + * we enable it by default on anything that only has L&R. + * If we have L&R and no middle, we don't expose it as config + * option */ + if (libevdev_has_event_code(evdev_device->evdev, EV_KEY, BTN_LEFT) && + libevdev_has_event_code(evdev_device->evdev, EV_KEY, BTN_RIGHT)) { + bool has_middle = libevdev_has_event_code(evdev_device->evdev, + EV_KEY, + BTN_MIDDLE); + bool want_config = has_middle; + bool enable_by_default = !has_middle; + + evdev_init_middlebutton(evdev_device, + enable_by_default, + want_config); } + + return dispatch; } static inline void evdev_process_event(struct evdev_device *device, struct input_event *e) { struct evdev_dispatch *dispatch = device->dispatch; - uint64_t time = tv2us(&e->time); + uint64_t time = s2us(e->time.tv_sec) + e->time.tv_usec; #if 0 - evdev_print_event(device, e); + if (libevdev_event_is_code(e, EV_SYN, SYN_REPORT)) + log_debug(device->base.seat->libinput, + "-------------- EV_SYN ------------\n"); + else + log_debug(device->base.seat->libinput, + "%-7s %-16s %-20s %4d\n", + evdev_device_get_sysname(device), + libevdev_event_type_get_name(e->type), + libevdev_event_code_get_name(e->type, e->code), + e->value); #endif - libinput_timer_flush(evdev_libinput_context(device), time); - dispatch->interface->process(dispatch, device, e, time); } @@ -896,7 +1327,7 @@ evdev_device_dispatch(void *data) { struct evdev_device *device = data; - struct libinput *libinput = evdev_libinput_context(device); + struct libinput *libinput = device->base.seat->libinput; struct input_event ev; int rc; @@ -907,9 +1338,20 @@ rc = libevdev_next_event(device->evdev, LIBEVDEV_READ_FLAG_NORMAL, &ev); if (rc == LIBEVDEV_READ_STATUS_SYNC) { - evdev_log_info_ratelimit(device, - &device->syn_drop_limit, - "SYN_DROPPED event - some input events have been lost.\n"); + switch (ratelimit_test(&device->syn_drop_limit)) { + case RATELIMIT_PASS: + log_info(libinput, "SYN_DROPPED event from " + "\"%s\" - some input events have " + "been lost.\n", device->devname); + break; + case RATELIMIT_THRESHOLD: + log_info(libinput, "SYN_DROPPED flood " + "from \"%s\"\n", + device->devname); + break; + case RATELIMIT_EXCEEDED: + break; + } /* send one more sync event so we handle all currently pending events before we sync up @@ -931,29 +1373,6 @@ } } -static inline bool -evdev_init_accel(struct evdev_device *device, - enum libinput_config_accel_profile which) -{ - struct motion_filter *filter; - - if (which == LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT) - filter = create_pointer_accelerator_filter_flat(device->dpi); - else if (device->tags & EVDEV_TAG_TRACKPOINT) - filter = create_pointer_accelerator_filter_trackpoint(device->trackpoint_range); - else if (device->dpi < DEFAULT_MOUSE_DPI) - filter = create_pointer_accelerator_filter_linear_low_dpi(device->dpi); - else - filter = create_pointer_accelerator_filter_linear(device->dpi); - - if (!filter) - return false; - - evdev_device_init_pointer_acceleration(device, filter); - - return true; -} - static int evdev_accel_config_available(struct libinput_device *device) { @@ -965,7 +1384,7 @@ static enum libinput_config_status evdev_accel_config_set_speed(struct libinput_device *device, double speed) { - struct evdev_device *dev = evdev_device(device); + struct evdev_device *dev = (struct evdev_device *)device; if (!filter_set_speed(dev->pointer.filter, speed)) return LIBINPUT_CONFIG_STATUS_INVALID; @@ -976,255 +1395,131 @@ static double evdev_accel_config_get_speed(struct libinput_device *device) { - struct evdev_device *dev = evdev_device(device); + struct evdev_device *dev = (struct evdev_device *)device; return filter_get_speed(dev->pointer.filter); } -static double -evdev_accel_config_get_default_speed(struct libinput_device *device) -{ - return 0.0; -} - -static uint32_t -evdev_accel_config_get_profiles(struct libinput_device *libinput_device) -{ - struct evdev_device *device = evdev_device(libinput_device); - - if (!device->pointer.filter) - return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE; - - return LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE | - LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT; -} - -static enum libinput_config_status -evdev_accel_config_set_profile(struct libinput_device *libinput_device, - enum libinput_config_accel_profile profile) -{ - struct evdev_device *device = evdev_device(libinput_device); - struct motion_filter *filter; - double speed; - - filter = device->pointer.filter; - if (filter_get_type(filter) == profile) - return LIBINPUT_CONFIG_STATUS_SUCCESS; - - speed = filter_get_speed(filter); - device->pointer.filter = NULL; - - if (evdev_init_accel(device, profile)) { - evdev_accel_config_set_speed(libinput_device, speed); - filter_destroy(filter); - } else { - device->pointer.filter = filter; - } - - return LIBINPUT_CONFIG_STATUS_SUCCESS; -} - -static enum libinput_config_accel_profile -evdev_accel_config_get_profile(struct libinput_device *libinput_device) -{ - struct evdev_device *device = evdev_device(libinput_device); - - return filter_get_type(device->pointer.filter); -} - -static enum libinput_config_accel_profile -evdev_accel_config_get_default_profile(struct libinput_device *libinput_device) -{ - struct evdev_device *device = evdev_device(libinput_device); - - if (!device->pointer.filter) - return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE; - - /* No device has a flat profile as default */ - return LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE; -} - -void -evdev_device_init_pointer_acceleration(struct evdev_device *device, - struct motion_filter *filter) -{ - device->pointer.filter = filter; - - if (device->base.config.accel == NULL) { - device->pointer.config.available = evdev_accel_config_available; - device->pointer.config.set_speed = evdev_accel_config_set_speed; - device->pointer.config.get_speed = evdev_accel_config_get_speed; - device->pointer.config.get_default_speed = evdev_accel_config_get_default_speed; - device->pointer.config.get_profiles = evdev_accel_config_get_profiles; - device->pointer.config.set_profile = evdev_accel_config_set_profile; - device->pointer.config.get_profile = evdev_accel_config_get_profile; - device->pointer.config.get_default_profile = evdev_accel_config_get_default_profile; - device->base.config.accel = &device->pointer.config; - - evdev_accel_config_set_speed(&device->base, - evdev_accel_config_get_default_speed(&device->base)); - } -} - -static inline bool -evdev_read_wheel_click_prop(struct evdev_device *device, - const char *prop, - double *angle) -{ - int val; - - *angle = DEFAULT_WHEEL_CLICK_ANGLE; - prop = udev_device_get_property_value(device->udev_device, prop); - if (!prop) - return false; - - val = parse_mouse_wheel_click_angle_property(prop); - if (val) { - *angle = val; - return true; - } - - evdev_log_error(device, - "mouse wheel click angle is present but invalid, " - "using %d degrees instead\n", - DEFAULT_WHEEL_CLICK_ANGLE); - - return false; -} - -static inline bool -evdev_read_wheel_click_count_prop(struct evdev_device *device, - const char *prop, - double *angle) +static double +evdev_accel_config_get_default_speed(struct libinput_device *device) { - int val; + return 0.0; +} - prop = udev_device_get_property_value(device->udev_device, prop); - if (!prop) - return false; +int +evdev_device_init_pointer_acceleration(struct evdev_device *device, + accel_profile_func_t profile) +{ + device->pointer.filter = create_pointer_accelerator_filter(profile, + device->dpi); + if (!device->pointer.filter) + return -1; - val = parse_mouse_wheel_click_angle_property(prop); - if (val) { - *angle = 360.0/val; - return true; - } + device->pointer.config.available = evdev_accel_config_available; + device->pointer.config.set_speed = evdev_accel_config_set_speed; + device->pointer.config.get_speed = evdev_accel_config_get_speed; + device->pointer.config.get_default_speed = evdev_accel_config_get_default_speed; + device->base.config.accel = &device->pointer.config; - evdev_log_error(device, - "mouse wheel click count is present but invalid, " - "using %d degrees for angle instead instead\n", - DEFAULT_WHEEL_CLICK_ANGLE); - *angle = DEFAULT_WHEEL_CLICK_ANGLE; + evdev_accel_config_set_speed(&device->base, + evdev_accel_config_get_default_speed(&device->base)); - return false; + return 0; } -static inline struct wheel_angle -evdev_read_wheel_click_props(struct evdev_device *device) +static inline int +evdev_need_mtdev(struct evdev_device *device) { - struct wheel_angle angles; + struct libevdev *evdev = device->evdev; - /* CLICK_COUNT overrides CLICK_ANGLE */ - if (!evdev_read_wheel_click_count_prop(device, - "MOUSE_WHEEL_CLICK_COUNT", - &angles.y)) - evdev_read_wheel_click_prop(device, - "MOUSE_WHEEL_CLICK_ANGLE", - &angles.y); - if (!evdev_read_wheel_click_count_prop(device, - "MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL", - &angles.x)) { - if (!evdev_read_wheel_click_prop(device, - "MOUSE_WHEEL_CLICK_ANGLE_HORIZONTAL", - &angles.x)) - angles.x = angles.y; - } - - return angles; -} - -static inline struct wheel_tilt_flags -evdev_read_wheel_tilt_props(struct evdev_device *device) -{ - struct wheel_tilt_flags flags; - - flags.vertical = parse_udev_flag(device, - device->udev_device, - "MOUSE_WHEEL_TILT_VERTICAL"); - - flags.horizontal = parse_udev_flag(device, - device->udev_device, - "MOUSE_WHEEL_TILT_HORIZONTAL"); - return flags; + return (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) && + libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y) && + !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT)); } static inline int -evdev_get_trackpoint_range(struct evdev_device *device) +evdev_read_wheel_click_prop(struct evdev_device *device) { + struct libinput *libinput = device->base.seat->libinput; const char *prop; - int range = DEFAULT_TRACKPOINT_RANGE; - - if (!(device->tags & EVDEV_TAG_TRACKPOINT)) - return DEFAULT_TRACKPOINT_RANGE; + int angle = DEFAULT_WHEEL_CLICK_ANGLE; prop = udev_device_get_property_value(device->udev_device, - "LIBINPUT_ATTR_TRACKPOINT_RANGE"); + "MOUSE_WHEEL_CLICK_ANGLE"); if (prop) { - if (!safe_atoi(prop, &range) || - (range < 0.0 || range > 100)) { - evdev_log_error(device, - "trackpoint range property is present but invalid, " - "using %d instead\n", - DEFAULT_TRACKPOINT_RANGE); - range = DEFAULT_TRACKPOINT_RANGE; + angle = parse_mouse_wheel_click_angle_property(prop); + if (!angle) { + log_error(libinput, + "Mouse wheel click angle '%s' is present but invalid," + "using %d degrees instead\n", + device->devname, + DEFAULT_WHEEL_CLICK_ANGLE); + angle = DEFAULT_WHEEL_CLICK_ANGLE; } - goto out; } - prop = udev_device_get_property_value(device->udev_device, - "POINTINGSTICK_SENSITIVITY"); - if (prop) { - int sensitivity; + return angle; +} - if (!safe_atoi(prop, &sensitivity) || - (sensitivity < 0.0 || sensitivity > 255)) { - evdev_log_error(device, - "trackpoint sensitivity property is present but invalid, " - "using %d instead\n", - DEFAULT_TRACKPOINT_SENSITIVITY); - sensitivity = DEFAULT_TRACKPOINT_SENSITIVITY; +static inline int +evdev_get_trackpoint_dpi(struct evdev_device *device) +{ + struct libinput *libinput = device->base.seat->libinput; + const char *trackpoint_accel; + double accel = DEFAULT_TRACKPOINT_ACCEL; + + trackpoint_accel = udev_device_get_property_value( + device->udev_device, "POINTINGSTICK_CONST_ACCEL"); + if (trackpoint_accel) { + accel = parse_trackpoint_accel_property(trackpoint_accel); + if (accel == 0.0) { + log_error(libinput, "Trackpoint accel property for " + "'%s' is present but invalid, " + "using %.2f instead\n", + device->devname, + DEFAULT_TRACKPOINT_ACCEL); + accel = DEFAULT_TRACKPOINT_ACCEL; } - range = 1.0 * DEFAULT_TRACKPOINT_RANGE * - sensitivity/DEFAULT_TRACKPOINT_SENSITIVITY; + log_info(libinput, + "Device '%s' set to const accel %.2f\n", + device->devname, + accel); } -out: - evdev_log_info(device, "trackpoint device set to range %d\n", range); - return range; + return DEFAULT_MOUSE_DPI / accel; } static inline int evdev_read_dpi_prop(struct evdev_device *device) { + struct libinput *libinput = device->base.seat->libinput; const char *mouse_dpi; int dpi = DEFAULT_MOUSE_DPI; + /* + * Trackpoints do not have dpi, instead hwdb may contain a + * POINTINGSTICK_CONST_ACCEL value to compensate for sensitivity + * differences between models, we translate this to a fake dpi. + */ if (device->tags & EVDEV_TAG_TRACKPOINT) - return DEFAULT_MOUSE_DPI; + return evdev_get_trackpoint_dpi(device); mouse_dpi = udev_device_get_property_value(device->udev_device, "MOUSE_DPI"); if (mouse_dpi) { dpi = parse_mouse_dpi_property(mouse_dpi); if (!dpi) { - evdev_log_error(device, - "mouse DPI property is present but invalid, " - "using %d DPI instead\n", - DEFAULT_MOUSE_DPI); + log_error(libinput, "Mouse DPI property for '%s' is " + "present but invalid, using %d " + "DPI instead\n", + device->devname, + DEFAULT_MOUSE_DPI); dpi = DEFAULT_MOUSE_DPI; } - evdev_log_info(device, - "device set to %d DPI\n", - dpi); + log_info(libinput, + "Device '%s' set to %d DPI\n", + device->devname, + dpi); } return dpi; @@ -1237,55 +1532,34 @@ const char *property; enum evdev_device_model model; } model_map[] = { -#define MODEL(name) { "LIBINPUT_MODEL_" #name, EVDEV_MODEL_##name } - MODEL(LENOVO_X230), - MODEL(LENOVO_X230), - MODEL(LENOVO_X220_TOUCHPAD_FW81), - MODEL(CHROMEBOOK), - MODEL(SYSTEM76_BONOBO), - MODEL(SYSTEM76_GALAGO), - MODEL(SYSTEM76_KUDU), - MODEL(CLEVO_W740SU), - MODEL(APPLE_TOUCHPAD), - MODEL(WACOM_TOUCHPAD), - MODEL(ALPS_TOUCHPAD), - MODEL(SYNAPTICS_SERIAL_TOUCHPAD), - MODEL(JUMPING_SEMI_MT), - MODEL(CYBORG_RAT), - MODEL(HP_STREAM11_TOUCHPAD), - MODEL(LENOVO_T450_TOUCHPAD), - MODEL(TOUCHPAD_VISIBLE_MARKER), - MODEL(TRACKBALL), - MODEL(APPLE_MAGICMOUSE), - MODEL(HP8510_TOUCHPAD), - MODEL(HP6910_TOUCHPAD), - MODEL(HP_ZBOOK_STUDIO_G3), - MODEL(HP_PAVILION_DM4_TOUCHPAD), - MODEL(APPLE_TOUCHPAD_ONEBUTTON), - MODEL(LOGITECH_MARBLE_MOUSE), - MODEL(TABLET_NO_PROXIMITY_OUT), - MODEL(MS_NANO_TRANSCEIVER), -#undef MODEL - { "ID_INPUT_TRACKBALL", EVDEV_MODEL_TRACKBALL }, + { "LIBINPUT_MODEL_LENOVO_X230", EVDEV_MODEL_LENOVO_X230 }, + { "LIBINPUT_MODEL_CHROMEBOOK", EVDEV_MODEL_CHROMEBOOK }, + { "LIBINPUT_MODEL_SYSTEM76_BONOBO", EVDEV_MODEL_SYSTEM76_BONOBO }, + { "LIBINPUT_MODEL_SYSTEM76_GALAGO", EVDEV_MODEL_SYSTEM76_GALAGO }, + { "LIBINPUT_MODEL_SYSTEM76_KUDU", EVDEV_MODEL_SYSTEM76_KUDU }, + { "LIBINPUT_MODEL_CLEVO_W740SU", EVDEV_MODEL_CLEVO_W740SU }, + { "LIBINPUT_MODEL_APPLE_TOUCHPAD", EVDEV_MODEL_APPLE_TOUCHPAD }, + { "LIBINPUT_MODEL_WACOM_TOUCHPAD", EVDEV_MODEL_WACOM_TOUCHPAD }, + { "LIBINPUT_MODEL_ALPS_TOUCHPAD", EVDEV_MODEL_ALPS_TOUCHPAD }, + { "LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD", EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD }, + { "LIBINPUT_MODEL_JUMPING_SEMI_MT", EVDEV_MODEL_JUMPING_SEMI_MT }, + { "LIBINPUT_MODEL_ELANTECH_TOUCHPAD", EVDEV_MODEL_ELANTECH_TOUCHPAD }, { NULL, EVDEV_MODEL_DEFAULT }, }; const struct model_map *m = model_map; uint32_t model_flags = 0; while (m->property) { - if (parse_udev_flag(device, - device->udev_device, - m->property)) { - evdev_log_debug(device, "tagged as %s\n", m->property); + if (!!udev_device_get_property_value(device->udev_device, + m->property)) model_flags |= m->model; - } m++; } return model_flags; } -static inline bool +static inline int evdev_read_attr_res_prop(struct evdev_device *device, size_t *xres, size_t *yres) @@ -1302,7 +1576,7 @@ return parse_dimension_property(res_prop, xres, yres); } -static inline bool +static inline int evdev_read_attr_size_prop(struct evdev_device *device, size_t *size_x, size_t *size_y) @@ -1325,6 +1599,7 @@ unsigned int xcode, unsigned int ycode) { + struct libinput *libinput = device->base.seat->libinput; struct libevdev *evdev = device->evdev; const struct input_absinfo *absx, *absy; size_t widthmm = 0, heightmm = 0; @@ -1333,10 +1608,9 @@ if (!(xcode == ABS_X && ycode == ABS_Y) && !(xcode == ABS_MT_POSITION_X && ycode == ABS_MT_POSITION_Y)) { - evdev_log_bug_libinput(device, - "invalid x/y code combination %d/%d\n", - xcode, - ycode); + log_bug_libinput(libinput, + "Invalid x/y code combination %d/%d\n", + xcode, ycode); return 0; } @@ -1369,17 +1643,21 @@ evdev_device_get_udev_tags(struct evdev_device *device, struct udev_device *udev_device) { + const char *prop; enum evdev_device_udev_tags tags = 0; + const struct evdev_udev_tag_match *match; int i; for (i = 0; i < 2 && udev_device; i++) { - unsigned j; - for (j = 0; j < ARRAY_LENGTH(evdev_udev_tag_matches); j++) { - const struct evdev_udev_tag_match match = evdev_udev_tag_matches[j]; - if (parse_udev_flag(device, - udev_device, - match.name)) - tags |= match.tag; + match = evdev_udev_tag_matches; + while (match->name) { + prop = udev_device_get_property_value( + udev_device, + match->name); + if (prop) + tags |= match->tag; + + match++; } udev_device = udev_device_get_parent(udev_device); } @@ -1387,6 +1665,18 @@ return tags; } +/* Fake MT devices have the ABS_MT_SLOT bit set because of + the limited ABS_* range - they aren't MT devices, they + just have too many ABS_ axes */ +static inline bool +evdev_is_fake_mt_device(struct evdev_device *device) +{ + struct libevdev *evdev = device->evdev; + + return libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT) && + libevdev_get_num_slots(evdev) == -1; +} + static inline void evdev_fix_android_mt(struct evdev_device *device) { @@ -1407,14 +1697,14 @@ libevdev_get_abs_info(evdev, ABS_MT_POSITION_Y)); } -static inline bool +static inline int evdev_check_min_max(struct evdev_device *device, unsigned int code) { struct libevdev *evdev = device->evdev; const struct input_absinfo *absinfo; if (!libevdev_has_event_code(evdev, EV_ABS, code)) - return true; + return 0; absinfo = libevdev_get_abs_info(evdev, code); if (absinfo->minimum == absinfo->maximum) { @@ -1425,51 +1715,53 @@ */ if (absinfo->minimum == 0 && code >= ABS_MISC && code < ABS_MT_SLOT) { - evdev_log_info(device, - "disabling EV_ABS %#x on device (min == max == 0)\n", - code); + log_info(device->base.seat->libinput, + "Disabling EV_ABS %#x on device '%s' (min == max == 0)\n", + code, + device->devname); libevdev_disable_event_code(device->evdev, EV_ABS, code); } else { - evdev_log_bug_kernel(device, - "device has min == max on %s\n", - libevdev_event_code_get_name(EV_ABS, code)); - return false; + log_bug_kernel(device->base.seat->libinput, + "Device '%s' has min == max on %s\n", + device->devname, + libevdev_event_code_get_name(EV_ABS, code)); + return -1; } } - return true; + return 0; } -static bool +static int evdev_reject_device(struct evdev_device *device) { + struct libinput *libinput = device->base.seat->libinput; struct libevdev *evdev = device->evdev; unsigned int code; const struct input_absinfo *absx, *absy; if (libevdev_has_event_code(evdev, EV_ABS, ABS_X) ^ libevdev_has_event_code(evdev, EV_ABS, ABS_Y)) - return true; + return -1; if (libevdev_has_event_code(evdev, EV_REL, REL_X) ^ libevdev_has_event_code(evdev, EV_REL, REL_Y)) - return true; + return -1; - if (!evdev_is_fake_mt_device(device) && - libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) ^ + if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) ^ libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y)) - return true; + return -1; if (libevdev_has_event_code(evdev, EV_ABS, ABS_X)) { absx = libevdev_get_abs_info(evdev, ABS_X); absy = libevdev_get_abs_info(evdev, ABS_Y); if ((absx->resolution == 0 && absy->resolution != 0) || (absx->resolution != 0 && absy->resolution == 0)) { - evdev_log_bug_kernel(device, - "kernel has only x or y resolution, not both.\n"); - return true; + log_bug_kernel(libinput, + "Kernel has only x or y resolution, not both.\n"); + return -1; } } @@ -1479,9 +1771,9 @@ absy = libevdev_get_abs_info(evdev, ABS_MT_POSITION_Y); if ((absx->resolution == 0 && absy->resolution != 0) || (absx->resolution != 0 && absy->resolution == 0)) { - evdev_log_bug_kernel(device, - "kernel has only x or y MT resolution, not both.\n"); - return true; + log_bug_kernel(libinput, + "Kernel has only x or y MT resolution, not both.\n"); + return -1; } } @@ -1492,41 +1784,31 @@ case ABS_MT_TOOL_TYPE: break; default: - if (!evdev_check_min_max(device, code)) - return true; + if (evdev_check_min_max(device, code) == -1) + return -1; } } - return false; + return 0; } -static void -evdev_extract_abs_axes(struct evdev_device *device) +static int +evdev_configure_mt_device(struct evdev_device *device) { struct libevdev *evdev = device->evdev; + struct mt_slot *slots; + int num_slots; + int active_slot; + int slot; - if (!libevdev_has_event_code(evdev, EV_ABS, ABS_X) || - !libevdev_has_event_code(evdev, EV_ABS, ABS_Y)) - return; - - if (evdev_fix_abs_resolution(device, ABS_X, ABS_Y)) - device->abs.is_fake_resolution = true; - device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_X); - device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_Y); - device->abs.dimensions.x = abs(device->abs.absinfo_x->maximum - - device->abs.absinfo_x->minimum); - device->abs.dimensions.y = abs(device->abs.absinfo_y->maximum - - device->abs.absinfo_y->minimum); - - if (evdev_is_fake_mt_device(device) || - !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) || + if (!libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) || !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y)) - return; + return 0; if (evdev_fix_abs_resolution(device, ABS_MT_POSITION_X, ABS_MT_POSITION_Y)) - device->abs.is_fake_resolution = true; + device->abs.fake_resolution = 1; device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X); device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_MT_POSITION_Y); @@ -1535,41 +1817,82 @@ device->abs.dimensions.y = abs(device->abs.absinfo_y->maximum - device->abs.absinfo_y->minimum); device->is_mt = 1; + + /* We only handle the slotted Protocol B in libinput. + Devices with ABS_MT_POSITION_* but not ABS_MT_SLOT + require mtdev for conversion. */ + if (evdev_need_mtdev(device)) { + device->mtdev = mtdev_new_open(device->fd); + if (!device->mtdev) + return -1; + + /* pick 10 slots as default for type A + devices. */ + num_slots = 10; + active_slot = device->mtdev->caps.slot.value; + } else { + num_slots = libevdev_get_num_slots(device->evdev); + active_slot = libevdev_get_current_slot(evdev); + } + + slots = calloc(num_slots, sizeof(struct mt_slot)); + if (!slots) + return -1; + + for (slot = 0; slot < num_slots; ++slot) { + slots[slot].seat_slot = -1; + + if (evdev_need_mtdev(device)) + continue; + + slots[slot].point.x = libevdev_get_slot_value(evdev, + slot, + ABS_MT_POSITION_X); + slots[slot].point.y = libevdev_get_slot_value(evdev, + slot, + ABS_MT_POSITION_Y); + } + device->mt.slots = slots; + device->mt.slots_len = num_slots; + device->mt.slot = active_slot; + + return 0; } -static void -evdev_disable_accelerometer_axes(struct evdev_device *device) +static inline int +evdev_init_accel(struct evdev_device *device) { - struct libevdev *evdev = device->evdev; + accel_profile_func_t profile; - libevdev_disable_event_code(evdev, EV_ABS, ABS_X); - libevdev_disable_event_code(evdev, EV_ABS, ABS_Y); - libevdev_disable_event_code(evdev, EV_ABS, ABS_Z); - - libevdev_disable_event_code(evdev, EV_ABS, REL_X); - libevdev_disable_event_code(evdev, EV_ABS, REL_Y); - libevdev_disable_event_code(evdev, EV_ABS, REL_Z); + if (device->dpi < DEFAULT_MOUSE_DPI) + profile = pointer_accel_profile_linear_low_dpi; + else + profile = pointer_accel_profile_linear; + + return evdev_device_init_pointer_acceleration(device, profile); } -static struct evdev_dispatch * +static int evdev_configure_device(struct evdev_device *device) { + struct libinput *libinput = device->base.seat->libinput; struct libevdev *evdev = device->evdev; + const char *devnode = udev_device_get_devnode(device->udev_device); enum evdev_device_udev_tags udev_tags; - unsigned int tablet_tags; - struct evdev_dispatch *dispatch; udev_tags = evdev_device_get_udev_tags(device, device->udev_device); if ((udev_tags & EVDEV_UDEV_TAG_INPUT) == 0 || (udev_tags & ~EVDEV_UDEV_TAG_INPUT) == 0) { - evdev_log_info(device, - "not tagged as supported input device\n"); - return NULL; + log_info(libinput, + "input device '%s', %s not tagged as input device\n", + device->devname, devnode); + return -1; } - evdev_log_info(device, - "is tagged by udev as:%s%s%s%s%s%s%s%s%s%s%s\n", + log_info(libinput, + "input device '%s', %s is tagged by udev as:%s%s%s%s%s%s%s%s%s\n", + device->devname, devnode, udev_tags & EVDEV_UDEV_TAG_KEYBOARD ? " Keyboard" : "", udev_tags & EVDEV_UDEV_TAG_MOUSE ? " Mouse" : "", udev_tags & EVDEV_UDEV_TAG_TOUCHPAD ? " Touchpad" : "", @@ -1578,68 +1901,62 @@ udev_tags & EVDEV_UDEV_TAG_POINTINGSTICK ? " Pointingstick" : "", udev_tags & EVDEV_UDEV_TAG_JOYSTICK ? " Joystick" : "", udev_tags & EVDEV_UDEV_TAG_ACCELEROMETER ? " Accelerometer" : "", - udev_tags & EVDEV_UDEV_TAG_TABLET_PAD ? " TabletPad" : "", - udev_tags & EVDEV_UDEV_TAG_TRACKBALL ? " Trackball" : "", - udev_tags & EVDEV_UDEV_TAG_SWITCH ? " Switch" : ""); - - /* Ignore pure accelerometers, but accept devices that are - * accelerometers with other axes */ - if (udev_tags == (EVDEV_UDEV_TAG_INPUT|EVDEV_UDEV_TAG_ACCELEROMETER)) { - evdev_log_info(device, - "device is an accelerometer, ignoring\n"); - return NULL; - } else if (udev_tags & EVDEV_UDEV_TAG_ACCELEROMETER) { - evdev_disable_accelerometer_axes(device); - } + udev_tags & EVDEV_UDEV_TAG_BUTTONSET ? " Buttonset" : ""); /* libwacom *adds* TABLET, TOUCHPAD but leaves JOYSTICK in place, so make sure we only ignore real joystick devices */ - if (udev_tags == (EVDEV_UDEV_TAG_INPUT|EVDEV_UDEV_TAG_JOYSTICK)) { - evdev_log_info(device, - "device is a joystick, ignoring\n"); - return NULL; + if ((udev_tags & EVDEV_UDEV_TAG_JOYSTICK) == udev_tags) { + log_info(libinput, + "input device '%s', %s is a joystick, ignoring\n", + device->devname, devnode); + return -1; } - if (evdev_reject_device(device)) { - evdev_log_info(device, "was rejected\n"); - return NULL; + /* libwacom assigns tablet _and_ tablet_pad to the pad devices */ + if (udev_tags & EVDEV_UDEV_TAG_BUTTONSET) { + log_info(libinput, + "input device '%s', %s is a buttonset, ignoring\n", + device->devname, devnode); + return -1; + } + + if (evdev_reject_device(device) == -1) { + log_info(libinput, + "input device '%s', %s was rejected.\n", + device->devname, devnode); + return -1; } if (!evdev_is_fake_mt_device(device)) evdev_fix_android_mt(device); if (libevdev_has_event_code(evdev, EV_ABS, ABS_X)) { - evdev_extract_abs_axes(device); + if (evdev_fix_abs_resolution(device, ABS_X, ABS_Y)) + device->abs.fake_resolution = 1; + device->abs.absinfo_x = libevdev_get_abs_info(evdev, ABS_X); + device->abs.absinfo_y = libevdev_get_abs_info(evdev, ABS_Y); + device->abs.point.x = device->abs.absinfo_x->value; + device->abs.point.y = device->abs.absinfo_y->value; + device->abs.dimensions.x = abs(device->abs.absinfo_x->maximum - + device->abs.absinfo_x->minimum); + device->abs.dimensions.y = abs(device->abs.absinfo_y->maximum - + device->abs.absinfo_y->minimum); - if (evdev_is_fake_mt_device(device)) + if (evdev_is_fake_mt_device(device)) { udev_tags &= ~EVDEV_UDEV_TAG_TOUCHSCREEN; - } - - /* libwacom assigns touchpad (or touchscreen) _and_ tablet to the - tablet touch bits, so make sure we don't initialize the tablet - interface for the touch device */ - tablet_tags = EVDEV_UDEV_TAG_TABLET | - EVDEV_UDEV_TAG_TOUCHPAD | - EVDEV_UDEV_TAG_TOUCHSCREEN; - - /* libwacom assigns tablet _and_ tablet_pad to the pad devices */ - if (udev_tags & EVDEV_UDEV_TAG_TABLET_PAD) { - dispatch = evdev_tablet_pad_create(device); - device->seat_caps |= EVDEV_DEVICE_TABLET_PAD; - evdev_log_info(device, "device is a tablet pad\n"); - return dispatch; - - } else if ((udev_tags & tablet_tags) == EVDEV_UDEV_TAG_TABLET) { - dispatch = evdev_tablet_create(device); - device->seat_caps |= EVDEV_DEVICE_TABLET; - evdev_log_info(device, "device is a tablet\n"); - return dispatch; + } else if (evdev_configure_mt_device(device) == -1) { + return -1; + } } if (udev_tags & EVDEV_UDEV_TAG_TOUCHPAD) { - dispatch = evdev_mt_touchpad_create(device); - evdev_log_info(device, "device is a touchpad\n"); - return dispatch; + device->dispatch = evdev_mt_touchpad_create(device); + log_info(libinput, + "input device '%s', %s is a touchpad\n", + device->devname, devnode); + + evdev_tag_touchpad(device, device->udev_device); + return device->dispatch == NULL ? -1 : 0; } if (udev_tags & EVDEV_UDEV_TAG_MOUSE || @@ -1647,25 +1964,31 @@ evdev_tag_external_mouse(device, device->udev_device); evdev_tag_trackpoint(device, device->udev_device); device->dpi = evdev_read_dpi_prop(device); - device->trackpoint_range = evdev_get_trackpoint_range(device); + + if (libevdev_has_event_code(evdev, EV_REL, REL_X) && + libevdev_has_event_code(evdev, EV_REL, REL_Y) && + evdev_init_accel(device) == -1) + return -1; device->seat_caps |= EVDEV_DEVICE_POINTER; - evdev_log_info(device, "device is a pointer\n"); + log_info(libinput, + "input device '%s', %s is a pointer caps\n", + device->devname, devnode); /* want left-handed config option */ device->left_handed.want_enabled = true; /* want natural-scroll config option */ device->scroll.natural_scrolling_enabled = true; /* want button scrolling config option */ - if (libevdev_has_event_code(evdev, EV_REL, REL_X) || - libevdev_has_event_code(evdev, EV_REL, REL_Y)) - device->scroll.want_button = 1; + device->scroll.want_button = 1; } if (udev_tags & EVDEV_UDEV_TAG_KEYBOARD) { device->seat_caps |= EVDEV_DEVICE_KEYBOARD; - evdev_log_info(device, "device is a keyboard\n"); + log_info(libinput, + "input device '%s', %s is a keyboard\n", + device->devname, devnode); /* want natural-scroll config option */ if (libevdev_has_event_code(evdev, EV_REL, REL_WHEEL) || @@ -1679,33 +2002,12 @@ if (udev_tags & EVDEV_UDEV_TAG_TOUCHSCREEN) { device->seat_caps |= EVDEV_DEVICE_TOUCH; - evdev_log_info(device, "device is a touch device\n"); - } - - if (udev_tags & EVDEV_UDEV_TAG_SWITCH) { - if (libevdev_has_event_code(evdev, EV_SW, SW_LID)) { - device->seat_caps |= EVDEV_DEVICE_SWITCH; - device->tags |= EVDEV_TAG_LID_SWITCH; - evdev_log_info(device, "device is a switch device\n"); - } - - if (libevdev_has_event_code(evdev, EV_SW, SW_TABLET_MODE)) { - device->seat_caps |= EVDEV_DEVICE_SWITCH; - device->tags |= EVDEV_TAG_TABLET_MODE_SWITCH; - evdev_log_info(device, "device is a switch device\n"); - } - } - - if (device->seat_caps & EVDEV_DEVICE_POINTER && - libevdev_has_event_code(evdev, EV_REL, REL_X) && - libevdev_has_event_code(evdev, EV_REL, REL_Y) && - !evdev_init_accel(device, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE)) { - evdev_log_error(device, - "failed to initialize pointer acceleration\n"); - return NULL; + log_info(libinput, + "input device '%s', %s is a touch device\n", + device->devname, devnode); } - return fallback_dispatch_create(&device->base); + return 0; } static void @@ -1714,29 +2016,24 @@ struct libinput_device *dev; list_for_each(dev, &device->base.seat->devices_list, link) { - struct evdev_device *d = evdev_device(dev); + struct evdev_device *d = (struct evdev_device*)dev; if (dev == &device->base) continue; - /* Notify existing device d about addition of device */ + /* Notify existing device d about addition of device device */ if (d->dispatch->interface->device_added) d->dispatch->interface->device_added(d, device); - /* Notify new device about existing device d */ + /* Notify new device device about existing device d */ if (device->dispatch->interface->device_added) device->dispatch->interface->device_added(device, d); - /* Notify new device if existing device d is suspended */ - if (d->is_suspended && - device->dispatch->interface->device_suspended) + /* Notify new device device if existing device d is suspended */ + if (d->suspended && device->dispatch->interface->device_suspended) device->dispatch->interface->device_suspended(device, d); } notify_added_device(&device->base); - - if (device->dispatch->interface->post_added) - device->dispatch->interface->post_added(device, - device->dispatch); } static bool @@ -1762,148 +2059,40 @@ return rc; } -static bool +static int evdev_set_device_group(struct evdev_device *device, struct udev_device *udev_device) { - struct libinput *libinput = evdev_libinput_context(device); struct libinput_device_group *group = NULL; const char *udev_group; udev_group = udev_device_get_property_value(udev_device, "LIBINPUT_DEVICE_GROUP"); - if (udev_group) - group = libinput_device_group_find_group(libinput, udev_group); + if (udev_group) { + struct libinput_device *d; + + list_for_each(d, &device->base.seat->devices_list, link) { + const char *identifier = d->group->identifier; + + if (identifier && + strcmp(identifier, udev_group) == 0) { + group = d->group; + break; + } + } + } if (!group) { - group = libinput_device_group_create(libinput, udev_group); + group = libinput_device_group_create(udev_group); if (!group) - return false; + return 1; libinput_device_set_device_group(&device->base, group); libinput_device_group_unref(group); } else { libinput_device_set_device_group(&device->base, group); } - return true; -} - -static inline void -evdev_drain_fd(int fd) -{ - struct input_event ev[24]; - size_t sz = sizeof ev; - - while (read(fd, &ev, sz) == (int)sz) { - /* discard all pending events */ - } -} - -static inline void -evdev_pre_configure_model_quirks(struct evdev_device *device) -{ - /* The Cyborg RAT has a mode button that cycles through event codes. - * On press, we get a release for the current mode and a press for the - * next mode: - * E: 0.000001 0004 0004 589833 # EV_MSC / MSC_SCAN 589833 - * E: 0.000001 0001 0118 0000 # EV_KEY / (null) 0 - * E: 0.000001 0004 0004 589834 # EV_MSC / MSC_SCAN 589834 - * E: 0.000001 0001 0119 0001 # EV_KEY / (null) 1 - * E: 0.000001 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +0ms - * E: 0.705000 0004 0004 589834 # EV_MSC / MSC_SCAN 589834 - * E: 0.705000 0001 0119 0000 # EV_KEY / (null) 0 - * E: 0.705000 0004 0004 589835 # EV_MSC / MSC_SCAN 589835 - * E: 0.705000 0001 011a 0001 # EV_KEY / (null) 1 - * E: 0.705000 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +705ms - * E: 1.496995 0004 0004 589833 # EV_MSC / MSC_SCAN 589833 - * E: 1.496995 0001 0118 0001 # EV_KEY / (null) 1 - * E: 1.496995 0004 0004 589835 # EV_MSC / MSC_SCAN 589835 - * E: 1.496995 0001 011a 0000 # EV_KEY / (null) 0 - * E: 1.496995 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +791ms - * - * https://bugs.freedesktop.org/show_bug.cgi?id=92127 - * - * Disable the event codes to avoid stuck buttons. - */ - if (device->model_flags & EVDEV_MODEL_CYBORG_RAT) { - libevdev_disable_event_code(device->evdev, EV_KEY, 0x118); - libevdev_disable_event_code(device->evdev, EV_KEY, 0x119); - libevdev_disable_event_code(device->evdev, EV_KEY, 0x11a); - } - /* The Apple MagicMouse has a touchpad built-in but the kernel still - * emulates a full 2/3 button mouse for us. Ignore anything from the - * ABS interface - */ - if (device->model_flags & EVDEV_MODEL_APPLE_MAGICMOUSE) - libevdev_disable_event_type(device->evdev, EV_ABS); - - /* Claims to have double/tripletap but doesn't actually send it - * https://bugzilla.redhat.com/show_bug.cgi?id=1351285 and - * https://bugs.freedesktop.org/show_bug.cgi?id=98538 - */ - if (device->model_flags & - (EVDEV_MODEL_HP8510_TOUCHPAD|EVDEV_MODEL_HP6910_TOUCHPAD)) { - libevdev_disable_event_code(device->evdev, EV_KEY, BTN_TOOL_DOUBLETAP); - libevdev_disable_event_code(device->evdev, EV_KEY, BTN_TOOL_TRIPLETAP); - } - - /* Touchpad is a clickpad but INPUT_PROP_BUTTONPAD is not set, see - * fdo bug 97147. Remove when RMI4 is commonplace */ - if (device->model_flags & EVDEV_MODEL_HP_STREAM11_TOUCHPAD) - libevdev_enable_property(device->evdev, - INPUT_PROP_BUTTONPAD); - - /* Touchpad claims to have 4 slots but only ever sends 2 - * https://bugs.freedesktop.org/show_bug.cgi?id=98100 */ - if (device->model_flags & EVDEV_MODEL_HP_ZBOOK_STUDIO_G3) - libevdev_set_abs_maximum(device->evdev, ABS_MT_SLOT, 1); - - /* Logitech Marble Mouse claims to have a middle button */ - if (device->model_flags & EVDEV_MODEL_LOGITECH_MARBLE_MOUSE) - libevdev_disable_event_code(device->evdev, EV_KEY, BTN_MIDDLE); -} - -static void -libevdev_log_func(const struct libevdev *evdev, - enum libevdev_log_priority priority, - void *data, - const char *file, - int line, - const char *func, - const char *format, - va_list args) -{ - struct libinput *libinput = data; - enum libinput_log_priority pri = LIBEVDEV_LOG_ERROR; - const char prefix[] = "libevdev: "; - char fmt[strlen(format) + strlen(prefix) + 1]; - - switch (priority) { - case LIBEVDEV_LOG_ERROR: - pri = LIBINPUT_LOG_PRIORITY_ERROR; - break; - case LIBEVDEV_LOG_INFO: - pri = LIBINPUT_LOG_PRIORITY_INFO; - break; - case LIBEVDEV_LOG_DEBUG: - pri = LIBINPUT_LOG_PRIORITY_DEBUG; - break; - } - - snprintf(fmt, sizeof(fmt), "%s%s", prefix, format); - - log_msg_va(libinput, pri, fmt, args); -} - -static bool -udev_device_should_be_ignored(struct udev_device *udev_device) -{ - const char *value; - - value = udev_device_get_property_value(udev_device, - "LIBINPUT_IGNORE_DEVICE"); - - return value && !streq(value, "0"); + return 0; } struct evdev_device * @@ -1916,17 +2105,6 @@ int fd; int unhandled_device = 0; const char *devnode = udev_device_get_devnode(udev_device); - const char *sysname = udev_device_get_sysname(udev_device); - - if (!devnode) { - log_info(libinput, "%s: no device node associated\n", sysname); - return NULL; - } - - if (udev_device_should_be_ignored(udev_device)) { - log_debug(libinput, "%s: device is ignored\n", sysname); - return NULL; - } /* Use non-blocking mode so that we can loop on read on * evdev_device_data() until all events on the fd are @@ -1935,10 +2113,8 @@ O_RDWR | O_NONBLOCK | O_CLOEXEC); if (fd < 0) { log_info(libinput, - "%s: opening input device '%s' failed (%s).\n", - sysname, - devnode, - strerror(-fd)); + "opening input device '%s' failed (%s).\n", + devnode, strerror(-fd)); return NULL; } @@ -1946,61 +2122,63 @@ goto err; device = zalloc(sizeof *device); + if (device == NULL) + goto err; libinput_device_init(&device->base, seat); libinput_seat_ref(seat); - evdev_drain_fd(fd); - rc = libevdev_new_from_fd(fd, &device->evdev); if (rc != 0) goto err; libevdev_set_clock_id(device->evdev, CLOCK_MONOTONIC); - libevdev_set_device_log_function(device->evdev, - libevdev_log_func, - LIBEVDEV_LOG_ERROR, - libinput); + device->seat_caps = 0; device->is_mt = 0; device->mtdev = NULL; device->udev_device = udev_device_ref(udev_device); + device->rel.x = 0; + device->rel.y = 0; + device->abs.seat_slot = -1; device->dispatch = NULL; device->fd = fd; + device->pending_event = EVDEV_NONE; device->devname = libevdev_get_name(device->evdev); device->scroll.threshold = 5.0; /* Default may be overridden */ - device->scroll.direction_lock_threshold = 5.0; /* Default may be overridden */ device->scroll.direction = 0; device->scroll.wheel_click_angle = - evdev_read_wheel_click_props(device); - device->scroll.is_tilt = evdev_read_wheel_tilt_props(device); + evdev_read_wheel_click_prop(device); device->model_flags = evdev_read_model_flags(device); device->dpi = DEFAULT_MOUSE_DPI; /* at most 5 SYN_DROPPED log-messages per 30s */ ratelimit_init(&device->syn_drop_limit, s2us(30), 5); - /* at most 5 log-messages per 5s */ - ratelimit_init(&device->nonpointer_rel_limit, s2us(5), 5); matrix_init_identity(&device->abs.calibration); matrix_init_identity(&device->abs.usermatrix); matrix_init_identity(&device->abs.default_calibration); - evdev_pre_configure_model_quirks(device); + if (evdev_configure_device(device) == -1) + goto err; - device->dispatch = evdev_configure_device(device); - if (device->dispatch == NULL) { - if (device->seat_caps == 0) - unhandled_device = 1; + if (device->seat_caps == 0) { + unhandled_device = 1; goto err; } + /* If the dispatch was not set up use the fallback. */ + if (device->dispatch == NULL) + device->dispatch = fallback_dispatch_create(&device->base); + if (device->dispatch == NULL) + goto err; + device->source = libinput_add_fd(libinput, fd, evdev_device_dispatch, device); if (!device->source) goto err; - if (!evdev_set_device_group(device, udev_device)) + if (evdev_set_device_group(device, udev_device)) goto err; list_insert(seat->devices_list.prev, &device->base.link); @@ -2126,36 +2304,7 @@ matrix_mult(&device->abs.calibration, &transform, &scale); } -void -evdev_read_calibration_prop(struct evdev_device *device) -{ - const char *prop; - float calibration[6]; - - prop = udev_device_get_property_value(device->udev_device, - "LIBINPUT_CALIBRATION_MATRIX"); - - if (prop == NULL) - return; - - if (!device->abs.absinfo_x || !device->abs.absinfo_y) - return; - - if (!parse_calibration_property(prop, calibration)) - return; - - evdev_device_set_default_calibration(device, calibration); - evdev_log_info(device, - "applying calibration: %f %f %f %f %f %f\n", - calibration[0], - calibration[1], - calibration[2], - calibration[3], - calibration[4], - calibration[5]); -} - -bool +int evdev_device_has_capability(struct evdev_device *device, enum libinput_device_capability capability) { @@ -2168,19 +2317,13 @@ return !!(device->seat_caps & EVDEV_DEVICE_TOUCH); case LIBINPUT_DEVICE_CAP_GESTURE: return !!(device->seat_caps & EVDEV_DEVICE_GESTURE); - case LIBINPUT_DEVICE_CAP_TABLET_TOOL: - return !!(device->seat_caps & EVDEV_DEVICE_TABLET); - case LIBINPUT_DEVICE_CAP_TABLET_PAD: - return !!(device->seat_caps & EVDEV_DEVICE_TABLET_PAD); - case LIBINPUT_DEVICE_CAP_SWITCH: - return !!(device->seat_caps & EVDEV_DEVICE_SWITCH); default: - return false; + return 0; } } int -evdev_device_get_size(const struct evdev_device *device, +evdev_device_get_size(struct evdev_device *device, double *width, double *height) { @@ -2189,7 +2332,7 @@ x = libevdev_get_abs_info(device->evdev, ABS_X); y = libevdev_get_abs_info(device->evdev, ABS_Y); - if (!x || !y || device->abs.is_fake_resolution || + if (!x || !y || device->abs.fake_resolution || !x->resolution || !y->resolution) return -1; @@ -2217,29 +2360,6 @@ return libevdev_has_event_code(device->evdev, EV_KEY, code); } -int -evdev_device_has_switch(struct evdev_device *device, - enum libinput_switch sw) -{ - unsigned int code; - - if (!(device->seat_caps & EVDEV_DEVICE_SWITCH)) - return -1; - - switch (sw) { - case LIBINPUT_SWITCH_LID: - code = SW_LID; - break; - case LIBINPUT_SWITCH_TABLET_MODE: - code = SW_TABLET_MODE; - break; - default: - return -1; - } - - return libevdev_has_event_code(device->evdev, EV_SW, code); -} - static inline bool evdev_is_scrolling(const struct evdev_device *device, enum libinput_pointer_axis axis) @@ -2294,12 +2414,12 @@ trigger speed to start scrolling in the other direction */ } else if (!evdev_is_scrolling(device, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) { - if (fabs(delta->y) >= device->scroll.direction_lock_threshold) + if (fabs(delta->y) >= device->scroll.threshold) evdev_start_scrolling(device, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); } else if (!evdev_is_scrolling(device, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) { - if (fabs(delta->x) >= device->scroll.direction_lock_threshold) + if (fabs(delta->x) >= device->scroll.threshold) evdev_start_scrolling(device, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL); } @@ -2319,16 +2439,9 @@ if (!normalized_is_zero(event)) { const struct discrete_coords zero_discrete = { 0.0, 0.0 }; - uint32_t axes = device->scroll.direction; - - if (event.y == 0.0) - axes &= ~AS_MASK(LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); - if (event.x == 0.0) - axes &= ~AS_MASK(LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL); - evdev_notify_axis(device, time, - axes, + device->scroll.direction, source, &event, &zero_discrete); @@ -2362,11 +2475,11 @@ { struct libinput_device *it; - if (device->is_suspended) + if (device->suspended) return; list_for_each(it, &device->base.seat->devices_list, link) { - struct evdev_device *d = evdev_device(it); + struct evdev_device *d = (struct evdev_device*)it; if (it == &device->base) continue; @@ -2374,7 +2487,7 @@ d->dispatch->interface->device_suspended(d, device); } - device->is_suspended = true; + device->suspended = 1; } void @@ -2382,11 +2495,11 @@ { struct libinput_device *it; - if (!device->is_suspended) + if (!device->suspended) return; list_for_each(it, &device->base.seat->devices_list, link) { - struct evdev_device *d = evdev_device(it); + struct evdev_device *d = (struct evdev_device*)it; if (it == &device->base) continue; @@ -2394,14 +2507,12 @@ d->dispatch->interface->device_resumed(d, device); } - device->is_suspended = false; + device->suspended = 0; } -void +int evdev_device_suspend(struct evdev_device *device) { - struct libinput *libinput = evdev_libinput_context(device); - evdev_notify_suspended_device(device); if (device->dispatch->interface->suspend) @@ -2409,7 +2520,8 @@ device); if (device->source) { - libinput_remove_source(libinput, device->source); + libinput_remove_source(device->base.seat->libinput, + device->source); device->source = NULL; } @@ -2419,15 +2531,17 @@ } if (device->fd != -1) { - close_restricted(libinput, device->fd); + close_restricted(device->base.seat->libinput, device->fd); device->fd = -1; } + + return 0; } int evdev_device_resume(struct evdev_device *device) { - struct libinput *libinput = evdev_libinput_context(device); + struct libinput *libinput = device->base.seat->libinput; int fd; const char *devnode; struct input_event ev; @@ -2440,9 +2554,6 @@ return -ENODEV; devnode = udev_device_get_devnode(device->udev_device); - if (!devnode) - return -ENODEV; - fd = open_restricted(libinput, devnode, O_RDWR | O_NONBLOCK | O_CLOEXEC); @@ -2454,8 +2565,6 @@ return -ENODEV; } - evdev_drain_fd(fd); - device->fd = fd; if (evdev_need_mtdev(device)) { @@ -2485,6 +2594,8 @@ return -ENOMEM; } + memset(device->hw_key_mask, 0, sizeof(device->hw_key_mask)); + evdev_notify_resumed_device(device); return 0; @@ -2495,10 +2606,8 @@ { struct libinput_device *dev; - evdev_log_info(device, "device removed\n"); - list_for_each(dev, &device->base.seat->devices_list, link) { - struct evdev_device *d = evdev_device(dev); + struct evdev_device *d = (struct evdev_device*)dev; if (dev == &device->base) continue; @@ -2533,61 +2642,10 @@ if (device->base.group) libinput_device_group_unref(device->base.group); - free(device->output_name); filter_destroy(device->pointer.filter); - libinput_timer_destroy(&device->scroll.timer); - libinput_timer_destroy(&device->middlebutton.timer); libinput_seat_unref(device->base.seat); libevdev_free(device->evdev); udev_device_unref(device->udev_device); + free(device->mt.slots); free(device); } - -bool -evdev_tablet_has_left_handed(struct evdev_device *device) -{ - bool has_left_handed = false; -#if HAVE_LIBWACOM - WacomDeviceDatabase *db; - WacomDevice *d = NULL; - WacomError *error; - const char *devnode; - - db = libwacom_database_new(); - if (!db) { - evdev_log_info(device, - "failed to initialize libwacom context.\n"); - goto out; - } - - error = libwacom_error_new(); - devnode = udev_device_get_devnode(device->udev_device); - - d = libwacom_new_from_path(db, - devnode, - WFALLBACK_NONE, - error); - - if (d) { - if (libwacom_is_reversible(d)) - has_left_handed = true; - } else if (libwacom_error_get_code(error) == WERROR_UNKNOWN_MODEL) { - evdev_log_info(device, - "tablet '%s' unknown to libwacom\n", - device->devname); - } else { - evdev_log_error(device, - "libwacom error: %s\n", - libwacom_error_get_message(error)); - } - - if (error) - libwacom_error_free(&error); - if (d) - libwacom_destroy(d); - libwacom_database_destroy(db); - -out: -#endif - return has_left_handed; -} diff -Nru libinput-1.10.3/src/evdev-debounce.c libinput-0.21.0/src/evdev-debounce.c --- libinput-1.10.3/src/evdev-debounce.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-debounce.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,598 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "evdev-fallback.h" - -/* Debounce cases to handle - P ... button press - R ... button release - ---| timeout duration - - 'normal' .... event sent when it happens - 'filtered' .. event is not sent (but may be sent later) - 'delayed' ... event is sent with wall-clock delay - - - 1) P---| R P normal, R normal - 2) R---| P R normal, P normal - 3) P---R--| P P normal, R filtered, delayed, P normal - 4) R---P--| R R normal, P filtered, delayed, R normal - 4.1) P---| R--P--| P normal, R filtered - 5) P--R-P-| R P normal, R filtered, P filtered, R normal - 6) R--P-R-| P R normal, P filtered, R filtered, P normal - 7) P--R--| - ---P-| P normal, R filtered, P filtered - 8) R--P--| - ---R-| R normal, P filtered, R filtered - - 1, 2 are the normal click cases without debouncing taking effect - 3, 4 are fast clicks where the second event is delivered with a delay - 5, 6 are contact bounces, fast - 7, 8 are contact bounces, slow - - 4.1 is a special case with the same event sequence as 4 but we want to - filter the *release* event out, it's a button losing contact while being - held down. - - 7 and 8 are cases where the first event happens within the first timeout - but the second event is outside that timeout (but within the timeout of - the second event). These cases are currently unhandled. -*/ - - -enum debounce_event { - DEBOUNCE_EVENT_PRESS = 50, - DEBOUNCE_EVENT_RELEASE, - DEBOUNCE_EVENT_TIMEOUT, - DEBOUNCE_EVENT_TIMEOUT_SHORT, - DEBOUNCE_EVENT_OTHERBUTTON, -}; - -static inline const char * -debounce_state_to_str(enum debounce_state state) -{ - switch(state) { - CASE_RETURN_STRING(DEBOUNCE_STATE_IS_UP); - CASE_RETURN_STRING(DEBOUNCE_STATE_IS_DOWN); - CASE_RETURN_STRING(DEBOUNCE_STATE_DOWN_WAITING); - CASE_RETURN_STRING(DEBOUNCE_STATE_RELEASE_PENDING); - CASE_RETURN_STRING(DEBOUNCE_STATE_RELEASE_DELAYED); - CASE_RETURN_STRING(DEBOUNCE_STATE_RELEASE_WAITING); - CASE_RETURN_STRING(DEBOUNCE_STATE_MAYBE_SPURIOUS); - CASE_RETURN_STRING(DEBOUNCE_STATE_RELEASED); - CASE_RETURN_STRING(DEBOUNCE_STATE_PRESS_PENDING); - CASE_RETURN_STRING(DEBOUNCE_STATE_DISABLED); - } - - return NULL; -} - -static inline const char* -debounce_event_to_str(enum debounce_event event) -{ - switch(event) { - CASE_RETURN_STRING(DEBOUNCE_EVENT_PRESS); - CASE_RETURN_STRING(DEBOUNCE_EVENT_RELEASE); - CASE_RETURN_STRING(DEBOUNCE_EVENT_TIMEOUT); - CASE_RETURN_STRING(DEBOUNCE_EVENT_TIMEOUT_SHORT); - CASE_RETURN_STRING(DEBOUNCE_EVENT_OTHERBUTTON); - } - return NULL; -} - -static inline void -log_debounce_bug(struct fallback_dispatch *fallback, enum debounce_event event) -{ - evdev_log_bug_libinput(fallback->device, - "invalid debounce event %s in state %s\n", - debounce_event_to_str(event), - debounce_state_to_str(fallback->debounce.state)); - -} - -static inline void -debounce_set_state(struct fallback_dispatch *fallback, - enum debounce_state new_state) -{ - assert(new_state >= DEBOUNCE_STATE_IS_UP && - new_state <= DEBOUNCE_STATE_PRESS_PENDING); - - fallback->debounce.state = new_state; -} - -static inline void -debounce_set_timer(struct fallback_dispatch *fallback, - uint64_t time) -{ - const int DEBOUNCE_TIMEOUT_BOUNCE = ms2us(25); - - libinput_timer_set(&fallback->debounce.timer, - time + DEBOUNCE_TIMEOUT_BOUNCE); -} - -static inline void -debounce_set_timer_short(struct fallback_dispatch *fallback, - uint64_t time) -{ - const int DEBOUNCE_TIMEOUT_SPURIOUS = ms2us(12); - - libinput_timer_set(&fallback->debounce.timer_short, - time + DEBOUNCE_TIMEOUT_SPURIOUS); -} - -static inline void -debounce_cancel_timer(struct fallback_dispatch *fallback) -{ - libinput_timer_cancel(&fallback->debounce.timer); -} - -static inline void -debounce_cancel_timer_short(struct fallback_dispatch *fallback) -{ - libinput_timer_cancel(&fallback->debounce.timer_short); -} - -static inline void -debounce_enable_spurious(struct fallback_dispatch *fallback) -{ - if (fallback->debounce.spurious_enabled) - evdev_log_bug_libinput(fallback->device, - "tried to enable spurious debouncing twice\n"); - - fallback->debounce.spurious_enabled = true; - evdev_log_info(fallback->device, - "Enabling spurious button debouncing, " - "see %sbutton_debouncing.html for details\n", - HTTP_DOC_LINK); -} - -static void -debounce_notify_button(struct fallback_dispatch *fallback, - enum libinput_button_state state) -{ - struct evdev_device *device = fallback->device; - unsigned int code = fallback->debounce.button_code; - uint64_t time = fallback->debounce.button_time; - - code = evdev_to_left_handed(device, code); - - evdev_pointer_notify_physical_button(device, time, code, state); -} - -static void -debounce_is_up_handle_event(struct fallback_dispatch *fallback, enum debounce_event event, uint64_t time) -{ - switch (event) { - case DEBOUNCE_EVENT_PRESS: - fallback->debounce.button_time = time; - debounce_set_timer(fallback, time); - debounce_set_state(fallback, DEBOUNCE_STATE_DOWN_WAITING); - debounce_notify_button(fallback, - LIBINPUT_BUTTON_STATE_PRESSED); - break; - case DEBOUNCE_EVENT_RELEASE: - case DEBOUNCE_EVENT_TIMEOUT: - case DEBOUNCE_EVENT_TIMEOUT_SHORT: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_OTHERBUTTON: - break; - } -} - -static void -debounce_is_down_handle_event(struct fallback_dispatch *fallback, enum debounce_event event, uint64_t time) -{ - switch (event) { - case DEBOUNCE_EVENT_PRESS: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_RELEASE: - fallback->debounce.button_time = time; - debounce_set_timer(fallback, time); - debounce_set_timer_short(fallback, time); - if (fallback->debounce.spurious_enabled) { - debounce_set_state(fallback, DEBOUNCE_STATE_RELEASE_DELAYED); - } else { - debounce_set_state(fallback, DEBOUNCE_STATE_RELEASE_WAITING); - debounce_notify_button(fallback, - LIBINPUT_BUTTON_STATE_RELEASED); - } - break; - case DEBOUNCE_EVENT_TIMEOUT: - case DEBOUNCE_EVENT_TIMEOUT_SHORT: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_OTHERBUTTON: - break; - } -} - -static void -debounce_down_waiting_handle_event(struct fallback_dispatch *fallback, enum debounce_event event, uint64_t time) -{ - switch (event) { - case DEBOUNCE_EVENT_PRESS: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_RELEASE: - debounce_set_state(fallback, DEBOUNCE_STATE_RELEASE_PENDING); - /* Note: In the debouncing RPR case, we use the last - * release's time stamp */ - fallback->debounce.button_time = time; - break; - case DEBOUNCE_EVENT_TIMEOUT: - debounce_set_state(fallback, DEBOUNCE_STATE_IS_DOWN); - break; - case DEBOUNCE_EVENT_TIMEOUT_SHORT: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_OTHERBUTTON: - debounce_set_state(fallback, DEBOUNCE_STATE_IS_DOWN); - break; - } -} - -static void -debounce_release_pending_handle_event(struct fallback_dispatch *fallback, enum debounce_event event, uint64_t time) -{ - switch (event) { - case DEBOUNCE_EVENT_PRESS: - debounce_set_state(fallback, DEBOUNCE_STATE_DOWN_WAITING); - break; - case DEBOUNCE_EVENT_RELEASE: - case DEBOUNCE_EVENT_TIMEOUT_SHORT: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_TIMEOUT: - case DEBOUNCE_EVENT_OTHERBUTTON: - debounce_set_state(fallback, DEBOUNCE_STATE_IS_UP); - debounce_notify_button(fallback, - LIBINPUT_BUTTON_STATE_RELEASED); - break; - } -} - -static void -debounce_release_delayed_handle_event(struct fallback_dispatch *fallback, enum debounce_event event, uint64_t time) -{ - switch (event) { - case DEBOUNCE_EVENT_PRESS: - debounce_set_state(fallback, DEBOUNCE_STATE_IS_DOWN); - debounce_cancel_timer(fallback); - debounce_cancel_timer_short(fallback); - break; - case DEBOUNCE_EVENT_RELEASE: - case DEBOUNCE_EVENT_TIMEOUT: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_TIMEOUT_SHORT: - debounce_set_state(fallback, DEBOUNCE_STATE_RELEASE_WAITING); - debounce_notify_button(fallback, - LIBINPUT_BUTTON_STATE_RELEASED); - break; - case DEBOUNCE_EVENT_OTHERBUTTON: - debounce_set_state(fallback, DEBOUNCE_STATE_IS_UP); - debounce_notify_button(fallback, - LIBINPUT_BUTTON_STATE_RELEASED); - break; - } -} - -static void -debounce_release_waiting_handle_event(struct fallback_dispatch *fallback, enum debounce_event event, uint64_t time) -{ - switch (event) { - case DEBOUNCE_EVENT_PRESS: - /* Note: in a bouncing PRP case, we use the last press - * event time */ - fallback->debounce.button_time = time; - debounce_set_state(fallback, DEBOUNCE_STATE_MAYBE_SPURIOUS); - break; - case DEBOUNCE_EVENT_RELEASE: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_TIMEOUT: - debounce_set_state(fallback, DEBOUNCE_STATE_IS_UP); - break; - case DEBOUNCE_EVENT_TIMEOUT_SHORT: - debounce_set_state(fallback, DEBOUNCE_STATE_RELEASED); - break; - case DEBOUNCE_EVENT_OTHERBUTTON: - debounce_set_state(fallback, DEBOUNCE_STATE_IS_UP); - break; - } -} - -static void -debounce_maybe_spurious_handle_event(struct fallback_dispatch *fallback, enum debounce_event event, uint64_t time) -{ - switch (event) { - case DEBOUNCE_EVENT_PRESS: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_RELEASE: - debounce_set_state(fallback, DEBOUNCE_STATE_RELEASE_WAITING); - break; - case DEBOUNCE_EVENT_TIMEOUT_SHORT: - debounce_cancel_timer(fallback); - debounce_set_state(fallback, DEBOUNCE_STATE_IS_DOWN); - debounce_enable_spurious(fallback); - debounce_notify_button(fallback, - LIBINPUT_BUTTON_STATE_PRESSED); - break; - case DEBOUNCE_EVENT_TIMEOUT: - case DEBOUNCE_EVENT_OTHERBUTTON: - debounce_set_state(fallback, DEBOUNCE_STATE_IS_DOWN); - debounce_notify_button(fallback, - LIBINPUT_BUTTON_STATE_PRESSED); - break; - } -} - -static void -debounce_released_handle_event(struct fallback_dispatch *fallback, enum debounce_event event, uint64_t time) -{ - switch (event) { - case DEBOUNCE_EVENT_PRESS: - /* Note: in a debouncing PRP case, we use the last press' - * time */ - fallback->debounce.button_time = time; - debounce_set_state(fallback, DEBOUNCE_STATE_PRESS_PENDING); - break; - case DEBOUNCE_EVENT_RELEASE: - case DEBOUNCE_EVENT_TIMEOUT_SHORT: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_TIMEOUT: - case DEBOUNCE_EVENT_OTHERBUTTON: - debounce_set_state(fallback, DEBOUNCE_STATE_IS_UP); - break; - } -} - -static void -debounce_press_pending_event(struct fallback_dispatch *fallback, enum debounce_event event, uint64_t time) -{ - switch (event) { - case DEBOUNCE_EVENT_PRESS: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_RELEASE: - debounce_set_state(fallback, DEBOUNCE_STATE_RELEASED); - break; - case DEBOUNCE_EVENT_TIMEOUT_SHORT: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_TIMEOUT: - case DEBOUNCE_EVENT_OTHERBUTTON: - debounce_set_state(fallback, DEBOUNCE_STATE_IS_DOWN); - debounce_notify_button(fallback, - LIBINPUT_BUTTON_STATE_PRESSED); - break; - } -} - -static void -debounce_disabled_event(struct fallback_dispatch *fallback, - enum debounce_event event, - uint64_t time) -{ - switch (event) { - case DEBOUNCE_EVENT_PRESS: - fallback->debounce.button_time = time; - debounce_notify_button(fallback, - LIBINPUT_BUTTON_STATE_PRESSED); - break; - case DEBOUNCE_EVENT_RELEASE: - fallback->debounce.button_time = time; - debounce_notify_button(fallback, - LIBINPUT_BUTTON_STATE_RELEASED); - break; - case DEBOUNCE_EVENT_TIMEOUT_SHORT: - case DEBOUNCE_EVENT_TIMEOUT: - log_debounce_bug(fallback, event); - break; - case DEBOUNCE_EVENT_OTHERBUTTON: - break; - } -} - -static void -debounce_handle_event(struct fallback_dispatch *fallback, - enum debounce_event event, - uint64_t time) -{ - enum debounce_state current = fallback->debounce.state; - - if (event == DEBOUNCE_EVENT_OTHERBUTTON) { - debounce_cancel_timer(fallback); - debounce_cancel_timer_short(fallback); - } - - switch(current) { - case DEBOUNCE_STATE_IS_UP: - debounce_is_up_handle_event(fallback, event, time); - break; - case DEBOUNCE_STATE_IS_DOWN: - debounce_is_down_handle_event(fallback, event, time); - break; - case DEBOUNCE_STATE_DOWN_WAITING: - debounce_down_waiting_handle_event(fallback, event, time); - break; - case DEBOUNCE_STATE_RELEASE_PENDING: - debounce_release_pending_handle_event(fallback, event, time); - break; - case DEBOUNCE_STATE_RELEASE_DELAYED: - debounce_release_delayed_handle_event(fallback, event, time); - break; - case DEBOUNCE_STATE_RELEASE_WAITING: - debounce_release_waiting_handle_event(fallback, event, time); - break; - case DEBOUNCE_STATE_MAYBE_SPURIOUS: - debounce_maybe_spurious_handle_event(fallback, event, time); - break; - case DEBOUNCE_STATE_RELEASED: - debounce_released_handle_event(fallback, event, time); - break; - case DEBOUNCE_STATE_PRESS_PENDING: - debounce_press_pending_event(fallback, event, time); - break; - case DEBOUNCE_STATE_DISABLED: - debounce_disabled_event(fallback, event, time); - break; - } - - evdev_log_debug(fallback->device, - "debounce state: %s → %s → %s\n", - debounce_state_to_str(current), - debounce_event_to_str(event), - debounce_state_to_str(fallback->debounce.state)); -} - -void -fallback_debounce_handle_state(struct fallback_dispatch *dispatch, - uint64_t time) -{ - unsigned int changed[16] = {0}; /* event codes of changed buttons */ - size_t nchanged = 0; - bool flushed = false; - - for (unsigned int code = 0; code <= KEY_MAX; code++) { - if (get_key_type(code) != KEY_TYPE_BUTTON) - continue; - - if (hw_key_has_changed(dispatch, code)) - changed[nchanged++] = code; - - /* If you manage to press more than 16 buttons in the same - * frame, we just quietly ignore the rest of them */ - if (nchanged == ARRAY_LENGTH(changed)) - break; - } - - /* If we have more than one button this frame or a different button, - * flush the state machine with otherbutton */ - if (nchanged > 1 || - changed[0] != dispatch->debounce.button_code) { - debounce_handle_event(dispatch, - DEBOUNCE_EVENT_OTHERBUTTON, - time); - flushed = true; - } - - /* The state machine has some pre-conditions: - * - the IS_DOWN and IS_UP states are neutral entry states without - * any timeouts - * - a OTHERBUTTON event always flushes the state to IS_DOWN or - * IS_UP - */ - - for (size_t i = 0; i < nchanged; i++) { - bool is_down = hw_is_key_down(dispatch, changed[i]); - - if (flushed && - dispatch->debounce.state != DEBOUNCE_STATE_DISABLED) { - debounce_set_state(dispatch, - !is_down ? - DEBOUNCE_STATE_IS_DOWN : - DEBOUNCE_STATE_IS_UP); - flushed = false; - } - - - dispatch->debounce.button_code = changed[i]; - debounce_handle_event(dispatch, - is_down ? - DEBOUNCE_EVENT_PRESS : - DEBOUNCE_EVENT_RELEASE, - time); - - /* if we have more than one event, we flush the state - * machine immediately after the event itself */ - if (nchanged > 1) { - debounce_handle_event(dispatch, - DEBOUNCE_EVENT_OTHERBUTTON, - time); - flushed = true; - } - - } -} - -static void -debounce_timeout(uint64_t now, void *data) -{ - struct evdev_device *device = data; - struct fallback_dispatch *dispatch = - fallback_dispatch(device->dispatch); - - debounce_handle_event(dispatch, DEBOUNCE_EVENT_TIMEOUT, now); -} - -static void -debounce_timeout_short(uint64_t now, void *data) -{ - struct evdev_device *device = data; - struct fallback_dispatch *dispatch = - fallback_dispatch(device->dispatch); - - debounce_handle_event(dispatch, DEBOUNCE_EVENT_TIMEOUT_SHORT, now); -} - -void -fallback_init_debounce(struct fallback_dispatch *dispatch) -{ - struct evdev_device *device = dispatch->device; - char timer_name[64]; - - if (device->model_flags & EVDEV_MODEL_MS_NANO_TRANSCEIVER) { - dispatch->debounce.state = DEBOUNCE_STATE_DISABLED; - return; - } - - - dispatch->debounce.state = DEBOUNCE_STATE_IS_UP; - - snprintf(timer_name, - sizeof(timer_name), - "%s debounce short", - evdev_device_get_sysname(device)); - libinput_timer_init(&dispatch->debounce.timer_short, - evdev_libinput_context(device), - timer_name, - debounce_timeout_short, - device); - - snprintf(timer_name, - sizeof(timer_name), - "%s debounce", - evdev_device_get_sysname(device)); - libinput_timer_init(&dispatch->debounce.timer, - evdev_libinput_context(device), - timer_name, - debounce_timeout, - device); -} diff -Nru libinput-1.10.3/src/evdev-fallback.c libinput-0.21.0/src/evdev-fallback.c --- libinput-1.10.3/src/evdev-fallback.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-fallback.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1498 +0,0 @@ -/* - * Copyright © 2010 Intel Corporation - * Copyright © 2013 Jonas Ådahl - * Copyright © 2013-2017 Red Hat, Inc. - * Copyright © 2017 James Ye - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include - -#include "evdev-fallback.h" - -static void -fallback_keyboard_notify_key(struct fallback_dispatch *dispatch, - struct evdev_device *device, - uint64_t time, - int key, - enum libinput_key_state state) -{ - int down_count; - - down_count = evdev_update_key_down_count(device, key, state); - - if ((state == LIBINPUT_KEY_STATE_PRESSED && down_count == 1) || - (state == LIBINPUT_KEY_STATE_RELEASED && down_count == 0)) - keyboard_notify_key(&device->base, time, key, state); -} - -static void -fallback_lid_notify_toggle(struct fallback_dispatch *dispatch, - struct evdev_device *device, - uint64_t time) -{ - if (dispatch->lid.is_closed ^ dispatch->lid.is_closed_client_state) { - switch_notify_toggle(&device->base, - time, - LIBINPUT_SWITCH_LID, - dispatch->lid.is_closed); - dispatch->lid.is_closed_client_state = dispatch->lid.is_closed; - } -} - -static enum libinput_switch_state -fallback_interface_get_switch_state(struct evdev_dispatch *evdev_dispatch, - enum libinput_switch sw) -{ - struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch); - - switch (sw) { - case LIBINPUT_SWITCH_TABLET_MODE: - break; - default: - /* Internal function only, so we can abort here */ - abort(); - } - - return dispatch->tablet_mode.sw.state ? - LIBINPUT_SWITCH_STATE_ON : - LIBINPUT_SWITCH_STATE_OFF; -} - -static inline void -normalize_delta(struct evdev_device *device, - const struct device_coords *delta, - struct normalized_coords *normalized) -{ - normalized->x = delta->x * DEFAULT_MOUSE_DPI / (double)device->dpi; - normalized->y = delta->y * DEFAULT_MOUSE_DPI / (double)device->dpi; -} - -static inline bool -post_trackpoint_scroll(struct evdev_device *device, - struct normalized_coords unaccel, - uint64_t time) -{ - if (device->scroll.method != LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) - return false; - - switch(device->scroll.button_scroll_state) { - case BUTTONSCROLL_IDLE: - return false; - case BUTTONSCROLL_BUTTON_DOWN: - /* if the button is down but scroll is not active, we're within the - timeout where swallow motion events but don't post scroll buttons */ - evdev_log_debug(device, "btnscroll: discarding\n"); - return true; - case BUTTONSCROLL_READY: - device->scroll.button_scroll_state = BUTTONSCROLL_SCROLLING; - /* fallthrough */ - case BUTTONSCROLL_SCROLLING: - evdev_post_scroll(device, time, - LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS, - &unaccel); - return true; - } - - assert(!"invalid scroll button state"); -} - -static inline bool -fallback_filter_defuzz_touch(struct fallback_dispatch *dispatch, - struct evdev_device *device, - struct mt_slot *slot) -{ - struct device_coords point; - - if (!dispatch->mt.want_hysteresis) - return false; - - point = evdev_hysteresis(&slot->point, - &slot->hysteresis_center, - &dispatch->mt.hysteresis_margin); - - slot->hysteresis_center = slot->point; - if (point.x == slot->point.x && point.y == slot->point.y) - return true; - - slot->point = point; - - return false; -} - -static inline void -fallback_rotate_relative(struct fallback_dispatch *dispatch, - struct evdev_device *device) -{ - struct device_coords rel = dispatch->rel; - - if (!device->base.config.rotation) - return; - - /* loss of precision for non-90 degrees, but we only support 90 deg - * right now anyway */ - matrix_mult_vec(&dispatch->rotation.matrix, &rel.x, &rel.y); - - dispatch->rel = rel; -} - -static void -fallback_flush_relative_motion(struct fallback_dispatch *dispatch, - struct evdev_device *device, - uint64_t time) -{ - struct libinput_device *base = &device->base; - struct normalized_coords accel, unaccel; - struct device_float_coords raw; - - if (!(device->seat_caps & EVDEV_DEVICE_POINTER)) - return; - - fallback_rotate_relative(dispatch, device); - - normalize_delta(device, &dispatch->rel, &unaccel); - raw.x = dispatch->rel.x; - raw.y = dispatch->rel.y; - dispatch->rel.x = 0; - dispatch->rel.y = 0; - - /* Use unaccelerated deltas for pointing stick scroll */ - if (post_trackpoint_scroll(device, unaccel, time)) - return; - - if (device->pointer.filter) { - /* Apply pointer acceleration. */ - accel = filter_dispatch(device->pointer.filter, - &raw, - device, - time); - } else { - evdev_log_bug_libinput(device, - "accel filter missing\n"); - accel = unaccel; - } - - if (normalized_is_zero(accel) && normalized_is_zero(unaccel)) - return; - - pointer_notify_motion(base, time, &accel, &raw); -} - -static void -fallback_flush_wheels(struct fallback_dispatch *dispatch, - struct evdev_device *device, - uint64_t time) -{ - struct normalized_coords wheel_degrees = { 0.0, 0.0 }; - struct discrete_coords discrete = { 0.0, 0.0 }; - enum libinput_pointer_axis_source source; - - if (!(device->seat_caps & EVDEV_DEVICE_POINTER)) - return; - - - if (dispatch->wheel.y != 0) { - wheel_degrees.y = -1 * dispatch->wheel.y * - device->scroll.wheel_click_angle.y; - discrete.y = -1 * dispatch->wheel.y; - - source = device->scroll.is_tilt.vertical ? - LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT: - LIBINPUT_POINTER_AXIS_SOURCE_WHEEL; - - evdev_notify_axis( - device, - time, - AS_MASK(LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL), - source, - &wheel_degrees, - &discrete); - dispatch->wheel.y = 0; - } - - if (dispatch->wheel.x != 0) { - wheel_degrees.x = dispatch->wheel.x * - device->scroll.wheel_click_angle.x; - discrete.x = dispatch->wheel.x; - - source = device->scroll.is_tilt.horizontal ? - LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT: - LIBINPUT_POINTER_AXIS_SOURCE_WHEEL; - - evdev_notify_axis( - device, - time, - AS_MASK(LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL), - source, - &wheel_degrees, - &discrete); - dispatch->wheel.x = 0; - } -} - -static void -fallback_flush_absolute_motion(struct fallback_dispatch *dispatch, - struct evdev_device *device, - uint64_t time) -{ - struct libinput_device *base = &device->base; - struct device_coords point; - - if (!(device->seat_caps & EVDEV_DEVICE_POINTER)) - return; - - point = dispatch->abs.point; - evdev_transform_absolute(device, &point); - - pointer_notify_motion_absolute(base, time, &point); -} - -static bool -fallback_flush_mt_down(struct fallback_dispatch *dispatch, - struct evdev_device *device, - int slot_idx, - uint64_t time) -{ - struct libinput_device *base = &device->base; - struct libinput_seat *seat = base->seat; - struct device_coords point; - struct mt_slot *slot; - int seat_slot; - - if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) - return false; - - slot = &dispatch->mt.slots[slot_idx]; - if (slot->seat_slot != -1) { - evdev_log_bug_kernel(device, - "driver sent multiple touch down for the same slot"); - return false; - } - - seat_slot = ffs(~seat->slot_map) - 1; - slot->seat_slot = seat_slot; - - if (seat_slot == -1) - return false; - - seat->slot_map |= 1 << seat_slot; - point = slot->point; - slot->hysteresis_center = point; - evdev_transform_absolute(device, &point); - - touch_notify_touch_down(base, time, slot_idx, seat_slot, - &point); - - return true; -} - -static bool -fallback_flush_mt_motion(struct fallback_dispatch *dispatch, - struct evdev_device *device, - int slot_idx, - uint64_t time) -{ - struct libinput_device *base = &device->base; - struct device_coords point; - struct mt_slot *slot; - int seat_slot; - - if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) - return false; - - slot = &dispatch->mt.slots[slot_idx]; - seat_slot = slot->seat_slot; - point = slot->point; - - if (seat_slot == -1) - return false; - - if (fallback_filter_defuzz_touch(dispatch, device, slot)) - return false; - - evdev_transform_absolute(device, &point); - touch_notify_touch_motion(base, time, slot_idx, seat_slot, - &point); - - return true; -} - -static bool -fallback_flush_mt_up(struct fallback_dispatch *dispatch, - struct evdev_device *device, - int slot_idx, - uint64_t time) -{ - struct libinput_device *base = &device->base; - struct libinput_seat *seat = base->seat; - struct mt_slot *slot; - int seat_slot; - - if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) - return false; - - slot = &dispatch->mt.slots[slot_idx]; - seat_slot = slot->seat_slot; - slot->seat_slot = -1; - - if (seat_slot == -1) - return false; - - seat->slot_map &= ~(1 << seat_slot); - - touch_notify_touch_up(base, time, slot_idx, seat_slot); - - return true; -} - -static bool -fallback_flush_st_down(struct fallback_dispatch *dispatch, - struct evdev_device *device, - uint64_t time) -{ - struct libinput_device *base = &device->base; - struct libinput_seat *seat = base->seat; - struct device_coords point; - int seat_slot; - - if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) - return false; - - if (dispatch->abs.seat_slot != -1) { - evdev_log_bug_kernel(device, - "driver sent multiple touch down for the same slot"); - return false; - } - - seat_slot = ffs(~seat->slot_map) - 1; - dispatch->abs.seat_slot = seat_slot; - - if (seat_slot == -1) - return false; - - seat->slot_map |= 1 << seat_slot; - - point = dispatch->abs.point; - evdev_transform_absolute(device, &point); - - touch_notify_touch_down(base, time, -1, seat_slot, &point); - - return true; -} - -static bool -fallback_flush_st_motion(struct fallback_dispatch *dispatch, - struct evdev_device *device, - uint64_t time) -{ - struct libinput_device *base = &device->base; - struct device_coords point; - int seat_slot; - - point = dispatch->abs.point; - evdev_transform_absolute(device, &point); - - seat_slot = dispatch->abs.seat_slot; - - if (seat_slot == -1) - return false; - - touch_notify_touch_motion(base, time, -1, seat_slot, &point); - - return true; -} - -static bool -fallback_flush_st_up(struct fallback_dispatch *dispatch, - struct evdev_device *device, - uint64_t time) -{ - struct libinput_device *base = &device->base; - struct libinput_seat *seat = base->seat; - int seat_slot; - - if (!(device->seat_caps & EVDEV_DEVICE_TOUCH)) - return false; - - seat_slot = dispatch->abs.seat_slot; - dispatch->abs.seat_slot = -1; - - if (seat_slot == -1) - return false; - - seat->slot_map &= ~(1 << seat_slot); - - touch_notify_touch_up(base, time, -1, seat_slot); - - return true; -} - -static void -fallback_process_touch_button(struct fallback_dispatch *dispatch, - struct evdev_device *device, - uint64_t time, int value) -{ - dispatch->pending_event |= (value) ? - EVDEV_ABSOLUTE_TOUCH_DOWN : - EVDEV_ABSOLUTE_TOUCH_UP; -} - -static inline void -fallback_process_key(struct fallback_dispatch *dispatch, - struct evdev_device *device, - struct input_event *e, uint64_t time) -{ - enum key_type type; - - /* ignore kernel key repeat */ - if (e->value == 2) - return; - - if (e->code == BTN_TOUCH) { - if (!device->is_mt) - fallback_process_touch_button(dispatch, - device, - time, - e->value); - return; - } - - type = get_key_type(e->code); - - /* Ignore key release events from the kernel for keys that libinput - * never got a pressed event for or key presses for keys that we - * think are still down */ - switch (type) { - case KEY_TYPE_NONE: - break; - case KEY_TYPE_KEY: - case KEY_TYPE_BUTTON: - if ((e->value && hw_is_key_down(dispatch, e->code)) || - (e->value == 0 && !hw_is_key_down(dispatch, e->code))) - return; - - dispatch->pending_event |= EVDEV_KEY; - break; - } - - hw_set_key_down(dispatch, e->code, e->value); - - switch (type) { - case KEY_TYPE_NONE: - break; - case KEY_TYPE_KEY: - fallback_keyboard_notify_key( - dispatch, - device, - time, - e->code, - e->value ? LIBINPUT_KEY_STATE_PRESSED : - LIBINPUT_KEY_STATE_RELEASED); - break; - case KEY_TYPE_BUTTON: - break; - } -} - -static void -fallback_process_touch(struct fallback_dispatch *dispatch, - struct evdev_device *device, - struct input_event *e, - uint64_t time) -{ - struct mt_slot *slot = &dispatch->mt.slots[dispatch->mt.slot]; - - if (e->code == ABS_MT_SLOT) { - if ((size_t)e->value >= dispatch->mt.slots_len) { - evdev_log_bug_libinput(device, - "exceeded slot count (%d of max %zd)\n", - e->value, - dispatch->mt.slots_len); - e->value = dispatch->mt.slots_len - 1; - } - dispatch->mt.slot = e->value; - return; - } - - switch (e->code) { - case ABS_MT_TRACKING_ID: - if (e->value >= 0) { - dispatch->pending_event |= EVDEV_ABSOLUTE_MT; - slot->state = SLOT_STATE_BEGIN; - } else { - dispatch->pending_event |= EVDEV_ABSOLUTE_MT; - slot->state = SLOT_STATE_END; - } - slot->dirty = true; - break; - case ABS_MT_POSITION_X: - evdev_device_check_abs_axis_range(device, e->code, e->value); - dispatch->mt.slots[dispatch->mt.slot].point.x = e->value; - dispatch->pending_event |= EVDEV_ABSOLUTE_MT; - slot->dirty = true; - break; - case ABS_MT_POSITION_Y: - evdev_device_check_abs_axis_range(device, e->code, e->value); - dispatch->mt.slots[dispatch->mt.slot].point.y = e->value; - dispatch->pending_event |= EVDEV_ABSOLUTE_MT; - slot->dirty = true; - break; - } -} - -static inline void -fallback_process_absolute_motion(struct fallback_dispatch *dispatch, - struct evdev_device *device, - struct input_event *e) -{ - switch (e->code) { - case ABS_X: - evdev_device_check_abs_axis_range(device, e->code, e->value); - dispatch->abs.point.x = e->value; - dispatch->pending_event |= EVDEV_ABSOLUTE_MOTION; - break; - case ABS_Y: - evdev_device_check_abs_axis_range(device, e->code, e->value); - dispatch->abs.point.y = e->value; - dispatch->pending_event |= EVDEV_ABSOLUTE_MOTION; - break; - } -} - -static void -fallback_lid_keyboard_event(uint64_t time, - struct libinput_event *event, - void *data) -{ - struct fallback_dispatch *dispatch = fallback_dispatch(data); - - if (!dispatch->lid.is_closed) - return; - - if (event->type != LIBINPUT_EVENT_KEYBOARD_KEY) - return; - - if (dispatch->lid.reliability == RELIABILITY_WRITE_OPEN) { - int fd = libevdev_get_fd(dispatch->device->evdev); - int rc; - struct input_event ev[2] = { - {{ 0, 0 }, EV_SW, SW_LID, 0 }, - {{ 0, 0 }, EV_SYN, SYN_REPORT, 0 }, - }; - - rc = write(fd, ev, sizeof(ev)); - - if (rc < 0) - evdev_log_error(dispatch->device, - "failed to write SW_LID state (%s)", - strerror(errno)); - - /* In case write() fails, we sync the lid state manually - * regardless. */ - } - - /* Posting the event here means we preempt the keyboard events that - * caused us to wake up, so the lid event is always passed on before - * the key event. - */ - dispatch->lid.is_closed = false; - fallback_lid_notify_toggle(dispatch, dispatch->device, time); -} - -static void -fallback_lid_toggle_keyboard_listener(struct fallback_dispatch *dispatch, - struct paired_keyboard *kbd, - bool is_closed) -{ - assert(kbd->device); - - libinput_device_remove_event_listener(&kbd->listener); - - if (is_closed) { - libinput_device_add_event_listener( - &kbd->device->base, - &kbd->listener, - fallback_lid_keyboard_event, - dispatch); - } else { - libinput_device_init_event_listener(&kbd->listener); - } -} - -static void -fallback_lid_toggle_keyboard_listeners(struct fallback_dispatch *dispatch, - bool is_closed) -{ - struct paired_keyboard *kbd; - - ARRAY_FOR_EACH(dispatch->lid.paired_keyboard, kbd) { - if (!kbd->device) - continue; - - fallback_lid_toggle_keyboard_listener(dispatch, - kbd, - is_closed); - } -} - -static inline void -fallback_process_switch(struct fallback_dispatch *dispatch, - struct evdev_device *device, - struct input_event *e, - uint64_t time) -{ - enum libinput_switch_state state; - bool is_closed; - - /* TODO: this should to move to handle_state */ - - switch (e->code) { - case SW_LID: - is_closed = !!e->value; - - fallback_lid_toggle_keyboard_listeners(dispatch, is_closed); - - if (dispatch->lid.is_closed == is_closed) - return; - - dispatch->lid.is_closed = is_closed; - fallback_lid_notify_toggle(dispatch, device, time); - break; - case SW_TABLET_MODE: - if (dispatch->tablet_mode.sw.state == e->value) - return; - - dispatch->tablet_mode.sw.state = e->value; - if (e->value) - state = LIBINPUT_SWITCH_STATE_ON; - else - state = LIBINPUT_SWITCH_STATE_OFF; - switch_notify_toggle(&device->base, - time, - LIBINPUT_SWITCH_TABLET_MODE, - state); - break; - } -} - -static inline bool -fallback_reject_relative(struct evdev_device *device, - const struct input_event *e, - uint64_t time) -{ - if ((e->code == REL_X || e->code == REL_Y) && - (device->seat_caps & EVDEV_DEVICE_POINTER) == 0) { - evdev_log_bug_libinput_ratelimit(device, - &device->nonpointer_rel_limit, - "REL_X/Y from a non-pointer device\n"); - return true; - } - - return false; -} - -static inline void -fallback_process_relative(struct fallback_dispatch *dispatch, - struct evdev_device *device, - struct input_event *e, uint64_t time) -{ - if (fallback_reject_relative(device, e, time)) - return; - - switch (e->code) { - case REL_X: - dispatch->rel.x += e->value; - dispatch->pending_event |= EVDEV_RELATIVE_MOTION; - break; - case REL_Y: - dispatch->rel.y += e->value; - dispatch->pending_event |= EVDEV_RELATIVE_MOTION; - break; - case REL_WHEEL: - dispatch->wheel.y += e->value; - dispatch->pending_event |= EVDEV_WHEEL; - break; - case REL_HWHEEL: - dispatch->wheel.x += e->value; - dispatch->pending_event |= EVDEV_WHEEL; - break; - } -} - -static inline void -fallback_process_absolute(struct fallback_dispatch *dispatch, - struct evdev_device *device, - struct input_event *e, - uint64_t time) -{ - if (device->is_mt) { - fallback_process_touch(dispatch, device, e, time); - } else { - fallback_process_absolute_motion(dispatch, device, e); - } -} - -static inline bool -fallback_any_button_down(struct fallback_dispatch *dispatch, - struct evdev_device *device) -{ - unsigned int button; - - for (button = BTN_LEFT; button < BTN_JOYSTICK; button++) { - if (libevdev_has_event_code(device->evdev, EV_KEY, button) && - hw_is_key_down(dispatch, button)) - return true; - } - return false; -} - -static void -fallback_handle_state(struct fallback_dispatch *dispatch, - struct evdev_device *device, - uint64_t time) -{ - bool need_touch_frame = false; - - /* Relative motion */ - if (dispatch->pending_event & EVDEV_RELATIVE_MOTION) - fallback_flush_relative_motion(dispatch, device, time); - - /* Single touch or absolute pointer devices */ - if (dispatch->pending_event & EVDEV_ABSOLUTE_TOUCH_DOWN) { - if (fallback_flush_st_down(dispatch, device, time)) - need_touch_frame = true; - } - - if (dispatch->pending_event & EVDEV_ABSOLUTE_MOTION) { - if (device->seat_caps & EVDEV_DEVICE_TOUCH) { - if (fallback_flush_st_motion(dispatch, - device, - time)) - need_touch_frame = true; - } else if (device->seat_caps & EVDEV_DEVICE_POINTER) { - fallback_flush_absolute_motion(dispatch, - device, - time); - } - } - - if (dispatch->pending_event & EVDEV_ABSOLUTE_TOUCH_UP) { - if (fallback_flush_st_up(dispatch, device, time)) - need_touch_frame = true; - } - - /* Multitouch devices */ - if (dispatch->pending_event & EVDEV_ABSOLUTE_MT) { - bool sent = false; - for (size_t i = 0; i < dispatch->mt.slots_len; i++) { - struct mt_slot *slot = &dispatch->mt.slots[i]; - - if (!slot->dirty) - continue; - - if (slot->state == SLOT_STATE_BEGIN) { - sent = fallback_flush_mt_down(dispatch, - device, - i, - time); - slot->state = SLOT_STATE_UPDATE; - } else if (slot->state == SLOT_STATE_UPDATE) { - sent = fallback_flush_mt_motion(dispatch, - device, - i, - time); - } else if (slot->state == SLOT_STATE_END) { - sent = fallback_flush_mt_up(dispatch, - device, - i, - time); - slot->state = SLOT_STATE_NONE; - } - - - slot->dirty = false; - } - - need_touch_frame = sent; - } - - if (need_touch_frame) - touch_notify_frame(&device->base, time); - - fallback_flush_wheels(dispatch, device, time); - - /* Buttons and keys */ - if (dispatch->pending_event & EVDEV_KEY) { - bool want_debounce = false; - for (unsigned int code = 0; code <= KEY_MAX; code++) { - if (!hw_key_has_changed(dispatch, code)) - continue; - - if (get_key_type(code) == KEY_TYPE_BUTTON) { - want_debounce = true; - break; - } - } - - if (want_debounce) - fallback_debounce_handle_state(dispatch, time); - - hw_key_update_last_state(dispatch); - } - - dispatch->pending_event = EVDEV_NONE; -} - -static void -fallback_interface_process(struct evdev_dispatch *evdev_dispatch, - struct evdev_device *device, - struct input_event *event, - uint64_t time) -{ - struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch); - - if (dispatch->ignore_events) - return; - - switch (event->type) { - case EV_REL: - fallback_process_relative(dispatch, device, event, time); - break; - case EV_ABS: - fallback_process_absolute(dispatch, device, event, time); - break; - case EV_KEY: - fallback_process_key(dispatch, device, event, time); - break; - case EV_SW: - fallback_process_switch(dispatch, device, event, time); - break; - case EV_SYN: - fallback_handle_state(dispatch, device, time); - break; - } -} - -static void -release_touches(struct fallback_dispatch *dispatch, - struct evdev_device *device, - uint64_t time) -{ - unsigned int idx; - bool need_frame = false; - - need_frame = fallback_flush_st_up(dispatch, device, time); - - for (idx = 0; idx < dispatch->mt.slots_len; idx++) { - struct mt_slot *slot = &dispatch->mt.slots[idx]; - - if (slot->seat_slot == -1) - continue; - - if (fallback_flush_mt_up(dispatch, device, idx, time)) - need_frame = true; - } - - if (need_frame) - touch_notify_frame(&device->base, time); -} - -static void -release_pressed_keys(struct fallback_dispatch *dispatch, - struct evdev_device *device, - uint64_t time) -{ - int code; - - for (code = 0; code < KEY_CNT; code++) { - int count = get_key_down_count(device, code); - - if (count == 0) - continue; - - if (count > 1) { - evdev_log_bug_libinput(device, - "key %d is down %d times.\n", - code, - count); - } - - switch (get_key_type(code)) { - case KEY_TYPE_NONE: - break; - case KEY_TYPE_KEY: - fallback_keyboard_notify_key( - dispatch, - device, - time, - code, - LIBINPUT_KEY_STATE_RELEASED); - break; - case KEY_TYPE_BUTTON: - evdev_pointer_notify_physical_button( - device, - time, - evdev_to_left_handed(device, code), - LIBINPUT_BUTTON_STATE_RELEASED); - break; - } - - count = get_key_down_count(device, code); - if (count != 0) { - evdev_log_bug_libinput(device, - "releasing key %d failed.\n", - code); - break; - } - } -} - -static void -fallback_return_to_neutral_state(struct fallback_dispatch *dispatch, - struct evdev_device *device) -{ - struct libinput *libinput = evdev_libinput_context(device); - uint64_t time; - - if ((time = libinput_now(libinput)) == 0) - return; - - release_touches(dispatch, device, time); - release_pressed_keys(dispatch, device, time); - memset(dispatch->hw_key_mask, 0, sizeof(dispatch->hw_key_mask)); - memset(dispatch->hw_key_mask, 0, sizeof(dispatch->last_hw_key_mask)); -} - -static void -fallback_interface_suspend(struct evdev_dispatch *evdev_dispatch, - struct evdev_device *device) -{ - struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch); - - fallback_return_to_neutral_state(dispatch, device); -} - -static void -fallback_interface_remove(struct evdev_dispatch *evdev_dispatch) -{ - struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch); - struct paired_keyboard *kbd; - - libinput_device_remove_event_listener(&dispatch->tablet_mode.other.listener); - - ARRAY_FOR_EACH(dispatch->lid.paired_keyboard, kbd) { - if (!kbd->device) - continue; - - libinput_device_remove_event_listener(&kbd->listener); - } -} - -static void -fallback_interface_sync_initial_state(struct evdev_device *device, - struct evdev_dispatch *evdev_dispatch) -{ - struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch); - uint64_t time = libinput_now(evdev_libinput_context(device)); - - if (device->tags & EVDEV_TAG_LID_SWITCH) { - struct libevdev *evdev = device->evdev; - - dispatch->lid.is_closed = libevdev_get_event_value(evdev, - EV_SW, - SW_LID); - dispatch->lid.is_closed_client_state = false; - - /* For the initial state sync, we depend on whether the lid switch - * is reliable. If we know it's reliable, we sync as expected. - * If we're not sure, we ignore the initial state and only sync on - * the first future lid close event. Laptops with a broken switch - * that always have the switch in 'on' state thus don't mess up our - * touchpad. - */ - if (dispatch->lid.is_closed && - dispatch->lid.reliability == RELIABILITY_RELIABLE) { - fallback_lid_notify_toggle(dispatch, device, time); - } - } - - if (dispatch->tablet_mode.sw.state) { - switch_notify_toggle(&device->base, - time, - LIBINPUT_SWITCH_TABLET_MODE, - LIBINPUT_SWITCH_STATE_ON); - } -} - -static void -fallback_interface_toggle_touch(struct evdev_dispatch *evdev_dispatch, - struct evdev_device *device, - bool enable) -{ - struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch); - bool ignore_events = !enable; - - if (ignore_events == dispatch->ignore_events) - return; - - if (ignore_events) - fallback_return_to_neutral_state(dispatch, device); - - dispatch->ignore_events = ignore_events; -} - -static void -fallback_interface_destroy(struct evdev_dispatch *evdev_dispatch) -{ - struct fallback_dispatch *dispatch = fallback_dispatch(evdev_dispatch); - - libinput_timer_cancel(&dispatch->debounce.timer); - libinput_timer_destroy(&dispatch->debounce.timer); - libinput_timer_cancel(&dispatch->debounce.timer_short); - libinput_timer_destroy(&dispatch->debounce.timer_short); - free(dispatch->mt.slots); - free(dispatch); -} - -static void -fallback_lid_pair_keyboard(struct evdev_device *lid_switch, - struct evdev_device *keyboard) -{ - struct fallback_dispatch *dispatch = - fallback_dispatch(lid_switch->dispatch); - struct paired_keyboard *kbd; - bool paired = false; - - if ((keyboard->tags & EVDEV_TAG_KEYBOARD) == 0 || - (lid_switch->tags & EVDEV_TAG_LID_SWITCH) == 0) - return; - - if ((keyboard->tags & EVDEV_TAG_INTERNAL_KEYBOARD) == 0) - return; - - ARRAY_FOR_EACH(dispatch->lid.paired_keyboard, kbd) { - if (kbd->device) - continue; - - kbd->device = keyboard; - evdev_log_debug(lid_switch, - "lid: keyboard paired with %s<->%s\n", - lid_switch->devname, - keyboard->devname); - - /* We need to init the event listener now only if the - * reported state is closed. */ - if (dispatch->lid.is_closed) - fallback_lid_toggle_keyboard_listener( - dispatch, - kbd, - dispatch->lid.is_closed); - paired = true; - break; - } - - if (!paired) - evdev_log_bug_libinput(lid_switch, - "lid: too many internal keyboards\n"); -} - -static void -fallback_resume(struct fallback_dispatch *dispatch, - struct evdev_device *device) -{ - if (dispatch->base.sendevents.current_mode == - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED) - return; - - evdev_device_resume(device); -} - -static void -fallback_suspend(struct fallback_dispatch *dispatch, - struct evdev_device *device) -{ - evdev_device_suspend(device); -} - -static void -fallback_tablet_mode_switch_event(uint64_t time, - struct libinput_event *event, - void *data) -{ - struct fallback_dispatch *dispatch = data; - struct evdev_device *device = dispatch->device; - struct libinput_event_switch *swev; - - if (libinput_event_get_type(event) != LIBINPUT_EVENT_SWITCH_TOGGLE) - return; - - swev = libinput_event_get_switch_event(event); - if (libinput_event_switch_get_switch(swev) != - LIBINPUT_SWITCH_TABLET_MODE) - return; - - - switch (libinput_event_switch_get_switch_state(swev)) { - case LIBINPUT_SWITCH_STATE_OFF: - fallback_resume(dispatch, device); - evdev_log_debug(device, "tablet-mode: resuming device\n"); - break; - case LIBINPUT_SWITCH_STATE_ON: - fallback_suspend(dispatch, device); - evdev_log_debug(device, "tablet-mode: suspending device\n"); - break; - } -} - -static void -fallback_keyboard_pair_tablet_mode(struct evdev_device *keyboard, - struct evdev_device *tablet_mode_switch) -{ - struct fallback_dispatch *dispatch = - fallback_dispatch(keyboard->dispatch); - - if ((keyboard->tags & - (EVDEV_TAG_TRACKPOINT|EVDEV_TAG_INTERNAL_KEYBOARD)) == 0) - return; - - if ((tablet_mode_switch->tags & EVDEV_TAG_TABLET_MODE_SWITCH) == 0) - return; - - if (dispatch->tablet_mode.other.sw_device) - return; - - evdev_log_debug(keyboard, - "tablet_mode_switch: activated for %s<->%s\n", - keyboard->devname, - tablet_mode_switch->devname); - - libinput_device_add_event_listener(&tablet_mode_switch->base, - &dispatch->tablet_mode.other.listener, - fallback_tablet_mode_switch_event, - dispatch); - dispatch->tablet_mode.other.sw_device = tablet_mode_switch; - - if (evdev_device_switch_get_state(tablet_mode_switch, - LIBINPUT_SWITCH_TABLET_MODE) - == LIBINPUT_SWITCH_STATE_ON) - fallback_suspend(dispatch, keyboard); -} - -static void -fallback_interface_device_added(struct evdev_device *device, - struct evdev_device *added_device) -{ - fallback_lid_pair_keyboard(device, added_device); - fallback_keyboard_pair_tablet_mode(device, added_device); -} - -static void -fallback_interface_device_removed(struct evdev_device *device, - struct evdev_device *removed_device) -{ - struct fallback_dispatch *dispatch = - fallback_dispatch(device->dispatch); - struct paired_keyboard *kbd; - - ARRAY_FOR_EACH(dispatch->lid.paired_keyboard, kbd) { - if (!kbd->device) - continue; - - if (kbd->device != removed_device) - continue; - - libinput_device_remove_event_listener(&kbd->listener); - libinput_device_init_event_listener(&kbd->listener); - kbd->device = NULL; - } - - if (removed_device == dispatch->tablet_mode.other.sw_device) { - libinput_device_remove_event_listener( - &dispatch->tablet_mode.other.listener); - libinput_device_init_event_listener( - &dispatch->tablet_mode.other.listener); - dispatch->tablet_mode.other.sw_device = NULL; - } -} - -struct evdev_dispatch_interface fallback_interface = { - .process = fallback_interface_process, - .suspend = fallback_interface_suspend, - .remove = fallback_interface_remove, - .destroy = fallback_interface_destroy, - .device_added = fallback_interface_device_added, - .device_removed = fallback_interface_device_removed, - .device_suspended = fallback_interface_device_removed, /* treat as remove */ - .device_resumed = fallback_interface_device_added, /* treat as add */ - .post_added = fallback_interface_sync_initial_state, - .toggle_touch = fallback_interface_toggle_touch, - .get_switch_state = fallback_interface_get_switch_state, -}; - -static void -fallback_change_to_left_handed(struct evdev_device *device) -{ - struct fallback_dispatch *dispatch = fallback_dispatch(device->dispatch); - - if (device->left_handed.want_enabled == device->left_handed.enabled) - return; - - if (fallback_any_button_down(dispatch, device)) - return; - - device->left_handed.enabled = device->left_handed.want_enabled; -} - -static void -fallback_change_scroll_method(struct evdev_device *device) -{ - struct fallback_dispatch *dispatch = fallback_dispatch(device->dispatch); - - if (device->scroll.want_method == device->scroll.method && - device->scroll.want_button == device->scroll.button) - return; - - if (fallback_any_button_down(dispatch, device)) - return; - - device->scroll.method = device->scroll.want_method; - device->scroll.button = device->scroll.want_button; -} - -static int -fallback_rotation_config_is_available(struct libinput_device *device) -{ - /* This function only gets called when we support rotation */ - return 1; -} - -static enum libinput_config_status -fallback_rotation_config_set_angle(struct libinput_device *libinput_device, - unsigned int degrees_cw) -{ - struct evdev_device *device = evdev_device(libinput_device); - struct fallback_dispatch *dispatch = fallback_dispatch(device->dispatch); - - dispatch->rotation.angle = degrees_cw; - matrix_init_rotate(&dispatch->rotation.matrix, degrees_cw); - - return LIBINPUT_CONFIG_STATUS_SUCCESS; -} - -static unsigned int -fallback_rotation_config_get_angle(struct libinput_device *libinput_device) -{ - struct evdev_device *device = evdev_device(libinput_device); - struct fallback_dispatch *dispatch = fallback_dispatch(device->dispatch); - - return dispatch->rotation.angle; -} - -static unsigned int -fallback_rotation_config_get_default_angle(struct libinput_device *device) -{ - return 0; -} - -static void -fallback_init_rotation(struct fallback_dispatch *dispatch, - struct evdev_device *device) -{ - if ((device->model_flags & EVDEV_MODEL_TRACKBALL) == 0) - return; - - dispatch->rotation.config.is_available = fallback_rotation_config_is_available; - dispatch->rotation.config.set_angle = fallback_rotation_config_set_angle; - dispatch->rotation.config.get_angle = fallback_rotation_config_get_angle; - dispatch->rotation.config.get_default_angle = fallback_rotation_config_get_default_angle; - dispatch->rotation.is_enabled = false; - matrix_init_identity(&dispatch->rotation.matrix); - device->base.config.rotation = &dispatch->rotation.config; -} - -static inline int -fallback_dispatch_init_slots(struct fallback_dispatch *dispatch, - struct evdev_device *device) -{ - struct libevdev *evdev = device->evdev; - struct mt_slot *slots; - int num_slots; - int active_slot; - int slot; - - if (evdev_is_fake_mt_device(device) || - !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) || - !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y)) - return 0; - - /* We only handle the slotted Protocol B in libinput. - Devices with ABS_MT_POSITION_* but not ABS_MT_SLOT - require mtdev for conversion. */ - if (evdev_need_mtdev(device)) { - device->mtdev = mtdev_new_open(device->fd); - if (!device->mtdev) - return -1; - - /* pick 10 slots as default for type A - devices. */ - num_slots = 10; - active_slot = device->mtdev->caps.slot.value; - } else { - num_slots = libevdev_get_num_slots(device->evdev); - active_slot = libevdev_get_current_slot(evdev); - } - - slots = zalloc(num_slots * sizeof(struct mt_slot)); - - for (slot = 0; slot < num_slots; ++slot) { - slots[slot].seat_slot = -1; - - if (evdev_need_mtdev(device)) - continue; - - slots[slot].point.x = libevdev_get_slot_value(evdev, - slot, - ABS_MT_POSITION_X); - slots[slot].point.y = libevdev_get_slot_value(evdev, - slot, - ABS_MT_POSITION_Y); - } - dispatch->mt.slots = slots; - dispatch->mt.slots_len = num_slots; - dispatch->mt.slot = active_slot; - - if (device->abs.absinfo_x->fuzz || device->abs.absinfo_y->fuzz) { - dispatch->mt.want_hysteresis = true; - dispatch->mt.hysteresis_margin.x = device->abs.absinfo_x->fuzz/2; - dispatch->mt.hysteresis_margin.y = device->abs.absinfo_y->fuzz/2; - } - - return 0; -} - -static inline void -fallback_dispatch_init_rel(struct fallback_dispatch *dispatch, - struct evdev_device *device) -{ - dispatch->rel.x = 0; - dispatch->rel.y = 0; -} - -static inline void -fallback_dispatch_init_abs(struct fallback_dispatch *dispatch, - struct evdev_device *device) -{ - if (!libevdev_has_event_code(device->evdev, EV_ABS, ABS_X)) - return; - - dispatch->abs.point.x = device->abs.absinfo_x->value; - dispatch->abs.point.y = device->abs.absinfo_y->value; - dispatch->abs.seat_slot = -1; - - evdev_device_init_abs_range_warnings(device); -} - -static inline void -fallback_dispatch_init_switch(struct fallback_dispatch *dispatch, - struct evdev_device *device) -{ - int val; - - if (device->tags & EVDEV_TAG_LID_SWITCH) { - struct paired_keyboard *kbd; - - ARRAY_FOR_EACH(dispatch->lid.paired_keyboard, kbd) - libinput_device_init_event_listener(&kbd->listener); - - dispatch->lid.reliability = evdev_read_switch_reliability_prop(device); - dispatch->lid.is_closed = false; - } - - if (device->tags & EVDEV_TAG_TABLET_MODE_SWITCH) { - val = libevdev_get_event_value(device->evdev, - EV_SW, - SW_TABLET_MODE); - dispatch->tablet_mode.sw.state = val; - } - - libinput_device_init_event_listener(&dispatch->tablet_mode.other.listener); -} - -struct evdev_dispatch * -fallback_dispatch_create(struct libinput_device *libinput_device) -{ - struct evdev_device *device = evdev_device(libinput_device); - struct fallback_dispatch *dispatch; - - dispatch = zalloc(sizeof *dispatch); - dispatch->device = evdev_device(libinput_device); - dispatch->base.dispatch_type = DISPATCH_FALLBACK; - dispatch->base.interface = &fallback_interface; - dispatch->pending_event = EVDEV_NONE; - - fallback_dispatch_init_rel(dispatch, device); - fallback_dispatch_init_abs(dispatch, device); - if (fallback_dispatch_init_slots(dispatch, device) == -1) { - free(dispatch); - return NULL; - } - - fallback_dispatch_init_switch(dispatch, device); - - if (device->left_handed.want_enabled) - evdev_init_left_handed(device, - fallback_change_to_left_handed); - - if (device->scroll.want_button) - evdev_init_button_scroll(device, - fallback_change_scroll_method); - - if (device->scroll.natural_scrolling_enabled) - evdev_init_natural_scroll(device); - - evdev_init_calibration(device, &dispatch->calibration); - evdev_init_sendevents(device, &dispatch->base); - fallback_init_rotation(dispatch, device); - - /* BTN_MIDDLE is set on mice even when it's not present. So - * we can only use the absence of BTN_MIDDLE to mean something, i.e. - * we enable it by default on anything that only has L&R. - * If we have L&R and no middle, we don't expose it as config - * option */ - if (libevdev_has_event_code(device->evdev, EV_KEY, BTN_LEFT) && - libevdev_has_event_code(device->evdev, EV_KEY, BTN_RIGHT)) { - bool has_middle = libevdev_has_event_code(device->evdev, - EV_KEY, - BTN_MIDDLE); - bool want_config = has_middle; - bool enable_by_default = !has_middle; - - evdev_init_middlebutton(device, - enable_by_default, - want_config); - } - - fallback_init_debounce(dispatch); - - return &dispatch->base; -} diff -Nru libinput-1.10.3/src/evdev-fallback.h libinput-0.21.0/src/evdev-fallback.h --- libinput-1.10.3/src/evdev-fallback.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-fallback.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,224 +0,0 @@ -/* - * Copyright © 2010 Intel Corporation - * Copyright © 2013 Jonas Ådahl - * Copyright © 2013-2017 Red Hat, Inc. - * Copyright © 2017 James Ye - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#ifndef EVDEV_FALLBACK_H -#define EVDEV_FALLBACK_H - -#include "evdev.h" - -enum debounce_state { - DEBOUNCE_STATE_IS_UP = 100, - DEBOUNCE_STATE_IS_DOWN, - DEBOUNCE_STATE_DOWN_WAITING, - DEBOUNCE_STATE_RELEASE_PENDING, - DEBOUNCE_STATE_RELEASE_DELAYED, - DEBOUNCE_STATE_RELEASE_WAITING, - DEBOUNCE_STATE_MAYBE_SPURIOUS, - DEBOUNCE_STATE_RELEASED, - DEBOUNCE_STATE_PRESS_PENDING, - - DEBOUNCE_STATE_DISABLED = 999, -}; - -struct fallback_dispatch { - struct evdev_dispatch base; - struct evdev_device *device; - - struct libinput_device_config_calibration calibration; - - struct { - bool is_enabled; - int angle; - struct matrix matrix; - struct libinput_device_config_rotation config; - } rotation; - - struct { - struct device_coords point; - int32_t seat_slot; - } abs; - - struct { - int slot; - struct mt_slot *slots; - size_t slots_len; - bool want_hysteresis; - struct device_coords hysteresis_margin; - } mt; - - struct device_coords rel; - struct device_coords wheel; - - struct { - /* The struct for the tablet mode switch device itself */ - struct { - int state; - } sw; - /* The struct for other devices listening to the tablet mode - switch */ - struct { - struct evdev_device *sw_device; - struct libinput_event_listener listener; - } other; - } tablet_mode; - - /* Bitmask of pressed keys used to ignore initial release events from - * the kernel. */ - unsigned long hw_key_mask[NLONGS(KEY_CNT)]; - unsigned long last_hw_key_mask[NLONGS(KEY_CNT)]; - - enum evdev_event_type pending_event; - - /* true if we're reading events (i.e. not suspended) but we're - ignoring them */ - bool ignore_events; - - struct { -#if 0 - enum evdev_debounce_state state; - uint64_t button_up_time; -#endif - unsigned int button_code; - uint64_t button_time; - struct libinput_timer timer; - struct libinput_timer timer_short; - enum debounce_state state; - bool spurious_enabled; - } debounce; - - struct { - enum switch_reliability reliability; - - bool is_closed; - bool is_closed_client_state; - - /* We allow up to 3 paired keyboards for the lid switch - * listener. Only one keyboard should exist, but that can - * have more than one event node. - * - * Note: this is a sparse list, any element may have a - * non-NULL device. - */ - struct paired_keyboard { - struct evdev_device *device; - struct libinput_event_listener listener; - } paired_keyboard[3]; - } lid; -}; - -static inline struct fallback_dispatch* -fallback_dispatch(struct evdev_dispatch *dispatch) -{ - evdev_verify_dispatch_type(dispatch, DISPATCH_FALLBACK); - - return container_of(dispatch, struct fallback_dispatch, base); -} - -enum key_type { - KEY_TYPE_NONE, - KEY_TYPE_KEY, - KEY_TYPE_BUTTON, -}; - -static inline enum key_type -get_key_type(uint16_t code) -{ - switch (code) { - case BTN_TOOL_PEN: - case BTN_TOOL_RUBBER: - case BTN_TOOL_BRUSH: - case BTN_TOOL_PENCIL: - case BTN_TOOL_AIRBRUSH: - case BTN_TOOL_MOUSE: - case BTN_TOOL_LENS: - case BTN_TOOL_QUINTTAP: - case BTN_TOOL_DOUBLETAP: - case BTN_TOOL_TRIPLETAP: - case BTN_TOOL_QUADTAP: - case BTN_TOOL_FINGER: - case BTN_TOUCH: - return KEY_TYPE_NONE; - } - - if (code >= KEY_ESC && code <= KEY_MICMUTE) - return KEY_TYPE_KEY; - if (code >= BTN_MISC && code <= BTN_GEAR_UP) - return KEY_TYPE_BUTTON; - if (code >= KEY_OK && code <= KEY_LIGHTS_TOGGLE) - return KEY_TYPE_KEY; - if (code >= BTN_DPAD_UP && code <= BTN_DPAD_RIGHT) - return KEY_TYPE_BUTTON; - if (code >= KEY_ALS_TOGGLE && code <= KEY_ONSCREEN_KEYBOARD) - return KEY_TYPE_KEY; - if (code >= BTN_TRIGGER_HAPPY && code <= BTN_TRIGGER_HAPPY40) - return KEY_TYPE_BUTTON; - return KEY_TYPE_NONE; -} - -static inline void -hw_set_key_down(struct fallback_dispatch *dispatch, int code, int pressed) -{ - long_set_bit_state(dispatch->hw_key_mask, code, pressed); -} - -static inline bool -hw_key_has_changed(struct fallback_dispatch *dispatch, int code) -{ - return long_bit_is_set(dispatch->hw_key_mask, code) != - long_bit_is_set(dispatch->last_hw_key_mask, code); -} - -static inline void -hw_key_update_last_state(struct fallback_dispatch *dispatch) -{ - static_assert(sizeof(dispatch->hw_key_mask) == - sizeof(dispatch->last_hw_key_mask), - "Mismatching key mask size"); - - memcpy(dispatch->last_hw_key_mask, - dispatch->hw_key_mask, - sizeof(dispatch->hw_key_mask)); -} - -static inline bool -hw_is_key_down(struct fallback_dispatch *dispatch, int code) -{ - return long_bit_is_set(dispatch->hw_key_mask, code); -} - -static inline int -get_key_down_count(struct evdev_device *device, int code) -{ - return device->key_count[code]; -} - -void fallback_init_debounce(struct fallback_dispatch *dispatch); -void fallback_debounce_handle_state(struct fallback_dispatch *dispatch, - uint64_t time); - -#endif diff -Nru libinput-1.10.3/src/evdev.h libinput-0.21.0/src/evdev.h --- libinput-1.10.3/src/evdev.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev.h 2015-08-03 04:55:20.000000000 +0000 @@ -29,7 +29,6 @@ #include "config.h" #include -#include #include "linux/input.h" #include @@ -37,41 +36,38 @@ #include "timer.h" #include "filter.h" +/* + * The constant (linear) acceleration factor we use to normalize trackpoint + * deltas before calculating pointer acceleration. + */ +#define DEFAULT_TRACKPOINT_ACCEL 1.0 + /* The fake resolution value for abs devices without resolution */ #define EVDEV_FAKE_RESOLUTION 1 enum evdev_event_type { EVDEV_NONE, - EVDEV_ABSOLUTE_TOUCH_DOWN = (1 << 0), - EVDEV_ABSOLUTE_MOTION = (1 << 1), - EVDEV_ABSOLUTE_TOUCH_UP = (1 << 2), - EVDEV_ABSOLUTE_MT= (1 << 3), - EVDEV_WHEEL = (1 << 4), - EVDEV_KEY = (1 << 5), - EVDEV_RELATIVE_MOTION = (1 << 6), - EVDEV_BUTTON = (1 << 7), + EVDEV_ABSOLUTE_TOUCH_DOWN, + EVDEV_ABSOLUTE_MOTION, + EVDEV_ABSOLUTE_TOUCH_UP, + EVDEV_ABSOLUTE_MT_DOWN, + EVDEV_ABSOLUTE_MT_MOTION, + EVDEV_ABSOLUTE_MT_UP, + EVDEV_RELATIVE_MOTION, }; enum evdev_device_seat_capability { EVDEV_DEVICE_POINTER = (1 << 0), EVDEV_DEVICE_KEYBOARD = (1 << 1), EVDEV_DEVICE_TOUCH = (1 << 2), - EVDEV_DEVICE_TABLET = (1 << 3), - EVDEV_DEVICE_TABLET_PAD = (1 << 4), EVDEV_DEVICE_GESTURE = (1 << 5), - EVDEV_DEVICE_SWITCH = (1 << 6), }; enum evdev_device_tags { EVDEV_TAG_EXTERNAL_MOUSE = (1 << 0), EVDEV_TAG_INTERNAL_TOUCHPAD = (1 << 1), - EVDEV_TAG_EXTERNAL_TOUCHPAD = (1 << 2), - EVDEV_TAG_TRACKPOINT = (1 << 3), - EVDEV_TAG_KEYBOARD = (1 << 4), - EVDEV_TAG_LID_SWITCH = (1 << 5), - EVDEV_TAG_INTERNAL_KEYBOARD = (1 << 6), - EVDEV_TAG_EXTERNAL_KEYBOARD = (1 << 7), - EVDEV_TAG_TABLET_MODE_SWITCH = (1 << 8), + EVDEV_TAG_TRACKPOINT = (1 << 2), + EVDEV_TAG_KEYBOARD = (1 << 3), }; enum evdev_middlebutton_state { @@ -110,62 +106,12 @@ EVDEV_MODEL_ALPS_TOUCHPAD = (1 << 8), EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD = (1 << 9), EVDEV_MODEL_JUMPING_SEMI_MT = (1 << 10), - EVDEV_MODEL_LENOVO_X220_TOUCHPAD_FW81 = (1 << 12), - EVDEV_MODEL_CYBORG_RAT = (1 << 14), - EVDEV_MODEL_HP_STREAM11_TOUCHPAD = (1 << 16), - EVDEV_MODEL_LENOVO_T450_TOUCHPAD= (1 << 17), - EVDEV_MODEL_TOUCHPAD_VISIBLE_MARKER = (1 << 18), - EVDEV_MODEL_TRACKBALL = (1 << 19), - EVDEV_MODEL_APPLE_MAGICMOUSE = (1 << 20), - EVDEV_MODEL_HP8510_TOUCHPAD = (1 << 21), - EVDEV_MODEL_HP6910_TOUCHPAD = (1 << 22), - EVDEV_MODEL_HP_ZBOOK_STUDIO_G3 = (1 << 23), - EVDEV_MODEL_HP_PAVILION_DM4_TOUCHPAD = (1 << 24), - EVDEV_MODEL_APPLE_TOUCHPAD_ONEBUTTON = (1 << 25), - EVDEV_MODEL_LOGITECH_MARBLE_MOUSE = (1 << 26), - EVDEV_MODEL_TABLET_NO_PROXIMITY_OUT = (1 << 27), - EVDEV_MODEL_MS_NANO_TRANSCEIVER = (1 << 28), -}; - -enum evdev_button_scroll_state { - BUTTONSCROLL_IDLE, - BUTTONSCROLL_BUTTON_DOWN, /* button is down */ - BUTTONSCROLL_READY, /* ready for scroll events */ - BUTTONSCROLL_SCROLLING, /* have sent scroll events */ -}; - -enum evdev_debounce_state { - /** - * Initial state, no debounce but monitoring events - */ - DEBOUNCE_INIT, - /** - * Bounce detected, future events need debouncing - */ - DEBOUNCE_NEEDED, - /** - * Debounce is enabled, but no event is currently being filtered - */ - DEBOUNCE_ON, - /** - * Debounce is enabled and we are currently filtering an event - */ - DEBOUNCE_ACTIVE, -}; - -enum mt_slot_state { - SLOT_STATE_NONE, - SLOT_STATE_BEGIN, - SLOT_STATE_UPDATE, - SLOT_STATE_END, + EVDEV_MODEL_ELANTECH_TOUCHPAD = (1 << 11), }; struct mt_slot { - bool dirty; - enum mt_slot_state state; int32_t seat_slot; struct device_coords point; - struct device_coords hysteresis_center; }; struct evdev_device { @@ -180,20 +126,12 @@ const char *devname; bool was_removed; int fd; - enum evdev_device_seat_capability seat_caps; - enum evdev_device_tags tags; - bool is_mt; - bool is_suspended; - int dpi; /* HW resolution */ - int trackpoint_range; /* trackpoint max delta */ - struct ratelimit syn_drop_limit; /* ratelimit for SYN_DROPPED logging */ - struct ratelimit nonpointer_rel_limit; /* ratelimit for REL_* events from non-pointer devices */ - uint32_t model_flags; - struct mtdev *mtdev; - struct { const struct input_absinfo *absinfo_x, *absinfo_y; - bool is_fake_resolution; + int fake_resolution; + + struct device_coords point; + int32_t seat_slot; int apply_calibration; struct matrix calibration; @@ -201,14 +139,18 @@ struct matrix usermatrix; /* as supplied by the caller */ struct device_coords dimensions; - - struct { - struct device_coords min, max; - struct ratelimit range_warn_limit; - } warning_range; } abs; struct { + int slot; + struct mt_slot *slots; + size_t slots_len; + } mt; + struct mtdev *mtdev; + + struct device_coords rel; + + struct { struct libinput_timer timer; struct libinput_device_config_scroll_method config; /* Currently enabled method, button */ @@ -222,9 +164,8 @@ uint32_t want_button; /* Checks if buttons are down and commits the setting */ void (*change_scroll_method)(struct evdev_device *device); - enum evdev_button_scroll_state button_scroll_state; + bool button_scroll_active; double threshold; - double direction_lock_threshold; uint32_t direction; struct normalized_coords buildup; @@ -234,16 +175,24 @@ bool natural_scrolling_enabled; /* angle per REL_WHEEL click in degrees */ - struct wheel_angle wheel_click_angle; - - struct wheel_tilt_flags is_tilt; + int wheel_click_angle; } scroll; + enum evdev_event_type pending_event; + enum evdev_device_seat_capability seat_caps; + enum evdev_device_tags tags; + + int is_mt; + int suspended; + struct { struct libinput_device_config_accel config; struct motion_filter *filter; } pointer; + /* Bitmask of pressed keys used to ignore initial release events from + * the kernel. */ + unsigned long hw_key_mask[NLONGS(KEY_CNT)]; /* Key counter used for multiplexing button events internally in * libinput. */ uint8_t key_count[KEY_CNT]; @@ -270,13 +219,12 @@ uint32_t button_mask; uint64_t first_event_time; } middlebutton; -}; -static inline struct evdev_device * -evdev_device(struct libinput_device *device) -{ - return container_of(device, struct evdev_device, base); -} + int dpi; /* HW resolution */ + struct ratelimit syn_drop_limit; /* ratelimit for SYN_DROPPED logging */ + + uint32_t model_flags; +}; #define EVDEV_UNHANDLED_DEVICE ((struct evdev_device *) 1) @@ -314,34 +262,11 @@ /* A device was resumed */ void (*device_resumed)(struct evdev_device *device, struct evdev_device *resumed_device); - - /* Called immediately after the LIBINPUT_EVENT_DEVICE_ADDED event - * was sent */ - void (*post_added)(struct evdev_device *device, - struct evdev_dispatch *dispatch); - - /* For touch arbitration, called on the device that should - * enable/disable touch capabilities */ - void (*toggle_touch)(struct evdev_dispatch *dispatch, - struct evdev_device *device, - bool enable); - - /* Return the state of the given switch */ - enum libinput_switch_state - (*get_switch_state)(struct evdev_dispatch *dispatch, - enum libinput_switch which); -}; - -enum evdev_dispatch_type { - DISPATCH_FALLBACK, - DISPATCH_TOUCHPAD, - DISPATCH_TABLET, - DISPATCH_TABLET_PAD, }; struct evdev_dispatch { - enum evdev_dispatch_type dispatch_type; struct evdev_dispatch_interface *interface; + struct libinput_device_config_calibration calibration; struct { struct libinput_device_config_send_events config; @@ -349,43 +274,13 @@ } sendevents; }; -static inline void -evdev_verify_dispatch_type(struct evdev_dispatch *dispatch, - enum evdev_dispatch_type type) -{ - if (dispatch->dispatch_type != type) - abort(); -} - struct evdev_device * evdev_device_create(struct libinput_seat *seat, struct udev_device *device); -void -evdev_transform_absolute(struct evdev_device *device, - struct device_coords *point); - -void -evdev_transform_relative(struct evdev_device *device, - struct device_coords *point); - -void -evdev_init_calibration(struct evdev_device *device, - struct libinput_device_config_calibration *calibration); - -void -evdev_read_calibration_prop(struct evdev_device *device); - -enum switch_reliability -evdev_read_switch_reliability_prop(struct evdev_device *device); - -void -evdev_init_sendevents(struct evdev_device *device, - struct evdev_dispatch *dispatch); - -void +int evdev_device_init_pointer_acceleration(struct evdev_device *device, - struct motion_filter *filter); + accel_profile_func_t profile); struct evdev_dispatch * evdev_touchpad_create(struct evdev_device *device); @@ -393,23 +288,9 @@ struct evdev_dispatch * evdev_mt_touchpad_create(struct evdev_device *device); -struct evdev_dispatch * -evdev_tablet_create(struct evdev_device *device); - -struct evdev_dispatch * -evdev_tablet_pad_create(struct evdev_device *device); - -struct evdev_dispatch * -evdev_lid_switch_dispatch_create(struct evdev_device *device); - -struct evdev_dispatch * -fallback_dispatch_create(struct libinput_device *libinput_device); - -bool -evdev_is_fake_mt_device(struct evdev_device *device); - -int -evdev_need_mtdev(struct evdev_device *device); +void +evdev_tag_touchpad(struct evdev_device *device, + struct udev_device *udev_device); void evdev_device_led_update(struct evdev_device *device, enum libinput_led leds); @@ -442,12 +323,12 @@ evdev_device_calibrate(struct evdev_device *device, const float calibration[6]); -bool +int evdev_device_has_capability(struct evdev_device *device, enum libinput_device_capability capability); int -evdev_device_get_size(const struct evdev_device *device, +evdev_device_get_size(struct evdev_device *device, double *w, double *h); @@ -457,30 +338,6 @@ int evdev_device_has_key(struct evdev_device *device, uint32_t code); -int -evdev_device_has_switch(struct evdev_device *device, - enum libinput_switch sw); - -int -evdev_device_tablet_pad_get_num_buttons(struct evdev_device *device); - -int -evdev_device_tablet_pad_get_num_rings(struct evdev_device *device); - -int -evdev_device_tablet_pad_get_num_strips(struct evdev_device *device); - -int -evdev_device_tablet_pad_get_num_mode_groups(struct evdev_device *device); - -struct libinput_tablet_pad_mode_group * -evdev_device_tablet_pad_get_mode_group(struct evdev_device *device, - unsigned int index); - -enum libinput_switch_state -evdev_device_switch_get_state(struct evdev_device *device, - enum libinput_switch sw); - double evdev_device_transform_x(struct evdev_device *device, double x, @@ -490,7 +347,7 @@ evdev_device_transform_y(struct evdev_device *device, double y, uint32_t height); -void +int evdev_device_suspend(struct evdev_device *device); int @@ -503,9 +360,15 @@ evdev_notify_resumed_device(struct evdev_device *device); void +evdev_keyboard_notify_key(struct evdev_device *device, + uint64_t time, + int key, + enum libinput_key_state state); + +void evdev_pointer_notify_button(struct evdev_device *device, uint64_t time, - unsigned int button, + int button, enum libinput_button_state state); void evdev_pointer_notify_physical_button(struct evdev_device *device, @@ -517,22 +380,6 @@ evdev_init_natural_scroll(struct evdev_device *device); void -evdev_init_button_scroll(struct evdev_device *device, - void (*change_scroll_method)(struct evdev_device *)); - -int -evdev_update_key_down_count(struct evdev_device *device, - int code, - int pressed); - -void -evdev_notify_axis(struct evdev_device *device, - uint64_t time, - uint32_t axes, - enum libinput_pointer_axis_source source, - const struct normalized_coords *delta_in, - const struct discrete_coords *discrete_in); -void evdev_post_scroll(struct evdev_device *device, uint64_t time, enum libinput_pointer_axis_source source, @@ -560,15 +407,6 @@ bool enabled, bool want_config); -enum libinput_config_middle_emulation_state -evdev_middlebutton_get(struct libinput_device *device); - -int -evdev_middlebutton_is_available(struct libinput_device *device); - -enum libinput_config_middle_emulation_state -evdev_middlebutton_get_default(struct libinput_device *device); - static inline double evdev_convert_to_mm(const struct input_absinfo *absinfo, double v) { @@ -576,13 +414,10 @@ return value/absinfo->resolution; } -void +int evdev_init_left_handed(struct evdev_device *device, void (*change_to_left_handed)(struct evdev_device *)); -bool -evdev_tablet_has_left_handed(struct evdev_device *device); - static inline uint32_t evdev_to_left_handed(struct evdev_device *device, uint32_t button) @@ -596,318 +431,4 @@ return button; } -/** - * Apply a hysteresis filtering to the coordinate in, based on the current - * hysteresis center and the margin. If 'in' is within 'margin' of center, - * return the center (and thus filter the motion). If 'in' is outside, - * return a point on the edge of the new margin (which is an ellipse, usually - * a circle). So for a point x in the space outside c + margin we return r: - * ,---. ,---. - * | c | x → | r x - * `---' `---' - * - * The effect of this is that initial small motions are filtered. Once we - * move into one direction we lag the real coordinates by 'margin' but any - * movement that continues into that direction will always be just outside - * margin - we get responsive movement. Once we move back into the other - * direction, the first movements are filtered again. - * - * Returning the edge rather than the point avoids cursor jumps, as the - * first reachable coordinate is the point next to the center (center + 1). - * Otherwise, the center has a dead zone of size margin around it and the - * first reachable point is the margin edge. - * - * @param in The input coordinate - * @param center Current center of the hysteresis - * @param margin Hysteresis width (on each side) - * - * @return The new center of the hysteresis - */ -static inline struct device_coords -evdev_hysteresis(const struct device_coords *in, - const struct device_coords *center, - const struct device_coords *margin) -{ - int dx = in->x - center->x; - int dy = in->y - center->y; - int dx2 = dx * dx; - int dy2 = dy * dy; - int a = margin->x; - int b = margin->y; - double normalized_finger_distance, finger_distance, margin_distance; - double lag_x, lag_y; - struct device_coords result; - - if (!a || !b) - return *in; - - /* - * Basic equation for an ellipse of radii a,b: - * x²/a² + y²/b² = 1 - * But we start by making a scaled ellipse passing through the - * relative finger location (dx,dy). So the scale of this ellipse is - * the ratio of finger_distance to margin_distance: - * dx²/a² + dy²/b² = normalized_finger_distance² - */ - normalized_finger_distance = sqrt((double)dx2 / (a * a) + - (double)dy2 / (b * b)); - - /* Which means anything less than 1 is within the elliptical margin */ - if (normalized_finger_distance < 1.0) - return *center; - - finger_distance = sqrt(dx2 + dy2); - margin_distance = finger_distance / normalized_finger_distance; - - /* - * Now calculate the x,y coordinates on the edge of the margin ellipse - * where it intersects the finger vector. Shortcut: We achieve this by - * finding the point with the same gradient as dy/dx. - */ - if (dx) { - double gradient = (double)dy / dx; - lag_x = margin_distance / sqrt(gradient * gradient + 1); - lag_y = sqrt((margin_distance + lag_x) * - (margin_distance - lag_x)); - } else { /* Infinite gradient */ - lag_x = 0.0; - lag_y = margin_distance; - } - - /* - * 'result' is the centre of an ellipse (radii a,b) which has been - * dragged by the finger moving inside it to 'in'. The finger is now - * touching the margin ellipse at some point: (±lag_x,±lag_y) - */ - result.x = (dx >= 0) ? in->x - lag_x : in->x + lag_x; - result.y = (dy >= 0) ? in->y - lag_y : in->y + lag_y; - return result; -} - -static inline struct libinput * -evdev_libinput_context(const struct evdev_device *device) -{ - return device->base.seat->libinput; -} - -LIBINPUT_ATTRIBUTE_PRINTF(3, 0) -static inline void -evdev_log_msg_va(struct evdev_device *device, - enum libinput_log_priority priority, - const char *format, - va_list args) -{ - char buf[1024]; - - /* Anything info and above is user-visible, use the device name */ - snprintf(buf, - sizeof(buf), - "%-7s - %s%s%s", - evdev_device_get_sysname(device), - (priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? device->devname : "", - (priority > LIBINPUT_LOG_PRIORITY_DEBUG) ? ": " : "", - format); - - log_msg_va(evdev_libinput_context(device), priority, buf, args); -} - -LIBINPUT_ATTRIBUTE_PRINTF(3, 4) -static inline void -evdev_log_msg(struct evdev_device *device, - enum libinput_log_priority priority, - const char *format, - ...) -{ - va_list args; - - va_start(args, format); - evdev_log_msg_va(device, priority, format, args); - va_end(args); - -} - -LIBINPUT_ATTRIBUTE_PRINTF(4, 5) -static inline void -evdev_log_msg_ratelimit(struct evdev_device *device, - struct ratelimit *ratelimit, - enum libinput_log_priority priority, - const char *format, - ...) -{ - va_list args; - enum ratelimit_state state; - - state = ratelimit_test(ratelimit); - if (state == RATELIMIT_EXCEEDED) - return; - - va_start(args, format); - evdev_log_msg_va(device, priority, format, args); - va_end(args); - - if (state == RATELIMIT_THRESHOLD) - evdev_log_msg(device, - priority, - "WARNING: log rate limit exceeded (%d msgs per %dms). Discarding future messages.\n", - ratelimit->burst, - us2ms(ratelimit->interval)); -} - -#define evdev_log_debug(d_, ...) evdev_log_msg((d_), LIBINPUT_LOG_PRIORITY_DEBUG, __VA_ARGS__) -#define evdev_log_info(d_, ...) evdev_log_msg((d_), LIBINPUT_LOG_PRIORITY_INFO, __VA_ARGS__) -#define evdev_log_error(d_, ...) evdev_log_msg((d_), LIBINPUT_LOG_PRIORITY_ERROR, __VA_ARGS__) -#define evdev_log_bug_kernel(d_, ...) evdev_log_msg((d_), LIBINPUT_LOG_PRIORITY_ERROR, "kernel bug: " __VA_ARGS__) -#define evdev_log_bug_libinput(d_, ...) evdev_log_msg((d_), LIBINPUT_LOG_PRIORITY_ERROR, "libinput bug: " __VA_ARGS__) -#define evdev_log_bug_client(d_, ...) evdev_log_msg((d_), LIBINPUT_LOG_PRIORITY_ERROR, "client bug: " __VA_ARGS__) - -#define evdev_log_debug_ratelimit(d_, r_, ...) \ - evdev_log_msg_ratelimit((d_), (r_), LIBINPUT_LOG_PRIORITY_DEBUG, __VA_ARGS__) -#define evdev_log_info_ratelimit(d_, r_, ...) \ - evdev_log_msg_ratelimit((d_), (r_), LIBINPUT_LOG_PRIORITY_INFO, __VA_ARGS__) -#define evdev_log_error_ratelimit(d_, r_, ...) \ - evdev_log_msg_ratelimit((d_), (r_), LIBINPUT_LOG_PRIORITY_ERROR, __VA_ARGS__) -#define evdev_log_bug_kernel_ratelimit(d_, r_, ...) \ - evdev_log_msg_ratelimit((d_), (r_), LIBINPUT_LOG_PRIORITY_ERROR, "kernel bug: " __VA_ARGS__) -#define evdev_log_bug_libinput_ratelimit(d_, r_, ...) \ - evdev_log_msg_ratelimit((d_), (r_), LIBINPUT_LOG_PRIORITY_ERROR, "libinput bug: " __VA_ARGS__) -#define evdev_log_bug_client_ratelimit(d_, r_, ...) \ - evdev_log_msg_ratelimit((d_), (r_), LIBINPUT_LOG_PRIORITY_ERROR, "client bug: " __VA_ARGS__) - -/** - * Convert the pair of delta coordinates in device space to mm. - */ -static inline struct phys_coords -evdev_device_unit_delta_to_mm(const struct evdev_device* device, - const struct device_coords *units) -{ - struct phys_coords mm = { 0, 0 }; - const struct input_absinfo *absx, *absy; - - if (device->abs.absinfo_x == NULL || - device->abs.absinfo_y == NULL) { - log_bug_libinput(evdev_libinput_context(device), - "%s: is not an abs device\n", - device->devname); - return mm; - } - - absx = device->abs.absinfo_x; - absy = device->abs.absinfo_y; - - mm.x = 1.0 * units->x/absx->resolution; - mm.y = 1.0 * units->y/absy->resolution; - - return mm; -} - -/** - * Convert the pair of coordinates in device space to mm. This takes the - * axis min into account, i.e. a unit of min is equivalent to 0 mm. - */ -static inline struct phys_coords -evdev_device_units_to_mm(const struct evdev_device* device, - const struct device_coords *units) -{ - struct phys_coords mm = { 0, 0 }; - const struct input_absinfo *absx, *absy; - - if (device->abs.absinfo_x == NULL || - device->abs.absinfo_y == NULL) { - log_bug_libinput(evdev_libinput_context(device), - "%s: is not an abs device\n", - device->devname); - return mm; - } - - absx = device->abs.absinfo_x; - absy = device->abs.absinfo_y; - - mm.x = (units->x - absx->minimum)/absx->resolution; - mm.y = (units->y - absy->minimum)/absy->resolution; - - return mm; -} - -/** - * Convert the pair of coordinates in mm to device units. This takes the - * axis min into account, i.e. 0 mm is equivalent to the min. - */ -static inline struct device_coords -evdev_device_mm_to_units(const struct evdev_device *device, - const struct phys_coords *mm) -{ - struct device_coords units = { 0, 0 }; - const struct input_absinfo *absx, *absy; - - if (device->abs.absinfo_x == NULL || - device->abs.absinfo_y == NULL) { - log_bug_libinput(evdev_libinput_context(device), - "%s: is not an abs device\n", - device->devname); - return units; - } - - absx = device->abs.absinfo_x; - absy = device->abs.absinfo_y; - - units.x = mm->x * absx->resolution + absx->minimum; - units.y = mm->y * absy->resolution + absy->minimum; - - return units; -} - -static inline void -evdev_device_init_abs_range_warnings(struct evdev_device *device) -{ - const struct input_absinfo *x, *y; - int width, height; - - x = device->abs.absinfo_x; - y = device->abs.absinfo_y; - width = device->abs.dimensions.x; - height = device->abs.dimensions.y; - - device->abs.warning_range.min.x = x->minimum - 0.05 * width; - device->abs.warning_range.min.y = y->minimum - 0.05 * height; - device->abs.warning_range.max.x = x->maximum + 0.05 * width; - device->abs.warning_range.max.y = y->maximum + 0.05 * height; - - /* One warning every 5 min is enough */ - ratelimit_init(&device->abs.warning_range.range_warn_limit, - s2us(3000), - 1); -} - -static inline void -evdev_device_check_abs_axis_range(struct evdev_device *device, - unsigned int code, - int value) -{ - int min, max; - - switch(code) { - case ABS_X: - case ABS_MT_POSITION_X: - min = device->abs.warning_range.min.x; - max = device->abs.warning_range.max.x; - break; - case ABS_Y: - case ABS_MT_POSITION_Y: - min = device->abs.warning_range.min.y; - max = device->abs.warning_range.max.y; - break; - default: - return; - } - - if (value < min || value > max) { - log_info_ratelimit(evdev_libinput_context(device), - &device->abs.warning_range.range_warn_limit, - "Axis %#x value %d is outside expected range [%d, %d]\n" - "See %s/absolute_coordinate_ranges.html for details\n", - code, value, min, max, - HTTP_DOC_LINK); - } -} - #endif /* EVDEV_H */ diff -Nru libinput-1.10.3/src/evdev-middle-button.c libinput-0.21.0/src/evdev-middle-button.c --- libinput-1.10.3/src/evdev-middle-button.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-middle-button.c 2015-08-03 05:08:55.000000000 +0000 @@ -82,10 +82,10 @@ middlebutton_state_error(struct evdev_device *device, enum evdev_middlebutton_event event) { - evdev_log_bug_libinput(device, - "Invalid event %s in middle btn state %s\n", - middlebutton_event_to_str(event), - middlebutton_state_to_str(device->middlebutton.state)); + log_bug_libinput(device->base.seat->libinput, + "Invalid event %s in middle btn state %s\n", + middlebutton_event_to_str(event), + middlebutton_state_to_str(device->middlebutton.state)); } static void @@ -497,7 +497,7 @@ uint64_t time, enum evdev_middlebutton_event event) { - int rc = 0; + int rc; enum evdev_middlebutton_state current; current = device->middlebutton.state; @@ -545,19 +545,14 @@ time, event); break; - default: - evdev_log_bug_libinput(device, - "Invalid middle button state %d\n", - current); - break; } - evdev_log_debug(device, - "middlebuttonstate: %s → %s → %s, rc %d\n", - middlebutton_state_to_str(current), - middlebutton_event_to_str(event), - middlebutton_state_to_str(device->middlebutton.state), - rc); + log_debug(device->base.seat->libinput, + "middlebuttonstate: %s → %s → %s, rc %d\n", + middlebutton_state_to_str(current), + middlebutton_event_to_str(event), + middlebutton_state_to_str(device->middlebutton.state), + rc); return rc; } @@ -614,10 +609,10 @@ if (button < BTN_LEFT || bit >= sizeof(device->middlebutton.button_mask) * 8) { - evdev_log_bug_libinput(device, - "Button mask too small for %s\n", - libevdev_event_code_get_name(EV_KEY, - button)); + log_bug_libinput(device->base.seat->libinput, + "Button mask too small for %s\n", + libevdev_event_code_get_name(EV_KEY, + button)); return true; } @@ -643,12 +638,14 @@ static void evdev_middlebutton_handle_timeout(uint64_t now, void *data) { - struct evdev_device *device = evdev_device(data); + struct evdev_device *device = (struct evdev_device*)data; - evdev_middlebutton_handle_event(device, now, MIDDLEBUTTON_EVENT_TIMEOUT); + evdev_middlebutton_handle_event(device, + libinput_now(device->base.seat->libinput), + MIDDLEBUTTON_EVENT_TIMEOUT); } -int +static int evdev_middlebutton_is_available(struct libinput_device *device) { return 1; @@ -658,7 +655,7 @@ evdev_middlebutton_set(struct libinput_device *device, enum libinput_config_middle_emulation_state enable) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; switch (enable) { case LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED: @@ -676,20 +673,20 @@ return LIBINPUT_CONFIG_STATUS_SUCCESS; } -enum libinput_config_middle_emulation_state +static enum libinput_config_middle_emulation_state evdev_middlebutton_get(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; - return evdev->middlebutton.want_enabled ? + return evdev->middlebutton.enabled ? LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED : LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED; } -enum libinput_config_middle_emulation_state +static enum libinput_config_middle_emulation_state evdev_middlebutton_get_default(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; return evdev->middlebutton.enabled_default ? LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED : @@ -701,15 +698,8 @@ bool enable, bool want_config) { - char timer_name[64]; - - snprintf(timer_name, - sizeof(timer_name), - "%s middlebutton", - evdev_device_get_sysname(device)); libinput_timer_init(&device->middlebutton.timer, - evdev_libinput_context(device), - timer_name, + device->base.seat->libinput, evdev_middlebutton_handle_timeout, device); device->middlebutton.enabled_default = enable; diff -Nru libinput-1.10.3/src/evdev-mt-touchpad-buttons.c libinput-0.21.0/src/evdev-mt-touchpad-buttons.c --- libinput-1.10.3/src/evdev-mt-touchpad-buttons.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-mt-touchpad-buttons.c 2015-08-03 04:55:20.000000000 +0000 @@ -64,7 +64,6 @@ button_event_to_str(enum button_event event) { switch(event) { CASE_RETURN_STRING(BUTTON_EVENT_IN_BOTTOM_R); - CASE_RETURN_STRING(BUTTON_EVENT_IN_BOTTOM_M); CASE_RETURN_STRING(BUTTON_EVENT_IN_BOTTOM_L); CASE_RETURN_STRING(BUTTON_EVENT_IN_TOP_R); CASE_RETURN_STRING(BUTTON_EVENT_IN_TOP_M); @@ -79,64 +78,47 @@ } static inline bool -is_inside_bottom_button_area(const struct tp_dispatch *tp, - const struct tp_touch *t) +is_inside_bottom_button_area(struct tp_dispatch *tp, struct tp_touch *t) { return t->point.y >= tp->buttons.bottom_area.top_edge; } static inline bool -is_inside_bottom_right_area(const struct tp_dispatch *tp, - const struct tp_touch *t) +is_inside_bottom_right_area(struct tp_dispatch *tp, struct tp_touch *t) { return is_inside_bottom_button_area(tp, t) && t->point.x > tp->buttons.bottom_area.rightbutton_left_edge; } static inline bool -is_inside_bottom_middle_area(const struct tp_dispatch *tp, - const struct tp_touch *t) +is_inside_bottom_left_area(struct tp_dispatch *tp, struct tp_touch *t) { return is_inside_bottom_button_area(tp, t) && - !is_inside_bottom_right_area(tp, t) && - t->point.x > tp->buttons.bottom_area.middlebutton_left_edge; -} - -static inline bool -is_inside_bottom_left_area(const struct tp_dispatch *tp, - const struct tp_touch *t) -{ - return is_inside_bottom_button_area(tp, t) && - !is_inside_bottom_middle_area(tp, t) && !is_inside_bottom_right_area(tp, t); } static inline bool -is_inside_top_button_area(const struct tp_dispatch *tp, - const struct tp_touch *t) +is_inside_top_button_area(struct tp_dispatch *tp, struct tp_touch *t) { return t->point.y <= tp->buttons.top_area.bottom_edge; } static inline bool -is_inside_top_right_area(const struct tp_dispatch *tp, - const struct tp_touch *t) +is_inside_top_right_area(struct tp_dispatch *tp, struct tp_touch *t) { return is_inside_top_button_area(tp, t) && t->point.x > tp->buttons.top_area.rightbutton_left_edge; } static inline bool -is_inside_top_left_area(const struct tp_dispatch *tp, - const struct tp_touch *t) +is_inside_top_left_area(struct tp_dispatch *tp, struct tp_touch *t) { return is_inside_top_button_area(tp, t) && t->point.x < tp->buttons.top_area.leftbutton_right_edge; } static inline bool -is_inside_top_middle_area(const struct tp_dispatch *tp, - const struct tp_touch *t) +is_inside_top_middle_area(struct tp_dispatch *tp, struct tp_touch *t) { return is_inside_top_button_area(tp, t) && t->point.x >= tp->buttons.top_area.leftbutton_right_edge && @@ -147,14 +129,14 @@ tp_button_set_enter_timer(struct tp_dispatch *tp, struct tp_touch *t) { libinput_timer_set(&t->button.timer, - t->time + DEFAULT_BUTTON_ENTER_TIMEOUT); + t->millis + DEFAULT_BUTTON_ENTER_TIMEOUT); } static void tp_button_set_leave_timer(struct tp_dispatch *tp, struct tp_touch *t) { libinput_timer_set(&t->button.timer, - t->time + DEFAULT_BUTTON_LEAVE_TIMEOUT); + t->millis + DEFAULT_BUTTON_LEAVE_TIMEOUT); } /* @@ -203,7 +185,6 @@ { switch (event) { case BUTTON_EVENT_IN_BOTTOM_R: - case BUTTON_EVENT_IN_BOTTOM_M: case BUTTON_EVENT_IN_BOTTOM_L: tp_button_set_state(tp, t, BUTTON_STATE_BOTTOM, event); break; @@ -232,7 +213,6 @@ { switch (event) { case BUTTON_EVENT_IN_BOTTOM_R: - case BUTTON_EVENT_IN_BOTTOM_M: case BUTTON_EVENT_IN_BOTTOM_L: case BUTTON_EVENT_IN_TOP_R: case BUTTON_EVENT_IN_TOP_M: @@ -256,7 +236,6 @@ { switch (event) { case BUTTON_EVENT_IN_BOTTOM_R: - case BUTTON_EVENT_IN_BOTTOM_M: case BUTTON_EVENT_IN_BOTTOM_L: if (event != t->button.curr) tp_button_set_state(tp, @@ -287,7 +266,6 @@ { switch (event) { case BUTTON_EVENT_IN_BOTTOM_R: - case BUTTON_EVENT_IN_BOTTOM_M: case BUTTON_EVENT_IN_BOTTOM_L: tp_button_set_state(tp, t, BUTTON_STATE_TOP_TO_IGNORE, event); break; @@ -320,7 +298,6 @@ { switch(event) { case BUTTON_EVENT_IN_BOTTOM_R: - case BUTTON_EVENT_IN_BOTTOM_M: case BUTTON_EVENT_IN_BOTTOM_L: tp_button_set_state(tp, t, BUTTON_STATE_AREA, event); break; @@ -371,7 +348,6 @@ event); break; case BUTTON_EVENT_IN_BOTTOM_R: - case BUTTON_EVENT_IN_BOTTOM_M: case BUTTON_EVENT_IN_BOTTOM_L: case BUTTON_EVENT_IN_AREA: break; @@ -394,7 +370,6 @@ { switch (event) { case BUTTON_EVENT_IN_BOTTOM_R: - case BUTTON_EVENT_IN_BOTTOM_M: case BUTTON_EVENT_IN_BOTTOM_L: case BUTTON_EVENT_IN_TOP_R: case BUTTON_EVENT_IN_TOP_M: @@ -405,10 +380,7 @@ tp_button_set_state(tp, t, BUTTON_STATE_NONE, event); break; case BUTTON_EVENT_PRESS: - t->button.curr = BUTTON_EVENT_IN_AREA; - break; case BUTTON_EVENT_RELEASE: - break; case BUTTON_EVENT_TIMEOUT: break; } @@ -420,6 +392,7 @@ enum button_event event, uint64_t time) { + struct libinput *libinput = tp_libinput_context(tp); enum button_state current = t->button.state; switch(t->button.state) { @@ -447,20 +420,20 @@ } if (current != t->button.state) - evdev_log_debug(tp->device, - "button state: from %s, event %s to %s\n", - button_state_to_str(current), - button_event_to_str(event), - button_state_to_str(t->button.state)); + log_debug(libinput, + "button state: from %s, event %s to %s\n", + button_state_to_str(current), + button_event_to_str(event), + button_state_to_str(t->button.state)); } -void +int tp_button_handle_state(struct tp_dispatch *tp, uint64_t time) { struct tp_touch *t; tp_for_each_touch(tp, t) { - if (t->state == TOUCH_NONE || t->state == TOUCH_HOVERING) + if (t->state == TOUCH_NONE) continue; if (t->state == TOUCH_END) { @@ -470,8 +443,6 @@ if (is_inside_bottom_right_area(tp, t)) event = BUTTON_EVENT_IN_BOTTOM_R; - else if (is_inside_bottom_middle_area(tp, t)) - event = BUTTON_EVENT_IN_BOTTOM_M; else if (is_inside_bottom_left_area(tp, t)) event = BUTTON_EVENT_IN_BOTTOM_L; else if (is_inside_top_right_area(tp, t)) @@ -490,6 +461,8 @@ if (tp->queued & TOUCHPAD_EVENT_BUTTON_PRESS) tp_button_handle_event(tp, t, BUTTON_EVENT_PRESS, time); } + + return 0; } static void @@ -500,19 +473,20 @@ tp_button_handle_event(t->tp, t, BUTTON_EVENT_TIMEOUT, now); } -void +int tp_process_button(struct tp_dispatch *tp, const struct input_event *e, uint64_t time) { + struct libinput *libinput = tp_libinput_context(tp); uint32_t mask = 1 << (e->code - BTN_LEFT); /* Ignore other buttons on clickpads */ if (tp->buttons.is_clickpad && e->code != BTN_LEFT) { - evdev_log_bug_kernel(tp->device, - "received %s button event on a clickpad\n", - libevdev_event_code_get_name(EV_KEY, e->code)); - return; + log_bug_kernel(libinput, + "received %s button event on a clickpad\n", + libevdev_event_code_get_name(EV_KEY, e->code)); + return 0; } if (e->value) { @@ -522,6 +496,8 @@ tp->buttons.state &= ~mask; tp->queued |= TOUCHPAD_EVENT_BUTTON_RELEASE; } + + return 0; } void @@ -538,59 +514,29 @@ tp_init_softbuttons(struct tp_dispatch *tp, struct evdev_device *device) { - double width, height; - struct device_coords edges; - int mb_le, mb_re; /* middle button left/right edge */ - struct phys_coords mm = { 0.0, 0.0 }; + int width, height; + const struct input_absinfo *absinfo_x, *absinfo_y; + int xoffset, yoffset; + int yres; - evdev_device_get_size(device, &width, &height); + absinfo_x = device->abs.absinfo_x; + absinfo_y = device->abs.absinfo_y; + + xoffset = absinfo_x->minimum, + yoffset = absinfo_y->minimum, + yres = absinfo_y->resolution; + width = device->abs.dimensions.x; + height = device->abs.dimensions.y; /* button height: 10mm or 15% or the touchpad height, whichever is smaller */ - if (height * 0.15 > 10) - mm.y = height - 10; - else - mm.y = height * 0.85; - - mm.x = width * 0.5; - edges = evdev_device_mm_to_units(device, &mm); - tp->buttons.bottom_area.top_edge = edges.y; - tp->buttons.bottom_area.rightbutton_left_edge = edges.x; - - tp->buttons.bottom_area.middlebutton_left_edge = INT_MAX; - - /* if middlebutton emulation is enabled, don't init a software area */ - if (device->middlebutton.want_enabled) - return; - - /* The middle button is 25% of the touchpad and centered. Many - * touchpads don't have markings for the middle button at all so we - * need to make it big enough to reliably hit it but not too big so - * it takes away all the space. - * - * On touchpads with visible markings we reduce the size of the - * middle button since users have a visual guide. - */ - if (tp->device->model_flags & EVDEV_MODEL_TOUCHPAD_VISIBLE_MARKER) { - mm.x = width/2 - 5; /* 10mm wide */ - edges = evdev_device_mm_to_units(device, &mm); - mb_le = edges.x; - - mm.x = width/2 + 5; /* 10mm wide */ - edges = evdev_device_mm_to_units(device, &mm); - mb_re = edges.x; + if ((height * 0.15)/yres > 10) { + tp->buttons.bottom_area.top_edge = + absinfo_y->maximum - 10 * yres; } else { - mm.x = width * 0.375; - edges = evdev_device_mm_to_units(device, &mm); - mb_le = edges.x; - - mm.x = width * 0.625; - edges = evdev_device_mm_to_units(device, &mm); - mb_re = edges.x; + tp->buttons.bottom_area.top_edge = height * .85 + yoffset; } - - tp->buttons.bottom_area.middlebutton_left_edge = mb_le; - tp->buttons.bottom_area.rightbutton_left_edge = mb_re; + tp->buttons.bottom_area.rightbutton_left_edge = width/2 + xoffset; } void @@ -598,7 +544,18 @@ struct evdev_device *device, double topbutton_size_mult) { - struct device_coords edges; + int width; + const struct input_absinfo *absinfo_x, *absinfo_y; + int xoffset, yoffset; + int yres; + + absinfo_x = device->abs.absinfo_x; + absinfo_y = device->abs.absinfo_y; + + xoffset = absinfo_x->minimum, + yoffset = absinfo_y->minimum; + yres = absinfo_y->resolution; + width = device->abs.dimensions.x; if (tp->buttons.has_topbuttons) { /* T440s has the top button line 5mm from the top, event @@ -606,20 +563,10 @@ top - which maps to 15%. We allow the caller to enlarge the area using a multiplier for the touchpad disabled case. */ double topsize_mm = 10 * topbutton_size_mult; - struct phys_coords mm; - double width, height; - - evdev_device_get_size(device, &width, &height); - mm.x = width * 0.60; - mm.y = topsize_mm; - edges = evdev_device_mm_to_units(device, &mm); - tp->buttons.top_area.bottom_edge = edges.y; - tp->buttons.top_area.rightbutton_left_edge = edges.x; - - mm.x = width * 0.40; - edges = evdev_device_mm_to_units(device, &mm); - tp->buttons.top_area.leftbutton_right_edge = edges.x; + tp->buttons.top_area.bottom_edge = yoffset + topsize_mm * yres; + tp->buttons.top_area.rightbutton_left_edge = width * .58 + xoffset; + tp->buttons.top_area.leftbutton_right_edge = width * .42 + xoffset; } else { tp->buttons.top_area.bottom_edge = INT_MIN; } @@ -628,7 +575,7 @@ static inline uint32_t tp_button_config_click_get_methods(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch; uint32_t methods = LIBINPUT_CONFIG_CLICK_METHOD_NONE; @@ -638,9 +585,6 @@ methods |= LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER; } - if (evdev->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD_ONEBUTTON) - methods |= LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER; - return methods; } @@ -673,7 +617,7 @@ tp_button_config_click_set_method(struct libinput_device *device, enum libinput_config_click_method method) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch; tp->buttons.click_method = method; @@ -685,7 +629,7 @@ static enum libinput_config_click_method tp_button_config_click_get_method(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch; return tp->buttons.click_method; @@ -699,103 +643,28 @@ EVDEV_MODEL_SYSTEM76_BONOBO | EVDEV_MODEL_SYSTEM76_GALAGO | EVDEV_MODEL_SYSTEM76_KUDU | - EVDEV_MODEL_CLEVO_W740SU | - EVDEV_MODEL_APPLE_TOUCHPAD_ONEBUTTON; - - if (device->model_flags & clickfinger_models) - return LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER; + EVDEV_MODEL_CLEVO_W740SU; if (!tp->buttons.is_clickpad) return LIBINPUT_CONFIG_CLICK_METHOD_NONE; else if (libevdev_get_id_vendor(tp->device->evdev) == VENDOR_ID_APPLE) return LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER; + if (device->model_flags & clickfinger_models) + return LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER; + return LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS; } static enum libinput_config_click_method tp_button_config_click_get_default_method(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch; return tp_click_get_default_method(tp); } -void -tp_clickpad_middlebutton_apply_config(struct evdev_device *device) -{ - struct tp_dispatch *tp = (struct tp_dispatch*)device->dispatch; - - if (!tp->buttons.is_clickpad || - tp->buttons.state != 0) - return; - - if (device->middlebutton.want_enabled == - device->middlebutton.enabled) - return; - - device->middlebutton.enabled = device->middlebutton.want_enabled; - if (tp->buttons.click_method == - LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS) - tp_init_softbuttons(tp, device); -} - -static int -tp_clickpad_middlebutton_is_available(struct libinput_device *device) -{ - return evdev_middlebutton_is_available(device); -} - -static enum libinput_config_status -tp_clickpad_middlebutton_set(struct libinput_device *device, - enum libinput_config_middle_emulation_state enable) -{ - struct evdev_device *evdev = evdev_device(device); - - switch (enable) { - case LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED: - evdev->middlebutton.want_enabled = true; - break; - case LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED: - evdev->middlebutton.want_enabled = false; - break; - default: - return LIBINPUT_CONFIG_STATUS_INVALID; - } - - tp_clickpad_middlebutton_apply_config(evdev); - - return LIBINPUT_CONFIG_STATUS_SUCCESS; -} - -static enum libinput_config_middle_emulation_state -tp_clickpad_middlebutton_get(struct libinput_device *device) -{ - return evdev_middlebutton_get(device); -} - -static enum libinput_config_middle_emulation_state -tp_clickpad_middlebutton_get_default(struct libinput_device *device) -{ - return evdev_middlebutton_get_default(device); -} - -static inline void -tp_init_clickpad_middlebutton_emulation(struct tp_dispatch *tp, - struct evdev_device *device) -{ - device->middlebutton.enabled_default = false; - device->middlebutton.want_enabled = false; - device->middlebutton.enabled = false; - - device->middlebutton.config.available = tp_clickpad_middlebutton_is_available; - device->middlebutton.config.set = tp_clickpad_middlebutton_set; - device->middlebutton.config.get = tp_clickpad_middlebutton_get; - device->middlebutton.config.get_default = tp_clickpad_middlebutton_get_default; - device->base.config.middle_emulation = &device->middlebutton.config; -} - static inline void tp_init_middlebutton_emulation(struct tp_dispatch *tp, struct evdev_device *device) @@ -803,12 +672,8 @@ bool enable_by_default, want_config_option; - /* On clickpads we provide the config option but disable by default. - When enabled, the middle software button disappears */ - if (tp->buttons.is_clickpad) { - tp_init_clickpad_middlebutton_emulation(tp, device); + if (tp->buttons.is_clickpad) return; - } /* init middle button emulation on non-clickpads, but only if we * don't have a middle button. Exception: ALPS touchpads don't know @@ -829,13 +694,13 @@ want_config_option); } -void +int tp_init_buttons(struct tp_dispatch *tp, struct evdev_device *device) { + struct libinput *libinput = tp_libinput_context(tp); struct tp_touch *t; const struct input_absinfo *absinfo_x, *absinfo_y; - int i; tp->buttons.is_clickpad = libevdev_has_property(device->evdev, INPUT_PROP_BUTTONPAD); @@ -845,13 +710,15 @@ if (libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE) || libevdev_has_event_code(device->evdev, EV_KEY, BTN_RIGHT)) { if (tp->buttons.is_clickpad) - evdev_log_bug_kernel(device, - "clickpad advertising right button\n"); + log_bug_kernel(libinput, + "%s: clickpad advertising right button\n", + device->devname); } else if (libevdev_has_event_code(device->evdev, EV_KEY, BTN_LEFT) && !tp->buttons.is_clickpad && libevdev_get_id_vendor(device->evdev) != VENDOR_ID_APPLE) { - evdev_log_bug_kernel(device, - "non clickpad without right button?\n"); + log_bug_kernel(libinput, + "%s: non clickpad without right button?\n", + device->devname); } absinfo_x = device->abs.absinfo_x; @@ -874,22 +741,14 @@ tp_init_middlebutton_emulation(tp, device); - i = 0; tp_for_each_touch(tp, t) { - char timer_name[64]; - i++; - - snprintf(timer_name, - sizeof(timer_name), - "%s (%d) button", - evdev_device_get_sysname(device), - i); t->button.state = BUTTON_STATE_NONE; libinput_timer_init(&t->button.timer, tp_libinput_context(tp), - timer_name, tp_button_handle_timeout, t); } + + return 0; } void @@ -897,10 +756,8 @@ { struct tp_touch *t; - tp_for_each_touch(tp, t) { + tp_for_each_touch(tp, t) libinput_timer_cancel(&t->button.timer); - libinput_timer_destroy(&t->button.timer); - } } static int @@ -938,13 +795,13 @@ return 0; } -static inline bool -tp_clickfinger_within_distance(struct tp_dispatch *tp, - struct tp_touch *t1, - struct tp_touch *t2) +static inline int +tp_check_clickfinger_distance(struct tp_dispatch *tp, + struct tp_touch *t1, + struct tp_touch *t2) { double x, y; - bool within_distance = false; + int within_distance = 0; int xres, yres; int bottom_threshold; @@ -968,7 +825,7 @@ if (x > 40 || y > 30) goto out; - within_distance = true; + within_distance = 1; /* if y spread is <= 20mm, they're definitely together. */ if (y <= 20) @@ -1026,7 +883,7 @@ goto out; } - if (tp_clickfinger_within_distance(tp, first, second)) + if (tp_check_clickfinger_distance(tp, first, second)) nfingers = 2; else nfingers = 1; @@ -1055,26 +912,21 @@ if (is_topbutton && tp->buttons.trackpoint) { struct evdev_dispatch *dispatch = tp->buttons.trackpoint->dispatch; struct input_event event; - struct input_event syn_report = {{ 0, 0 }, EV_SYN, SYN_REPORT, 0 }; - event.time = us2tv(time); + event.time.tv_sec = time / ms2us(1000); + event.time.tv_usec = time % ms2us(1000); event.type = EV_KEY; event.code = button; event.value = (state == LIBINPUT_BUTTON_STATE_PRESSED) ? 1 : 0; - syn_report.time = event.time; dispatch->interface->process(dispatch, tp->buttons.trackpoint, &event, time); - dispatch->interface->process(dispatch, - tp->buttons.trackpoint, - &syn_report, - time); return 1; } /* Ignore button events not for the trackpoint while suspended */ - if (tp->device->is_suspended) + if (tp->device->suspended) return 0; /* A button click always terminates edge scrolling, even if we @@ -1104,7 +956,6 @@ uint32_t current, old, button, is_top; enum libinput_button_state state; enum { AREA = 0x01, LEFT = 0x02, MIDDLE = 0x04, RIGHT = 0x08 }; - bool want_left_handed = true; current = tp->buttons.state; old = tp->buttons.old_state; @@ -1130,8 +981,6 @@ break; case BUTTON_EVENT_IN_TOP_M: is_top = 1; - /* fallthrough */ - case BUTTON_EVENT_IN_BOTTOM_M: area |= MIDDLE; break; case BUTTON_EVENT_IN_TOP_R: @@ -1152,25 +1001,14 @@ return 0; } - if ((tp->device->middlebutton.enabled || is_top) && - (area & LEFT) && (area & RIGHT)) { - button = BTN_MIDDLE; - } else if (area & MIDDLE) { - button = BTN_MIDDLE; - } else if (area & RIGHT) { - button = BTN_RIGHT; - } else if (area & LEFT) { + if ((area & MIDDLE) || ((area & LEFT) && (area & RIGHT))) + button = evdev_to_left_handed(tp->device, BTN_MIDDLE); + else if (area & RIGHT) + button = evdev_to_left_handed(tp->device, BTN_RIGHT); + else if (area & LEFT) + button = evdev_to_left_handed(tp->device, BTN_LEFT); + else /* main or no area (for clickfinger) is always BTN_LEFT */ button = BTN_LEFT; - } else { /* main or no area (for clickfinger) is always BTN_LEFT */ - button = BTN_LEFT; - want_left_handed = false; - } - - if (is_top) - want_left_handed = false; - - if (want_left_handed) - button = evdev_to_left_handed(tp->device, button); tp->buttons.active = button; tp->buttons.active_is_topbutton = is_top; @@ -1197,23 +1035,20 @@ int tp_post_button_events(struct tp_dispatch *tp, uint64_t time) { - if (tp->buttons.is_clickpad || - tp->device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD_ONEBUTTON) + if (tp->buttons.is_clickpad) return tp_post_clickpadbutton_buttons(tp, time); else return tp_post_physical_buttons(tp, time); } -bool -tp_button_touch_active(const struct tp_dispatch *tp, - const struct tp_touch *t) +int +tp_button_touch_active(struct tp_dispatch *tp, struct tp_touch *t) { return t->button.state == BUTTON_STATE_AREA; } bool -tp_button_is_inside_softbutton_area(const struct tp_dispatch *tp, - const struct tp_touch *t) +tp_button_is_inside_softbutton_area(struct tp_dispatch *tp, struct tp_touch *t) { return is_inside_top_button_area(tp, t) || is_inside_bottom_button_area(tp, t); diff -Nru libinput-1.10.3/src/evdev-mt-touchpad.c libinput-0.21.0/src/evdev-mt-touchpad.c --- libinput-1.10.3/src/evdev-mt-touchpad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-mt-touchpad.c 2015-08-04 00:01:51.000000000 +0000 @@ -35,9 +35,21 @@ #define DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2 ms2us(500) #define THUMB_MOVE_TIMEOUT ms2us(300) #define FAKE_FINGER_OVERFLOW (1 << 7) -#define THUMB_IGNORE_SPEED_THRESHOLD 20 /* mm/s */ -static inline struct tp_history_point* +static inline int +tp_hysteresis(int in, int center, int margin) +{ + int diff = in - center; + if (abs(diff) <= margin) + return center; + + if (diff > margin) + return center + diff - margin; + else + return center + diff + margin; +} + +static inline struct device_coords * tp_motion_history_offset(struct tp_touch *t, int offset) { int offset_index = @@ -49,77 +61,14 @@ struct normalized_coords tp_filter_motion(struct tp_dispatch *tp, - const struct device_float_coords *unaccelerated, + const struct normalized_coords *unaccelerated, uint64_t time) { - struct device_float_coords raw; - const struct normalized_coords zero = { 0.0, 0.0 }; - - if (device_float_is_zero(*unaccelerated)) - return zero; - - /* Convert to device units with x/y in the same resolution */ - raw = tp_scale_to_xaxis(tp, *unaccelerated); + if (normalized_is_zero(*unaccelerated)) + return *unaccelerated; return filter_dispatch(tp->device->pointer.filter, - &raw, tp, time); -} - -struct normalized_coords -tp_filter_motion_unaccelerated(struct tp_dispatch *tp, - const struct device_float_coords *unaccelerated, - uint64_t time) -{ - struct device_float_coords raw; - const struct normalized_coords zero = { 0.0, 0.0 }; - - if (device_float_is_zero(*unaccelerated)) - return zero; - - /* Convert to device units with x/y in the same resolution */ - raw = tp_scale_to_xaxis(tp, *unaccelerated); - - return filter_dispatch_constant(tp->device->pointer.filter, - &raw, tp, time); -} - -static inline void -tp_calculate_motion_speed(struct tp_dispatch *tp, struct tp_touch *t) -{ - const struct tp_history_point *last; - struct device_coords delta; - struct phys_coords mm; - double distance; - double speed; - - /* Don't do this on single-touch or semi-mt devices */ - if (!tp->has_mt || tp->semi_mt) - return; - - /* This doesn't kick in until we have at least 4 events in the - * motion history. As a side-effect, this automatically handles the - * 2fg scroll where a finger is down and moving fast before the - * other finger comes down for the scroll. - * - * We do *not* reset the speed to 0 here though. The motion history - * is reset whenever a new finger is down, so we'd be resetting the - * speed and failing. - */ - if (t->history.count < 4) - return; - - /* TODO: we probably need a speed history here so we can average - * across a few events */ - last = tp_motion_history_offset(t, 1); - delta.x = abs(t->point.x - last->point.x); - delta.y = abs(t->point.y - last->point.y); - mm = evdev_device_unit_delta_to_mm(tp->device, &delta); - - distance = length_in_mm(mm); - speed = distance/(t->time - last->time); /* mm/us */ - speed *= 1000000; /* mm/s */ - - t->speed.last_speed = speed; + unaccelerated, tp, time); } static inline void @@ -130,80 +79,31 @@ if (t->history.count < TOUCHPAD_HISTORY_LENGTH) t->history.count++; - t->history.samples[motion_index].point = t->point; - t->history.samples[motion_index].time = t->time; + t->history.samples[motion_index] = t->point; t->history.index = motion_index; } -/* Idea: if we got a tuple of *very* quick moves like {Left, Right, - * Left}, or {Right, Left, Right}, it means touchpad jitters since no - * human can move like that within thresholds. - * - * We encode left moves as zeroes, and right as ones. We also drop - * the array to all zeroes when contraints are not satisfied. Then we - * search for the pattern {1,0,1}. It can't match {Left, Right, Left}, - * but it does match {Left, Right, Left, Right}, so it's okay. - * - * This only looks at x changes, y changes are ignored. - */ -static inline void -tp_detect_wobbling(struct tp_dispatch *tp, - struct tp_touch *t, - uint64_t time) -{ - int dx, dy; - uint64_t dtime; - - if (!(tp->queued & TOUCHPAD_EVENT_MOTION) || tp->hysteresis.enabled) - return; - - if (t->last_point.x == 0) { /* first invocation */ - dx = 0; - dy = 0; - } else { - dx = t->last_point.x - t->point.x; - dy = t->last_point.y - t->point.y; - } - - dtime = time - tp->hysteresis.last_motion_time; - - tp->hysteresis.last_motion_time = time; - t->last_point = t->point; - - if (dx == 0 && dy != 0) /* ignore y-only changes */ - return; - - if (dtime > ms2us(40)) { - t->hysteresis.x_motion_history = 0; - return; - } - - t->hysteresis.x_motion_history >>= 1; - if (dx > 0) { /* right move */ - static const char r_l_r = 0x5; /* {Right, Left, Right} */ - - - t->hysteresis.x_motion_history |= (1 << 2); - if (t->hysteresis.x_motion_history == r_l_r) { - tp->hysteresis.enabled = true; - evdev_log_debug(tp->device, "hysteresis enabled\n"); - } - } -} - static inline void tp_motion_hysteresis(struct tp_dispatch *tp, struct tp_touch *t) { - if (!tp->hysteresis.enabled) - return; - - if (t->history.count > 0) - t->point = evdev_hysteresis(&t->point, - &t->hysteresis.center, - &tp->hysteresis.margin); + int x = t->point.x, + y = t->point.y; - t->hysteresis.center = t->point; + if (t->history.count == 0) { + t->hysteresis_center = t->point; + } else { + x = tp_hysteresis(x, + t->hysteresis_center.x, + tp->hysteresis_margin.x); + y = tp_hysteresis(y, + t->hysteresis_center.y, + tp->hysteresis_margin.y); + t->hysteresis_center.x = x; + t->hysteresis_center.y = y; + t->point.x = x; + t->point.y = y; + } } static inline void @@ -228,14 +128,6 @@ static inline unsigned int tp_fake_finger_count(struct tp_dispatch *tp) { - /* Only one of BTN_TOOL_DOUBLETAP/TRIPLETAP/... may be set at any - * time */ - if (__builtin_popcount( - tp->fake_touches & ~(FAKE_FINGER_OVERFLOW|0x1)) > 1) - evdev_log_bug_kernel(tp->device, - "Invalid fake finger state %#x\n", - tp->fake_touches); - if (tp->fake_touches & FAKE_FINGER_OVERFLOW) return FAKE_FINGER_OVERFLOW; else /* don't count BTN_TOUCH */ @@ -303,13 +195,9 @@ tp_motion_history_reset(t); t->dirty = true; t->has_ended = false; - t->was_down = false; t->state = TOUCH_HOVERING; t->pinned.is_pinned = false; - t->time = time; - t->speed.last_speed = 0; - t->speed.exceeded_count = 0; - t->hysteresis.x_motion_history = 0; + t->millis = time; tp->queued |= TOUCHPAD_EVENT_MOTION; } @@ -318,89 +206,42 @@ { t->dirty = true; t->state = TOUCH_BEGIN; - t->time = time; - t->was_down = true; + t->millis = time; tp->nfingers_down++; t->palm.time = time; t->thumb.state = THUMB_STATE_MAYBE; t->thumb.first_touch_time = time; t->tap.is_thumb = false; - t->tap.is_palm = false; assert(tp->nfingers_down >= 1); - tp->hysteresis.last_motion_time = time; } /** - * Schedule a touch to be ended, based on either the events or some - * attributes of the touch (size, pressure). In some cases we need to - * resurrect a touch that has ended, so this doesn't actually end the touch - * yet. All the TOUCH_MAYBE_END touches get properly ended once the device - * state has been processed once and we know how many zombie touches we - * need. + * End a touch, even if the touch sequence is still active. */ static inline void -tp_maybe_end_touch(struct tp_dispatch *tp, - struct tp_touch *t, - uint64_t time) +tp_end_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) { switch (t->state) { + case TOUCH_HOVERING: + t->state = TOUCH_NONE; + /* fallthough */ case TOUCH_NONE: - case TOUCH_MAYBE_END: - return; case TOUCH_END: - evdev_log_bug_libinput(tp->device, - "touch already in TOUCH_END\n"); return; - case TOUCH_HOVERING: case TOUCH_BEGIN: case TOUCH_UPDATE: break; - } - - if (t->state != TOUCH_HOVERING) { - assert(tp->nfingers_down >= 1); - tp->nfingers_down--; - t->state = TOUCH_MAYBE_END; - } else { - t->state = TOUCH_NONE; - } - - t->dirty = true; -} - -/** - * Inverse to tp_maybe_end_touch(), restores a touch back to its previous - * state. - */ -static inline void -tp_recover_ended_touch(struct tp_dispatch *tp, - struct tp_touch *t) -{ - t->dirty = true; - t->state = TOUCH_UPDATE; - tp->nfingers_down++; -} -/** - * End a touch, even if the touch sequence is still active. - * Use tp_maybe_end_touch() instead. - */ -static inline void -tp_end_touch(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) -{ - if (t->state != TOUCH_MAYBE_END) { - evdev_log_bug_libinput(tp->device, - "touch should be MAYBE_END, is %d\n", - t->state); - return; } t->dirty = true; t->palm.state = PALM_NONE; t->state = TOUCH_END; t->pinned.is_pinned = false; - t->time = time; + t->millis = time; t->palm.time = 0; + assert(tp->nfingers_down >= 1); + tp->nfingers_down--; tp->queued |= TOUCHPAD_EVENT_MOTION; } @@ -411,32 +252,34 @@ tp_end_sequence(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) { t->has_ended = true; - tp_maybe_end_touch(tp, t, time); + tp_end_touch(tp, t, time); } -static void -tp_stop_actions(struct tp_dispatch *tp, uint64_t time) +static double +tp_estimate_delta(int x0, int x1, int x2, int x3) { - tp_edge_scroll_stop_events(tp, time); - tp_gesture_cancel(tp, time); - tp_tap_suspend(tp, time); + return (x0 + x1 - x2 - x3) / 4.0; } -struct device_coords +struct normalized_coords tp_get_delta(struct tp_touch *t) { - struct device_coords delta; - const struct device_coords zero = { 0.0, 0.0 }; + struct device_float_coords delta; + const struct normalized_coords zero = { 0.0, 0.0 }; - if (t->history.count <= 1) + if (t->history.count < TOUCHPAD_MIN_SAMPLES) return zero; - delta.x = tp_motion_history_offset(t, 0)->point.x - - tp_motion_history_offset(t, 1)->point.x; - delta.y = tp_motion_history_offset(t, 0)->point.y - - tp_motion_history_offset(t, 1)->point.y; + delta.x = tp_estimate_delta(tp_motion_history_offset(t, 0)->x, + tp_motion_history_offset(t, 1)->x, + tp_motion_history_offset(t, 2)->x, + tp_motion_history_offset(t, 3)->x); + delta.y = tp_estimate_delta(tp_motion_history_offset(t, 0)->y, + tp_motion_history_offset(t, 1)->y, + tp_motion_history_offset(t, 2)->y, + tp_motion_history_offset(t, 3)->y); - return delta; + return tp_normalize_delta(t->tp, delta); } static void @@ -448,26 +291,23 @@ switch(e->code) { case ABS_MT_POSITION_X: - evdev_device_check_abs_axis_range(tp->device, - e->code, - e->value); t->point.x = e->value; - t->time = time; + t->millis = time; t->dirty = true; tp->queued |= TOUCHPAD_EVENT_MOTION; break; case ABS_MT_POSITION_Y: - evdev_device_check_abs_axis_range(tp->device, - e->code, - e->value); t->point.y = e->value; - t->time = time; + t->millis = time; t->dirty = true; tp->queued |= TOUCHPAD_EVENT_MOTION; break; case ABS_MT_SLOT: tp->slot = e->value; break; + case ABS_MT_DISTANCE: + t->distance = e->value; + break; case ABS_MT_TRACKING_ID: if (e->value != -1) tp_new_touch(tp, t, time); @@ -476,25 +316,8 @@ break; case ABS_MT_PRESSURE: t->pressure = e->value; - t->time = time; - t->dirty = true; - tp->queued |= TOUCHPAD_EVENT_OTHERAXIS; - break; - case ABS_MT_TOOL_TYPE: - t->is_tool_palm = e->value == MT_TOOL_PALM; - t->time = time; - t->dirty = true; - tp->queued |= TOUCHPAD_EVENT_OTHERAXIS; - break; - case ABS_MT_TOUCH_MAJOR: - t->major = e->value; - t->dirty = true; - tp->queued |= TOUCHPAD_EVENT_OTHERAXIS; - break; - case ABS_MT_TOUCH_MINOR: - t->minor = e->value; t->dirty = true; - tp->queued |= TOUCHPAD_EVENT_OTHERAXIS; + tp->queued |= TOUCHPAD_EVENT_MOTION; break; } } @@ -508,29 +331,17 @@ switch(e->code) { case ABS_X: - evdev_device_check_abs_axis_range(tp->device, - e->code, - e->value); t->point.x = e->value; - t->time = time; + t->millis = time; t->dirty = true; tp->queued |= TOUCHPAD_EVENT_MOTION; break; case ABS_Y: - evdev_device_check_abs_axis_range(tp->device, - e->code, - e->value); t->point.y = e->value; - t->time = time; + t->millis = time; t->dirty = true; tp->queued |= TOUCHPAD_EVENT_MOTION; break; - case ABS_PRESSURE: - t->pressure = e->value; - t->time = time; - t->dirty = true; - tp->queued |= TOUCHPAD_EVENT_OTHERAXIS; - break; } } @@ -558,11 +369,13 @@ for (i = 0; i < tp->num_slots; i++) { struct tp_touch *t = tp_get_touch(tp, i); - if (t->state != TOUCH_MAYBE_END) + if (t->state != TOUCH_END) continue; /* new touch, move it through begin to update immediately */ - tp_recover_ended_touch(tp, t); + tp_new_touch(tp, t, time); + tp_begin_touch(tp, t, time); + t->state = TOUCH_UPDATE; } } @@ -599,7 +412,6 @@ { struct evdev_dispatch *dispatch; struct input_event event; - struct input_event syn_report = {{ 0, 0 }, EV_SYN, SYN_REPORT, 0 }; if (!tp->buttons.trackpoint) return; @@ -607,7 +419,6 @@ dispatch = tp->buttons.trackpoint->dispatch; event = *e; - syn_report.time = e->time; switch (event.code) { case BTN_0: @@ -626,9 +437,6 @@ dispatch->interface->process(dispatch, tp->buttons.trackpoint, &event, time); - dispatch->interface->process(dispatch, - tp->buttons.trackpoint, - &syn_report, time); } static void @@ -659,21 +467,20 @@ } static void -tp_unpin_finger(const struct tp_dispatch *tp, struct tp_touch *t) +tp_unpin_finger(struct tp_dispatch *tp, struct tp_touch *t) { - struct phys_coords mm; - struct device_coords delta; + double xdist, ydist; if (!t->pinned.is_pinned) return; - delta.x = abs(t->point.x - t->pinned.center.x); - delta.y = abs(t->point.y - t->pinned.center.y); - - mm = evdev_device_unit_delta_to_mm(tp->device, &delta); + xdist = abs(t->point.x - t->pinned.center.x); + xdist *= tp->buttons.motion_dist.x_scale_coeff; + ydist = abs(t->point.y - t->pinned.center.y); + ydist *= tp->buttons.motion_dist.y_scale_coeff; /* 1.5mm movement -> unpin */ - if (hypot(mm.x, mm.y) >= 1.5) { + if (hypot(xdist, ydist) >= 1.5) { t->pinned.is_pinned = false; return; } @@ -690,8 +497,8 @@ } } -bool -tp_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t) +int +tp_touch_active(struct tp_dispatch *tp, struct tp_touch *t) { return (t->state == TOUCH_BEGIN || t->state == TOUCH_UPDATE) && t->palm.state == PALM_NONE && @@ -701,62 +508,36 @@ tp_edge_scroll_touch_active(tp, t); } -static inline bool -tp_palm_was_in_side_edge(const struct tp_dispatch *tp, const struct tp_touch *t) -{ - return t->palm.first.x < tp->palm.left_edge || - t->palm.first.x > tp->palm.right_edge; -} - -static inline bool -tp_palm_was_in_top_edge(const struct tp_dispatch *tp, const struct tp_touch *t) -{ - return t->palm.first.y < tp->palm.upper_edge; -} - -static inline bool -tp_palm_in_side_edge(const struct tp_dispatch *tp, const struct tp_touch *t) -{ - return t->point.x < tp->palm.left_edge || - t->point.x > tp->palm.right_edge; -} - -static inline bool -tp_palm_in_top_edge(const struct tp_dispatch *tp, const struct tp_touch *t) -{ - return t->point.y < tp->palm.upper_edge; -} - -static inline bool -tp_palm_in_edge(const struct tp_dispatch *tp, const struct tp_touch *t) -{ - return tp_palm_in_side_edge(tp, t) || tp_palm_in_top_edge(tp, t); -} - bool -tp_palm_tap_is_palm(const struct tp_dispatch *tp, const struct tp_touch *t) +tp_palm_tap_is_palm(struct tp_dispatch *tp, struct tp_touch *t) { if (t->state != TOUCH_BEGIN) return false; - if (!tp_palm_in_edge(tp, t)) + if (t->point.x > tp->palm.left_edge && + t->point.x < tp->palm.right_edge) return false; - evdev_log_debug(tp->device, "palm: palm-tap detected\n"); - return true; + /* We're inside the left/right palm edge and in the northern half of + * the touchpad - this tap is a palm */ + if (t->point.y < tp->palm.vert_center) { + log_debug(tp_libinput_context(tp), + "palm: palm-tap detected\n"); + return true; + } + + return false; } -static bool -tp_palm_detect_dwt_triggered(struct tp_dispatch *tp, - struct tp_touch *t, - uint64_t time) +static int +tp_palm_detect_dwt(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) { if (tp->dwt.dwt_enabled && tp->dwt.keyboard_active && t->state == TOUCH_BEGIN) { t->palm.state = PALM_TYPING; t->palm.first = t->point; - return true; + return 1; } else if (!tp->dwt.keyboard_active && t->state == TOUCH_UPDATE && t->palm.state == PALM_TYPING) { @@ -769,27 +550,27 @@ if (t->palm.time == 0 || t->palm.time > tp->dwt.keyboard_last_press_time) { t->palm.state = PALM_NONE; - evdev_log_debug(tp->device, - "palm: touch released, timeout after typing\n"); + log_debug(tp_libinput_context(tp), + "palm: touch released, timeout after typing\n"); } } - return false; + return 0; } -static bool -tp_palm_detect_trackpoint_triggered(struct tp_dispatch *tp, - struct tp_touch *t, - uint64_t time) +static int +tp_palm_detect_trackpoint(struct tp_dispatch *tp, + struct tp_touch *t, + uint64_t time) { if (!tp->palm.monitor_trackpoint) - return false; + return 0; if (t->palm.state == PALM_NONE && t->state == TOUCH_BEGIN && tp->palm.trackpoint_active) { t->palm.state = PALM_TRACKPOINT; - return true; + return 1; } else if (t->palm.state == PALM_TRACKPOINT && t->state == TOUCH_UPDATE && !tp->palm.trackpoint_active) { @@ -797,251 +578,72 @@ if (t->palm.time == 0 || t->palm.time > tp->palm.trackpoint_last_event_time) { t->palm.state = PALM_NONE; - evdev_log_debug(tp->device, - "palm: touch released, timeout after trackpoint\n"); + log_debug(tp_libinput_context(tp), + "palm: touch released, timeout after trackpoint\n"); } } - return false; -} - -static bool -tp_palm_detect_tool_triggered(struct tp_dispatch *tp, - struct tp_touch *t, - uint64_t time) -{ - if (!tp->palm.use_mt_tool) - return false; - - if (t->palm.state != PALM_NONE && - t->palm.state != PALM_TOOL_PALM) - return false; - - if (t->palm.state == PALM_NONE && - t->is_tool_palm) - t->palm.state = PALM_TOOL_PALM; - else if (t->palm.state == PALM_TOOL_PALM && - !t->is_tool_palm) - t->palm.state = PALM_NONE; - - if (t->palm.state == PALM_TOOL_PALM) - tp_stop_actions(tp, time); - - return t->palm.state == PALM_TOOL_PALM; + return 0; } -static inline bool -tp_palm_detect_move_out_of_edge(struct tp_dispatch *tp, - struct tp_touch *t, - uint64_t time) +static void +tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) { const int PALM_TIMEOUT = ms2us(200); - int directions = 0; + const int DIRECTIONS = NE|E|SE|SW|W|NW; struct device_float_coords delta; int dirs; - if (time < t->palm.time + PALM_TIMEOUT && !tp_palm_in_edge(tp, t)) { - if (tp_palm_was_in_side_edge(tp, t)) - directions = NE|E|SE|SW|W|NW; - else if (tp_palm_was_in_top_edge(tp, t)) - directions = S|SE|SW; - - if (directions) { - delta = device_delta(t->point, t->palm.first); - dirs = phys_get_direction(tp_phys_delta(tp, delta)); - if ((dirs & directions) && !(dirs & ~directions)) - return true; - } - } - - return false; -} - -static inline bool -tp_palm_detect_multifinger(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) -{ - struct tp_touch *other; + if (tp_palm_detect_dwt(tp, t, time)) + goto out; - if (tp->nfingers_down < 2) - return false; + if (tp_palm_detect_trackpoint(tp, t, time)) + goto out; - /* If we have at least one other active non-palm touch make this - * touch non-palm too. This avoids palm detection during two-finger - * scrolling. - * - * Note: if both touches start in the palm zone within the same - * frame the second touch will still be PALM_NONE and thus detected - * here as non-palm touch. This is too niche to worry about for now. + /* If labelled a touch as palm, we unlabel as palm when + we move out of the palm edge zone within the timeout, provided + the direction is within 45 degrees of the horizontal. */ - tp_for_each_touch(tp, other) { - if (other == t) - continue; - - if (tp_touch_active(tp, other) && - other->palm.state == PALM_NONE) { - return true; - } - } - - return false; -} - -static inline bool -tp_palm_detect_touch_size_triggered(struct tp_dispatch *tp, - struct tp_touch *t, - uint64_t time) -{ - if (!tp->palm.use_size) - return false; - - /* If a finger size is large enough for palm, we stick with that and - * force the user to release and reset the finger */ - if (t->palm.state != PALM_NONE && t->palm.state != PALM_TOUCH_SIZE) - return false; - - if (t->major > tp->palm.size_threshold || - t->minor > tp->palm.size_threshold) { - if (t->palm.state != PALM_TOUCH_SIZE) - evdev_log_debug(tp->device, - "palm: touch size exceeded\n"); - t->palm.state = PALM_TOUCH_SIZE; - return true; - } - - return false; -} - -static inline bool -tp_palm_detect_edge(struct tp_dispatch *tp, - struct tp_touch *t, - uint64_t time) -{ if (t->palm.state == PALM_EDGE) { - if (tp_palm_detect_multifinger(tp, t, time)) { - t->palm.state = PALM_NONE; - evdev_log_debug(tp->device, - "palm: touch released, multiple fingers\n"); - - /* If labelled a touch as palm, we unlabel as palm when - we move out of the palm edge zone within the timeout, provided - the direction is within 45 degrees of the horizontal. - */ - } else if (tp_palm_detect_move_out_of_edge(tp, t, time)) { - t->palm.state = PALM_NONE; - evdev_log_debug(tp->device, - "palm: touch released, out of edge zone\n"); + if (time < t->palm.time + PALM_TIMEOUT && + (t->point.x > tp->palm.left_edge && t->point.x < tp->palm.right_edge)) { + delta = device_delta(t->point, t->palm.first); + dirs = normalized_get_direction( + tp_normalize_delta(tp, delta)); + if ((dirs & DIRECTIONS) && !(dirs & ~DIRECTIONS)) { + t->palm.state = PALM_NONE; + log_debug(tp_libinput_context(tp), + "palm: touch released, out of edge zone\n"); + } } - return false; - } else if (tp_palm_detect_multifinger(tp, t, time)) { - return false; + return; } /* palm must start in exclusion zone, it's ok to move into the zone without being a palm */ - if (t->state != TOUCH_BEGIN || !tp_palm_in_edge(tp, t)) - return false; + if (t->state != TOUCH_BEGIN || + (t->point.x > tp->palm.left_edge && t->point.x < tp->palm.right_edge)) + return; /* don't detect palm in software button areas, it's likely that legitimate touches start in the area covered by the exclusion zone */ if (tp->buttons.is_clickpad && tp_button_is_inside_softbutton_area(tp, t)) - return false; + return; if (tp_touch_get_edge(tp, t) & EDGE_RIGHT) - return false; + return; t->palm.state = PALM_EDGE; t->palm.time = time; t->palm.first = t->point; - return true; -} - -static bool -tp_palm_detect_pressure_triggered(struct tp_dispatch *tp, - struct tp_touch *t, - uint64_t time) -{ - if (!tp->palm.use_pressure) - return false; - - if (t->palm.state != PALM_NONE && - t->palm.state != PALM_PRESSURE) - return false; - - if (t->pressure > tp->palm.pressure_threshold) - t->palm.state = PALM_PRESSURE; - - return t->palm.state == PALM_PRESSURE; -} - -static void -tp_palm_detect(struct tp_dispatch *tp, struct tp_touch *t, uint64_t time) -{ - const char *palm_state; - enum touch_palm_state oldstate = t->palm.state; - - if (tp_palm_detect_pressure_triggered(tp, t, time)) - goto out; - - if (tp_palm_detect_dwt_triggered(tp, t, time)) - goto out; - - if (tp_palm_detect_trackpoint_triggered(tp, t, time)) - goto out; - - if (tp_palm_detect_tool_triggered(tp, t, time)) - goto out; - - if (tp_palm_detect_touch_size_triggered(tp, t, time)) - goto out; - - if (tp_palm_detect_edge(tp, t, time)) - goto out; - - /* Pressure is highest priority because it cannot be released and - * overrides all other checks. So we check once before anything else - * in case pressure triggers on a non-palm touch. And again after - * everything in case one of the others released but we have a - * pressure trigger now. - */ - if (tp_palm_detect_pressure_triggered(tp, t, time)) - goto out; - - return; out: - - if (oldstate == t->palm.state) - return; - - switch (t->palm.state) { - case PALM_EDGE: - palm_state = "edge"; - break; - case PALM_TYPING: - palm_state = "typing"; - break; - case PALM_TRACKPOINT: - palm_state = "trackpoint"; - break; - case PALM_TOOL_PALM: - palm_state = "tool-palm"; - break; - case PALM_PRESSURE: - palm_state = "pressure"; - break; - case PALM_TOUCH_SIZE: - palm_state = "touch size"; - break; - case PALM_NONE: - default: - abort(); - break; - } - evdev_log_debug(tp->device, + log_debug(tp_libinput_context(tp), "palm: palm detected (%s)\n", - palm_state); + t->palm.state == PALM_EDGE ? "edge" : + t->palm.state == PALM_TYPING ? "typing" : "trackpoint"); } static inline const char* @@ -1078,11 +680,12 @@ t->thumb.initial = t->point; else if (t->state == TOUCH_UPDATE) { struct device_float_coords delta; - struct phys_coords mm; + struct normalized_coords normalized; delta = device_delta(t->point, t->thumb.initial); - mm = tp_phys_delta(tp, delta); - if (length_in_mm(mm) > 7) { + normalized = tp_normalize_delta(tp, delta); + if (normalized_length(normalized) > + TP_MM_TO_DPI_NORMALIZED(7)) { t->thumb.state = THUMB_STATE_NO; goto out; } @@ -1113,130 +716,30 @@ */ out: if (t->thumb.state != state) - evdev_log_debug(tp->device, + log_debug(tp_libinput_context(tp), "thumb state: %s → %s\n", thumb_state_to_str(state), thumb_state_to_str(t->thumb.state)); } static void -tp_unhover_pressure(struct tp_dispatch *tp, uint64_t time) +tp_unhover_abs_distance(struct tp_dispatch *tp, uint64_t time) { struct tp_touch *t; - int i; - unsigned int nfake_touches; - unsigned int real_fingers_down = 0; - - nfake_touches = tp_fake_finger_count(tp); - if (nfake_touches == FAKE_FINGER_OVERFLOW) - nfake_touches = 0; + unsigned int i; - for (i = 0; i < (int)tp->num_slots; i++) { + for (i = 0; i < tp->ntouches; i++) { t = tp_get_touch(tp, i); - if (t->state == TOUCH_NONE) - continue; - - if (t->dirty) { - if (t->state == TOUCH_HOVERING) { - if (t->pressure >= tp->pressure.high) { - evdev_log_debug(tp->device, - "pressure: begin touch\n"); - /* avoid jumps when landing a finger */ - tp_motion_history_reset(t); - tp_begin_touch(tp, t, time); - } - /* don't unhover for pressure if we have too many - * fake fingers down, see comment below */ - } else if (nfake_touches <= tp->num_slots) { - if (t->pressure < tp->pressure.low) { - evdev_log_debug(tp->device, - "pressure: end touch\n"); - tp_maybe_end_touch(tp, t, time); - } - } - } - - if (t->state == TOUCH_BEGIN || - t->state == TOUCH_UPDATE) - real_fingers_down++; - } - - if (nfake_touches <= tp->num_slots || - tp->nfingers_down == 0) - return; - - /* if we have more fake fingers down than slots, we assume - * _all_ fingers have enough pressure, even if some of the slotted - * ones don't. Anything else gets insane quickly. - */ - if (real_fingers_down > 0) { - tp_for_each_touch(tp, t) { - if (t->state == TOUCH_HOVERING) { - /* avoid jumps when landing a finger */ - tp_motion_history_reset(t); - tp_begin_touch(tp, t, time); - - if (tp->nfingers_down >= nfake_touches) - break; - } - } - } - - if (tp->nfingers_down > nfake_touches || - real_fingers_down == 0) { - for (i = tp->ntouches - 1; i >= 0; i--) { - t = tp_get_touch(tp, i); - - if (t->state == TOUCH_HOVERING || - t->state == TOUCH_NONE || - t->state == TOUCH_MAYBE_END) - continue; - - tp_maybe_end_touch(tp, t, time); - - if (real_fingers_down > 0 && - tp->nfingers_down == nfake_touches) - break; - } - } -} - -static void -tp_unhover_size(struct tp_dispatch *tp, uint64_t time) -{ - struct tp_touch *t; - int low = tp->touch_size.low, - high = tp->touch_size.high; - int i; - - /* We require 5 slots for size handling, so we don't need to care - * about fake touches here */ - - for (i = 0; i < (int)tp->num_slots; i++) { - t = tp_get_touch(tp, i); - - if (t->state == TOUCH_NONE) - continue; - - if (!t->dirty) - continue; - if (t->state == TOUCH_HOVERING) { - if ((t->major > high && t->minor > low) || - (t->major > low && t->minor > high)) { - evdev_log_debug(tp->device, - "touch-size: begin touch\n"); + if (t->distance == 0) { /* avoid jumps when landing a finger */ tp_motion_history_reset(t); tp_begin_touch(tp, t, time); } } else { - if (t->major < low || t->minor < low) { - evdev_log_debug(tp->device, - "touch-size: end touch\n"); - tp_maybe_end_touch(tp, t, time); - } + if (t->distance > 0) + tp_end_touch(tp, t, time); } } } @@ -1266,7 +769,9 @@ */ if (tp_fake_finger_is_touching(tp) && tp->nfingers_down < nfake_touches) { - tp_for_each_touch(tp, t) { + for (i = 0; i < (int)tp->ntouches; i++) { + t = tp_get_touch(tp, i); + if (t->state == TOUCH_HOVERING) { tp_begin_touch(tp, t, time); @@ -1289,7 +794,7 @@ t->state == TOUCH_NONE) continue; - tp_maybe_end_touch(tp, t, time); + tp_end_touch(tp, t, time); if (tp_fake_finger_is_touching(tp) && tp->nfingers_down == nfake_touches) @@ -1301,10 +806,8 @@ static void tp_unhover_touches(struct tp_dispatch *tp, uint64_t time) { - if (tp->pressure.use_pressure) - tp_unhover_pressure(tp, time); - else if (tp->touch_size.use_touch_size) - tp_unhover_size(tp, time); + if (tp->reports_distance) + tp_unhover_abs_distance(tp, time); else tp_unhover_fake_touches(tp, time); @@ -1317,8 +820,7 @@ struct tp_touch *topmost = NULL; unsigned int start, i; - if (tp_fake_finger_count(tp) <= tp->num_slots || - tp->nfingers_down == 0) + if (tp_fake_finger_count(tp) <= tp->num_slots) return; /* We have at least one fake touch down. Find the top-most real @@ -1336,8 +838,8 @@ } if (!topmost) { - evdev_log_bug_libinput(tp->device, - "Unable to find topmost touch\n"); + log_bug_libinput(tp_libinput_context(tp), + "Unable to find topmost touch\n"); return; } @@ -1348,7 +850,6 @@ continue; t->point = topmost->point; - t->pressure = topmost->pressure; if (!t->dirty) t->dirty = topmost->dirty; } @@ -1357,134 +858,38 @@ static inline bool tp_need_motion_history_reset(struct tp_dispatch *tp) { - bool rc = false; - - /* Changing the numbers of fingers can cause a jump in the - * coordinates, always reset the motion history for all touches when - * that happens. - */ - if (tp->nfingers_down != tp->old_nfingers_down) + /* semi-mt finger postions may "jump" when nfingers changes */ + if (tp->semi_mt && tp->nfingers_down != tp->old_nfingers_down) return true; - /* Quirk: if we had multiple events without x/y axis - information, the next x/y event is going to be a jump. So we - reset that touch to non-dirty effectively swallowing that event - and restarting with the next event again. + /* if we're transitioning between slots and fake touches in either + * direction, we may get a coordinate jump */ - if (tp->device->model_flags & EVDEV_MODEL_LENOVO_T450_TOUCHPAD) { - if (tp->queued & TOUCHPAD_EVENT_MOTION) { - if (tp->quirks.nonmotion_event_count > 10) { - tp->queued &= ~TOUCHPAD_EVENT_MOTION; - rc = true; - } - tp->quirks.nonmotion_event_count = 0; - } - - if ((tp->queued & (TOUCHPAD_EVENT_OTHERAXIS|TOUCHPAD_EVENT_MOTION)) == - TOUCHPAD_EVENT_OTHERAXIS) - tp->quirks.nonmotion_event_count++; - } - - return rc; -} - -static bool -tp_detect_jumps(const struct tp_dispatch *tp, struct tp_touch *t) -{ - struct device_coords delta; - struct phys_coords mm; - const int JUMP_THRESHOLD_MM = 20; - struct tp_history_point *last; - - /* We haven't seen pointer jumps on Wacom tablets yet, so exclude - * those. - */ - if (tp->device->model_flags & EVDEV_MODEL_WACOM_TOUCHPAD) - return false; - - if (t->history.count == 0) - return false; - - /* called before tp_motion_history_push, so offset 0 is the most - * recent coordinate */ - last = tp_motion_history_offset(t, 0); - delta.x = abs(t->point.x - last->point.x); - delta.y = abs(t->point.y - last->point.y); - mm = evdev_device_unit_delta_to_mm(tp->device, &delta); - - return hypot(mm.x, mm.y) > JUMP_THRESHOLD_MM; -} - -static void -tp_detect_thumb_while_moving(struct tp_dispatch *tp) -{ - struct tp_touch *t; - struct tp_touch *first = NULL, - *second = NULL; - struct device_coords distance; - struct phys_coords mm; - - tp_for_each_touch(tp, t) { - if (t->state != TOUCH_BEGIN) - first = t; - else - second = t; - - if (first && second) - break; - } - - assert(first); - assert(second); - - if (tp->scroll.method == LIBINPUT_CONFIG_SCROLL_2FG) { - /* If the second finger comes down next to the other one, we - * assume this is a scroll motion. - */ - distance.x = abs(first->point.x - second->point.x); - distance.y = abs(first->point.y - second->point.y); - mm = evdev_device_unit_delta_to_mm(tp->device, &distance); - - if (mm.x <= 25 && mm.y <= 15) - return; - } - - /* Finger are too far apart or 2fg scrolling is disabled, mark - * second finger as thumb */ - evdev_log_debug(tp->device, - "touch is speed-based thumb\n"); - second->thumb.state = THUMB_STATE_YES; -} - -static void -tp_pre_process_state(struct tp_dispatch *tp, uint64_t time) -{ - struct tp_touch *t; - - tp_process_fake_touches(tp, time); - tp_unhover_touches(tp, time); - - tp_for_each_touch(tp, t) { - if (t->state == TOUCH_MAYBE_END) - tp_end_touch(tp, t, time); - } + if (tp->nfingers_down != tp->old_nfingers_down && + (tp->nfingers_down > tp->num_slots || + tp->old_nfingers_down > tp->num_slots)) + return true; + return false; } static void tp_process_state(struct tp_dispatch *tp, uint64_t time) { struct tp_touch *t; + unsigned int i; bool restart_filter = false; bool want_motion_reset; - bool have_new_touch = false; - unsigned int speed_exceeded_count = 0; + tp_process_fake_touches(tp, time); + tp_unhover_touches(tp, time); tp_position_fake_touches(tp); want_motion_reset = tp_need_motion_history_reset(tp); - tp_for_each_touch(tp, t) { + for (i = 0; i < tp->ntouches; i++) { + t = tp_get_touch(tp, i); + if (want_motion_reset) { tp_motion_history_reset(t); t->quirks.reset_motion_history = true; @@ -1493,70 +898,21 @@ t->quirks.reset_motion_history = false; } - if (!t->dirty) { - /* A non-dirty touch must be below the speed limit */ - if (t->speed.exceeded_count > 0) - t->speed.exceeded_count--; - - speed_exceeded_count = max(speed_exceeded_count, - t->speed.exceeded_count); + if (!t->dirty) continue; - } - - if (tp_detect_jumps(tp, t)) { - if (!tp->semi_mt) - evdev_log_bug_kernel(tp->device, - "Touch jump detected and discarded.\n" - "See %stouchpad_jumping_cursor.html for details\n", - HTTP_DOC_LINK); - tp_motion_history_reset(t); - } tp_thumb_detect(tp, t, time); tp_palm_detect(tp, t, time); - tp_detect_wobbling(tp, t, time); + tp_motion_hysteresis(tp, t); tp_motion_history_push(t); - /* Touch speed handling: if we'are above the threshold, - * count each event that we're over the threshold up to 10 - * events. Count down when we are below the speed. - * - * Take the touch with the highest speed excess, if it is - * above a certain threshold (5, see below), assume a - * dropped finger is a thumb. - * - * Yes, this relies on the touchpad to keep sending us - * events even if the finger doesn't move, otherwise we - * never count down. Let's see how far we get with that. - */ - if (t->speed.last_speed > THUMB_IGNORE_SPEED_THRESHOLD) { - if (t->speed.exceeded_count < 10) - t->speed.exceeded_count++; - } else if (t->speed.exceeded_count > 0) { - t->speed.exceeded_count--; - } - - speed_exceeded_count = max(speed_exceeded_count, - t->speed.exceeded_count); - - tp_calculate_motion_speed(tp, t); - tp_unpin_finger(tp, t); - if (t->state == TOUCH_BEGIN) { - have_new_touch = true; + if (t->state == TOUCH_BEGIN) restart_filter = true; - } } - /* If we have one touch that exceeds the speed and we get a new - * touch down while doing that, the second touch is a thumb */ - if (have_new_touch && - tp->nfingers_down == 2 && - speed_exceeded_count > 5) - tp_detect_thumb_while_moving(tp); - if (restart_filter) filter_restart(tp->device->pointer.filter, tp, time); @@ -1602,8 +958,6 @@ tp->buttons.old_state = tp->buttons.state; tp->queued = TOUCHPAD_EVENT_NONE; - - tp_tap_post_process_state(tp); } static void @@ -1612,7 +966,7 @@ int filter_motion = 0; /* Only post (top) button events while suspended */ - if (tp->device->is_suspended) { + if (tp->device->suspended) { tp_post_button_events(tp, time); return; } @@ -1638,34 +992,9 @@ tp_handle_state(struct tp_dispatch *tp, uint64_t time) { - tp_pre_process_state(tp, time); tp_process_state(tp, time); tp_post_events(tp, time); tp_post_process_state(tp, time); - - tp_clickpad_middlebutton_apply_config(tp->device); -} - -static inline void -tp_debug_touch_state(struct tp_dispatch *tp, - struct evdev_device *device) -{ - char buf[1024] = {0}; - struct tp_touch *t; - size_t i = 0; - - tp_for_each_touch(tp, t) { - if (i >= tp->nfingers_down) - break; - sprintf(&buf[strlen(buf)], - "slot %zd: %04d/%04d p%03d %s |", - i++, - t->point.x, - t->point.y, - t->pressure, - tp_touch_active(tp, t) ? "" : "inactive"); - } - evdev_log_debug(device, "touch state: %s\n", buf); } static void @@ -1674,10 +1003,8 @@ struct input_event *e, uint64_t time) { - struct tp_dispatch *tp = tp_dispatch(dispatch); - - if (tp->ignore_events) - return; + struct tp_dispatch *tp = + (struct tp_dispatch *)dispatch; switch (e->type) { case EV_ABS: @@ -1691,9 +1018,6 @@ break; case EV_SYN: tp_handle_state(tp, time); -#if 0 - tp_debug_touch_state(tp, device); -#endif break; } } @@ -1701,8 +1025,6 @@ static void tp_remove_sendevents(struct tp_dispatch *tp) { - struct paired_keyboard *kbd; - libinput_timer_cancel(&tp->palm.trackpoint_timer); libinput_timer_cancel(&tp->dwt.keyboard_timer); @@ -1711,24 +1033,16 @@ libinput_device_remove_event_listener( &tp->palm.trackpoint_listener); - ARRAY_FOR_EACH(tp->dwt.paired_keyboard, kbd) { - if (kbd->device) - libinput_device_remove_event_listener(&kbd->listener); - } - - if (tp->lid_switch.lid_switch) - libinput_device_remove_event_listener( - &tp->lid_switch.listener); - - if (tp->tablet_mode_switch.tablet_mode_switch) + if (tp->dwt.keyboard) libinput_device_remove_event_listener( - &tp->tablet_mode_switch.listener); + &tp->dwt.keyboard_listener); } static void tp_interface_remove(struct evdev_dispatch *dispatch) { - struct tp_dispatch *tp = tp_dispatch(dispatch); + struct tp_dispatch *tp = + (struct tp_dispatch*)dispatch; tp_remove_tap(tp); tp_remove_buttons(tp); @@ -1740,12 +1054,9 @@ static void tp_interface_destroy(struct evdev_dispatch *dispatch) { - struct tp_dispatch *tp = tp_dispatch(dispatch); + struct tp_dispatch *tp = + (struct tp_dispatch*)dispatch; - libinput_timer_destroy(&tp->palm.trackpoint_timer); - libinput_timer_destroy(&tp->dwt.keyboard_timer); - libinput_timer_destroy(&tp->tap.timer); - libinput_timer_destroy(&tp->gesture.finger_count_switch_timer); free(tp->touches); free(tp); } @@ -1796,7 +1107,7 @@ if (tp->buttons.has_topbuttons) { evdev_notify_suspended_device(device); /* Enlarge topbutton area while suspended */ - tp_init_top_softbuttons(tp, device, 3.0); + tp_init_top_softbuttons(tp, device, 1.5); } else { evdev_device_suspend(device); } @@ -1806,59 +1117,11 @@ tp_interface_suspend(struct evdev_dispatch *dispatch, struct evdev_device *device) { - struct tp_dispatch *tp = tp_dispatch(dispatch); + struct tp_dispatch *tp = (struct tp_dispatch *)dispatch; tp_clear_state(tp); } -static inline void -tp_sync_touch(struct tp_dispatch *tp, - struct evdev_device *device, - struct tp_touch *t, - int slot) -{ - struct libevdev *evdev = device->evdev; - - if (!libevdev_fetch_slot_value(evdev, - slot, - ABS_MT_POSITION_X, - &t->point.x)) - t->point.x = libevdev_get_event_value(evdev, EV_ABS, ABS_X); - if (!libevdev_fetch_slot_value(evdev, - slot, - ABS_MT_POSITION_Y, - &t->point.y)) - t->point.y = libevdev_get_event_value(evdev, EV_ABS, ABS_Y); - - if (!libevdev_fetch_slot_value(evdev, - slot, - ABS_MT_PRESSURE, - &t->pressure)) - t->pressure = libevdev_get_event_value(evdev, - EV_ABS, - ABS_PRESSURE); - - libevdev_fetch_slot_value(evdev, - slot, - ABS_MT_TOUCH_MAJOR, - &t->major); - libevdev_fetch_slot_value(evdev, - slot, - ABS_MT_TOUCH_MINOR, - &t->minor); -} - -static void -tp_sync_slots(struct tp_dispatch *tp, - struct evdev_device *device) -{ - /* Always sync the first touch so we get ABS_X/Y synced on - * single-touch touchpads */ - tp_sync_touch(tp, device, &tp->touches[0], 0); - for (unsigned int i = 1; i < tp->num_slots; i++) - tp_sync_touch(tp, device, &tp->touches[i], i); -} - static void tp_resume(struct tp_dispatch *tp, struct evdev_device *device) { @@ -1871,33 +1134,6 @@ } else { evdev_device_resume(device); } - - tp_sync_slots(tp, device); -} - -#define NO_EXCLUDED_DEVICE NULL -static void -tp_resume_conditional(struct tp_dispatch *tp, - struct evdev_device *device, - struct evdev_device *excluded_device) -{ - if (tp->sendevents.current_mode == LIBINPUT_CONFIG_SEND_EVENTS_DISABLED) - return; - - if (tp->sendevents.current_mode == - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE) { - struct libinput_device *dev; - - list_for_each(dev, &device->base.seat->devices_list, link) { - struct evdev_device *d = evdev_device(dev); - if (d != excluded_device && - (d->tags & EVDEV_TAG_EXTERNAL_MOUSE)) { - return; - } - } - } - - tp_resume(tp, device); } static void @@ -1907,7 +1143,6 @@ tp_tap_resume(tp, now); tp->palm.trackpoint_active = false; - tp->palm.trackpoint_event_count = 0; } static void @@ -1920,18 +1155,14 @@ if (event->type == LIBINPUT_EVENT_POINTER_BUTTON) return; - tp->palm.trackpoint_last_event_time = time; - tp->palm.trackpoint_event_count++; - - /* Require at least three events before enabling palm detection */ - if (tp->palm.trackpoint_event_count < 3) - return; - if (!tp->palm.trackpoint_active) { - tp_stop_actions(tp, time); + tp_edge_scroll_stop_events(tp, time); + tp_gesture_cancel(tp, time); + tp_tap_suspend(tp, time); tp->palm.trackpoint_active = true; } + tp->palm.trackpoint_last_event_time = time; libinput_timer_set(&tp->palm.trackpoint_timer, time + DEFAULT_TRACKPOINT_ACTIVITY_TIMEOUT); } @@ -1941,25 +1172,15 @@ { struct tp_dispatch *tp = data; - if (tp->dwt.dwt_enabled && - long_any_bit_set(tp->dwt.key_mask, - ARRAY_LENGTH(tp->dwt.key_mask))) { - libinput_timer_set(&tp->dwt.keyboard_timer, - now + DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_2); - tp->dwt.keyboard_last_press_time = now; - evdev_log_debug(tp->device, "palm: keyboard timeout refresh\n"); - return; - } - tp_tap_resume(tp, now); tp->dwt.keyboard_active = false; - evdev_log_debug(tp->device, "palm: keyboard timeout\n"); + log_debug(tp_libinput_context(tp), "palm: keyboard timeout\n"); } static inline bool -tp_key_is_modifier(unsigned int keycode) +tp_key_ignore_for_dwt(unsigned int keycode) { switch (keycode) { /* Ignore modifiers to be responsive to ctrl-click, alt-tab, etc. */ @@ -1977,21 +1198,16 @@ case KEY_LEFTMETA: return true; default: - return false; + break; } -} -static inline bool -tp_key_ignore_for_dwt(unsigned int keycode) -{ /* Ignore keys not part of the "typewriter set", i.e. F-keys, * multimedia keys, numpad, etc. */ + if (keycode >= KEY_F1) + return true; - if (tp_key_is_modifier(keycode)) - return false; - - return keycode >= KEY_F1; + return false; } static void @@ -2000,48 +1216,29 @@ struct tp_dispatch *tp = data; struct libinput_event_keyboard *kbdev; unsigned int timeout; - unsigned int key; - bool is_modifier; + + if (!tp->dwt.dwt_enabled) + return; if (event->type != LIBINPUT_EVENT_KEYBOARD_KEY) return; kbdev = libinput_event_get_keyboard_event(event); - key = libinput_event_keyboard_get_key(kbdev); /* Only trigger the timer on key down. */ if (libinput_event_keyboard_get_key_state(kbdev) != - LIBINPUT_KEY_STATE_PRESSED) { - long_clear_bit(tp->dwt.key_mask, key); - long_clear_bit(tp->dwt.mod_mask, key); - return; - } - - if (!tp->dwt.dwt_enabled) - return; - - if (tp_key_ignore_for_dwt(key)) + LIBINPUT_KEY_STATE_PRESSED) return; /* modifier keys don't trigger disable-while-typing so things like * ctrl+zoom or ctrl+click are possible */ - is_modifier = tp_key_is_modifier(key); - if (is_modifier) { - long_set_bit(tp->dwt.mod_mask, key); + if (tp_key_ignore_for_dwt(libinput_event_keyboard_get_key(kbdev))) return; - } if (!tp->dwt.keyboard_active) { - /* This is the first non-modifier key press. Check if the - * modifier mask is set. If any modifier is down we don't - * trigger dwt because it's likely to be combination like - * Ctrl+S or similar */ - - if (long_any_bit_set(tp->dwt.mod_mask, - ARRAY_LENGTH(tp->dwt.mod_mask))) - return; - - tp_stop_actions(tp, time); + tp_edge_scroll_stop_events(tp, time); + tp_gesture_cancel(tp, time); + tp_tap_suspend(tp, time); tp->dwt.keyboard_active = true; timeout = DEFAULT_KEYBOARD_ACTIVITY_TIMEOUT_1; } else { @@ -2049,188 +1246,86 @@ } tp->dwt.keyboard_last_press_time = time; - long_set_bit(tp->dwt.key_mask, key); libinput_timer_set(&tp->dwt.keyboard_timer, time + timeout); } static bool -tp_want_dwt(struct evdev_device *touchpad, - struct evdev_device *keyboard) +tp_dwt_device_is_blacklisted(struct evdev_device *device) { - unsigned int vendor_tp = evdev_device_get_id_vendor(touchpad); - unsigned int vendor_kbd = evdev_device_get_id_vendor(keyboard); - unsigned int product_tp = evdev_device_get_id_product(touchpad); - unsigned int product_kbd = evdev_device_get_id_product(keyboard); - - /* External touchpads with the same vid/pid as the keyboard are - considered a happy couple */ - if (touchpad->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD) - return vendor_tp == vendor_kbd && product_tp == product_kbd; - else if (keyboard->tags & EVDEV_TAG_INTERNAL_KEYBOARD) + unsigned int bus = libevdev_get_id_bustype(device->evdev); + + /* evemu will set the right bus type */ + if (bus == BUS_BLUETOOTH || bus == BUS_VIRTUAL) + return true; + + /* Wacom makes touchpads, but not internal ones */ + if (libevdev_get_id_vendor(device->evdev) == VENDOR_ID_WACOM) return true; - /* keyboard is not tagged as internal keyboard and it's not part of - * a combo */ return false; } -static void -tp_dwt_pair_keyboard(struct evdev_device *touchpad, - struct evdev_device *keyboard) +static bool +tp_want_dwt(struct evdev_device *touchpad, + struct evdev_device *keyboard) { - struct tp_dispatch *tp = (struct tp_dispatch*)touchpad->dispatch; - struct paired_keyboard *kbd; - bool found = false; - - if ((keyboard->tags & EVDEV_TAG_KEYBOARD) == 0) - return; + unsigned int bus_tp = libevdev_get_id_bustype(touchpad->evdev), + bus_kbd = libevdev_get_id_bustype(keyboard->evdev); - if (!tp_want_dwt(touchpad, keyboard)) - return; + if (tp_dwt_device_is_blacklisted(touchpad) || + tp_dwt_device_is_blacklisted(keyboard)) + return false; - ARRAY_FOR_EACH(tp->dwt.paired_keyboard, kbd) { - if (kbd->device) - continue; + /* If the touchpad is on serio, the keyboard is too, so ignore any + other devices */ + if (bus_tp == BUS_I8042 && bus_kbd != bus_tp) + return false; - found = true; - libinput_device_add_event_listener(&keyboard->base, - &kbd->listener, - tp_keyboard_event, tp); - kbd->device = keyboard; - evdev_log_debug(touchpad, - "palm: dwt activated with %s<->%s\n", - touchpad->devname, - keyboard->devname); - break; - } + /* everything else we don't really know, so we have to assume + they go together */ - if (!found) - evdev_log_bug_libinput(touchpad, - "too many internal keyboards for dwt\n"); + return true; } static void -tp_pair_trackpoint(struct evdev_device *touchpad, - struct evdev_device *trackpoint) +tp_interface_device_added(struct evdev_device *device, + struct evdev_device *added_device) { - struct tp_dispatch *tp = (struct tp_dispatch*)touchpad->dispatch; - unsigned int bus_tp = libevdev_get_id_bustype(touchpad->evdev), - bus_trp = libevdev_get_id_bustype(trackpoint->evdev); + struct tp_dispatch *tp = (struct tp_dispatch*)device->dispatch; + unsigned int bus_tp = libevdev_get_id_bustype(device->evdev), + bus_trp = libevdev_get_id_bustype(added_device->evdev); bool tp_is_internal, trp_is_internal; - if ((trackpoint->tags & EVDEV_TAG_TRACKPOINT) == 0) - return; - tp_is_internal = bus_tp != BUS_USB && bus_tp != BUS_BLUETOOTH; trp_is_internal = bus_trp != BUS_USB && bus_trp != BUS_BLUETOOTH; if (tp->buttons.trackpoint == NULL && + (added_device->tags & EVDEV_TAG_TRACKPOINT) && tp_is_internal && trp_is_internal) { /* Don't send any pending releases to the new trackpoint */ tp->buttons.active_is_topbutton = false; - tp->buttons.trackpoint = trackpoint; + tp->buttons.trackpoint = added_device; if (tp->palm.monitor_trackpoint) - libinput_device_add_event_listener(&trackpoint->base, - &tp->palm.trackpoint_listener, - tp_trackpoint_event, tp); - } -} - -static void -tp_switch_event(uint64_t time, struct libinput_event *event, void *data) -{ - struct tp_dispatch *tp = data; - struct libinput_event_switch *swev; - const char *which = NULL; - - if (libinput_event_get_type(event) != LIBINPUT_EVENT_SWITCH_TOGGLE) - return; - - swev = libinput_event_get_switch_event(event); - - switch (libinput_event_switch_get_switch(swev)) { - case LIBINPUT_SWITCH_LID: - which = "lid"; - break; - case LIBINPUT_SWITCH_TABLET_MODE: - which = "tablet-mode"; - break; - } - - switch (libinput_event_switch_get_switch_state(swev)) { - case LIBINPUT_SWITCH_STATE_OFF: - tp_resume_conditional(tp, tp->device, NO_EXCLUDED_DEVICE); - evdev_log_debug(tp->device, "%s: resume touchpad\n", which); - break; - case LIBINPUT_SWITCH_STATE_ON: - tp_suspend(tp, tp->device); - evdev_log_debug(tp->device, "%s: suspending touchpad\n", which); - break; - } -} - -static void -tp_pair_lid_switch(struct evdev_device *touchpad, - struct evdev_device *lid_switch) -{ - struct tp_dispatch *tp = (struct tp_dispatch*)touchpad->dispatch; - - if ((lid_switch->tags & EVDEV_TAG_LID_SWITCH) == 0) - return; - - if (tp->lid_switch.lid_switch == NULL) { - evdev_log_debug(touchpad, - "lid_switch: activated for %s<->%s\n", - touchpad->devname, - lid_switch->devname); - - libinput_device_add_event_listener(&lid_switch->base, - &tp->lid_switch.listener, - tp_switch_event, tp); - tp->lid_switch.lid_switch = lid_switch; - } -} - -static void -tp_pair_tablet_mode_switch(struct evdev_device *touchpad, - struct evdev_device *tablet_mode_switch) -{ - struct tp_dispatch *tp = (struct tp_dispatch*)touchpad->dispatch; - - if ((tablet_mode_switch->tags & EVDEV_TAG_TABLET_MODE_SWITCH) == 0) - return; - - if (tp->tablet_mode_switch.tablet_mode_switch) - return; - - evdev_log_debug(touchpad, - "tablet_mode_switch: activated for %s<->%s\n", - touchpad->devname, - tablet_mode_switch->devname); - - libinput_device_add_event_listener(&tablet_mode_switch->base, - &tp->tablet_mode_switch.listener, - tp_switch_event, tp); - tp->tablet_mode_switch.tablet_mode_switch = tablet_mode_switch; - - if (evdev_device_switch_get_state(tablet_mode_switch, - LIBINPUT_SWITCH_TABLET_MODE) - == LIBINPUT_SWITCH_STATE_ON) { - tp_suspend(tp, touchpad); - } -} - -static void -tp_interface_device_added(struct evdev_device *device, - struct evdev_device *added_device) -{ - struct tp_dispatch *tp = (struct tp_dispatch*)device->dispatch; + libinput_device_add_event_listener(&added_device->base, + &tp->palm.trackpoint_listener, + tp_trackpoint_event, tp); + } - tp_pair_trackpoint(device, added_device); - tp_dwt_pair_keyboard(device, added_device); - tp_pair_lid_switch(device, added_device); - tp_pair_tablet_mode_switch(device, added_device); + if (added_device->tags & EVDEV_TAG_KEYBOARD && + tp->dwt.keyboard == NULL && + tp_want_dwt(device, added_device)) { + log_debug(tp_libinput_context(tp), + "palm: dwt activated with %s<->%s\n", + device->devname, + added_device->devname); + + libinput_device_add_event_listener(&added_device->base, + &tp->dwt.keyboard_listener, + tp_keyboard_event, tp); + tp->dwt.keyboard = added_device; + tp->dwt.keyboard_active = false; + } if (tp->sendevents.current_mode != LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE) @@ -2245,7 +1340,7 @@ struct evdev_device *removed_device) { struct tp_dispatch *tp = (struct tp_dispatch*)device->dispatch; - struct paired_keyboard *kbd; + struct libinput_device *dev; if (removed_device == tp->buttons.trackpoint) { /* Clear any pending releases for the trackpoint */ @@ -2259,67 +1354,32 @@ tp->buttons.trackpoint = NULL; } - ARRAY_FOR_EACH(tp->dwt.paired_keyboard, kbd) { - if (kbd->device == removed_device) { - libinput_device_remove_event_listener(&kbd->listener); - kbd->device = NULL; - tp->dwt.keyboard_active = false; - } - } - - if (removed_device == tp->lid_switch.lid_switch) { + if (removed_device == tp->dwt.keyboard) { libinput_device_remove_event_listener( - &tp->lid_switch.listener); - tp->lid_switch.lid_switch = NULL; + &tp->dwt.keyboard_listener); + tp->dwt.keyboard = NULL; } - if (removed_device == tp->tablet_mode_switch.tablet_mode_switch) { - libinput_device_remove_event_listener( - &tp->tablet_mode_switch.listener); - tp->tablet_mode_switch.tablet_mode_switch = NULL; - } - - /* removed_device is still in the device list at this point, so we - * need to exclude it from the tp_resume_conditional */ - tp_resume_conditional(tp, device, removed_device); -} + if (tp->sendevents.current_mode != + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE) + return; -static inline void -evdev_tag_touchpad_internal(struct evdev_device *device) -{ - device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD; - device->tags &= ~EVDEV_TAG_EXTERNAL_TOUCHPAD; -} + list_for_each(dev, &device->base.seat->devices_list, link) { + struct evdev_device *d = (struct evdev_device*)dev; + if (d != removed_device && + (d->tags & EVDEV_TAG_EXTERNAL_MOUSE)) { + return; + } + } -static inline void -evdev_tag_touchpad_external(struct evdev_device *device) -{ - device->tags |= EVDEV_TAG_EXTERNAL_TOUCHPAD; - device->tags &= ~EVDEV_TAG_INTERNAL_TOUCHPAD; + tp_resume(tp, device); } -static void +void evdev_tag_touchpad(struct evdev_device *device, struct udev_device *udev_device) { - int bustype, vendor; - const char *prop; - - prop = udev_device_get_property_value(udev_device, - "ID_INPUT_TOUCHPAD_INTEGRATION"); - if (prop) { - if (streq(prop, "internal")) { - evdev_tag_touchpad_internal(device); - return; - } else if (streq(prop, "external")) { - evdev_tag_touchpad_external(device); - return; - } else { - evdev_log_info(device, - "tagged with unknown value %s\n", - prop); - } - } + int bustype; /* simple approach: touchpads on USB or Bluetooth are considered * external, anything else is internal. Exception is Apple - @@ -2327,69 +1387,22 @@ * external USB touchpads anyway. */ bustype = libevdev_get_id_bustype(device->evdev); - vendor = libevdev_get_id_vendor(device->evdev); - - switch (bustype) { - case BUS_USB: + if (bustype == BUS_USB) { if (device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD) - evdev_tag_touchpad_internal(device); - break; - case BUS_BLUETOOTH: - evdev_tag_touchpad_external(device); - break; - default: - evdev_tag_touchpad_internal(device); - break; - } - - switch (vendor) { - /* Logitech does not have internal touchpads */ - case VENDOR_ID_LOGITECH: - evdev_tag_touchpad_external(device); - break; - } - - /* Wacom makes touchpads, but not internal ones */ - if (device->model_flags & EVDEV_MODEL_WACOM_TOUCHPAD) - evdev_tag_touchpad_external(device); - - if ((device->tags & - (EVDEV_TAG_EXTERNAL_TOUCHPAD|EVDEV_TAG_INTERNAL_TOUCHPAD)) == 0) { - evdev_log_bug_libinput(device, - "Internal or external? Please file a bug.\n"); - evdev_tag_touchpad_external(device); - } -} - -static void -tp_interface_toggle_touch(struct evdev_dispatch *dispatch, - struct evdev_device *device, - bool enable) -{ - struct tp_dispatch *tp = tp_dispatch(dispatch); - bool ignore_events = !enable; - - if (ignore_events == tp->ignore_events) - return; - - if (ignore_events) - tp_clear_state(tp); - - tp->ignore_events = ignore_events; + device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD; + } else if (bustype != BUS_BLUETOOTH) + device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD; } static struct evdev_dispatch_interface tp_interface = { - .process = tp_interface_process, - .suspend = tp_interface_suspend, - .remove = tp_interface_remove, - .destroy = tp_interface_destroy, - .device_added = tp_interface_device_added, - .device_removed = tp_interface_device_removed, - .device_suspended = tp_interface_device_removed, /* treat as remove */ - .device_resumed = tp_interface_device_added, /* treat as add */ - .post_added = NULL, - .toggle_touch = tp_interface_toggle_touch, - .get_switch_state = NULL, + tp_interface_process, + tp_interface_suspend, + tp_interface_remove, + tp_interface_destroy, + tp_interface_device_added, + tp_interface_device_removed, + tp_interface_device_removed, /* device_suspended, treat as remove */ + tp_interface_device_added, /* device_resumed, treat as add */ }; static void @@ -2400,17 +1413,29 @@ t->has_ended = true; } -static inline void -tp_disable_abs_mt(struct evdev_device *device) +static void +tp_sync_touch(struct tp_dispatch *tp, + struct evdev_device *device, + struct tp_touch *t, + int slot) { struct libevdev *evdev = device->evdev; - unsigned int code; - for (code = ABS_MT_SLOT; code <= ABS_MAX; code++) - libevdev_disable_event_code(evdev, EV_ABS, code); + if (!libevdev_fetch_slot_value(evdev, + slot, + ABS_MT_POSITION_X, + &t->point.x)) + t->point.x = libevdev_get_event_value(evdev, EV_ABS, ABS_X); + if (!libevdev_fetch_slot_value(evdev, + slot, + ABS_MT_POSITION_Y, + &t->point.y)) + t->point.y = libevdev_get_event_value(evdev, EV_ABS, ABS_Y); + + libevdev_fetch_slot_value(evdev, slot, ABS_MT_DISTANCE, &t->distance); } -static bool +static int tp_init_slots(struct tp_dispatch *tp, struct evdev_device *device) { @@ -2440,34 +1465,21 @@ tp->semi_mt = libevdev_has_property(device->evdev, INPUT_PROP_SEMI_MT); - /* Semi-mt devices are not reliable for true multitouch data, so we - * simply pretend they're single touch touchpads with BTN_TOOL bits. - * Synaptics: - * Terrible resolution when two fingers are down, + /* This device has a terrible resolution when two fingers are down, * causing scroll jumps. The single-touch emulation ABS_X/Y is * accurate but the ABS_MT_POSITION touchpoints report the bounding - * box and that causes jumps. See https://bugzilla.redhat.com/1235175 - * Elantech: - * On three-finger taps/clicks, one slot doesn't get a coordinate - * assigned. See https://bugs.freedesktop.org/show_bug.cgi?id=93583 - * Alps: - * If three fingers are set down in the same frame, one slot has the - * coordinates 0/0 and may not get updated for several frames. - * See https://bugzilla.redhat.com/show_bug.cgi?id=1295073 - * - * The HP Pavilion DM4 touchpad has random jumps in slots, including - * for single-finger movement. See fdo bug 91135 + * box and that causes jumps. So we simply pretend it's a single + * touch touchpad with the BTN_TOOL bits. + * See https://bugzilla.redhat.com/show_bug.cgi?id=1235175 for an + * explanation. */ - if (tp->semi_mt || - device->model_flags & EVDEV_MODEL_HP_PAVILION_DM4_TOUCHPAD) { + if (tp->semi_mt && + (device->model_flags & EVDEV_MODEL_JUMPING_SEMI_MT)) { tp->num_slots = 1; tp->slot = 0; tp->has_mt = false; } - if (!tp->has_mt) - tp_disable_abs_mt(device); - ARRAY_FOR_EACH(max_touches, m) { if (libevdev_has_event_code(device->evdev, EV_KEY, @@ -2478,55 +1490,27 @@ } tp->ntouches = max(tp->num_slots, n_btn_tool_touches); - tp->touches = zalloc(tp->ntouches * sizeof(struct tp_touch)); + tp->touches = calloc(tp->ntouches, sizeof(struct tp_touch)); + if (!tp->touches) + return -1; for (i = 0; i < tp->ntouches; i++) tp_init_touch(tp, &tp->touches[i]); - tp_sync_slots(tp, device); - - /* Some touchpads don't reset BTN_TOOL_FINGER on touch up and only - * change to/from it when BTN_TOOL_DOUBLETAP is set. This causes us - * to ignore the first touches events until a two-finger gesture is - * performed. - */ - if (libevdev_get_event_value(device->evdev, EV_KEY, BTN_TOOL_FINGER)) - tp_fake_finger_set(tp, BTN_TOOL_FINGER, 1); - - return true; -} - -static uint32_t -tp_accel_config_get_profiles(struct libinput_device *libinput_device) -{ - return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE; -} - -static enum libinput_config_status -tp_accel_config_set_profile(struct libinput_device *libinput_device, - enum libinput_config_accel_profile profile) -{ - return LIBINPUT_CONFIG_STATUS_UNSUPPORTED; -} - -static enum libinput_config_accel_profile -tp_accel_config_get_profile(struct libinput_device *libinput_device) -{ - return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE; -} + /* Always sync the first touch so we get ABS_X/Y synced on + * single-touch touchpads */ + tp_sync_touch(tp, device, &tp->touches[0], 0); + for (i = 1; i < tp->num_slots; i++) + tp_sync_touch(tp, device, &tp->touches[i], i); -static enum libinput_config_accel_profile -tp_accel_config_get_default_profile(struct libinput_device *libinput_device) -{ - return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE; + return 0; } -static bool -tp_init_accel(struct tp_dispatch *tp) +static int +tp_init_accel(struct tp_dispatch *tp, double diagonal) { - struct evdev_device *device = tp->device; int res_x, res_y; - struct motion_filter *filter; + accel_profile_func_t profile; res_x = tp->device->abs.absinfo_x->resolution; res_y = tp->device->abs.absinfo_y->resolution; @@ -2540,29 +1524,16 @@ */ tp->accel.x_scale_coeff = (DEFAULT_MOUSE_DPI/25.4) / res_x; tp->accel.y_scale_coeff = (DEFAULT_MOUSE_DPI/25.4) / res_y; - tp->accel.xy_scale_coeff = 1.0 * res_x/res_y; - if (tp->device->model_flags & EVDEV_MODEL_LENOVO_X230 || - tp->device->model_flags & EVDEV_MODEL_LENOVO_X220_TOUCHPAD_FW81) - filter = create_pointer_accelerator_filter_lenovo_x230(tp->device->dpi); - else if (libevdev_get_id_bustype(device->evdev) == BUS_BLUETOOTH) - filter = create_pointer_accelerator_filter_touchpad(device->dpi, ms2us(50), ms2us(10)); + if (tp->device->model_flags & EVDEV_MODEL_LENOVO_X230) + profile = touchpad_lenovo_x230_accel_profile; else - filter = create_pointer_accelerator_filter_touchpad(device->dpi, 0, 0); + profile = touchpad_accel_profile_linear; - if (!filter) - return false; - - evdev_device_init_pointer_acceleration(tp->device, filter); + if (evdev_device_init_pointer_acceleration(tp->device, profile) == -1) + return -1; - /* we override the profile hooks for accel configuration with hooks - * that don't allow selection of profiles */ - device->pointer.config.get_profiles = tp_accel_config_get_profiles; - device->pointer.config.set_profile = tp_accel_config_set_profile; - device->pointer.config.get_profile = tp_accel_config_get_profile; - device->pointer.config.get_default_profile = tp_accel_config_get_default_profile; - - return true; + return 0; } static uint32_t @@ -2570,12 +1541,6 @@ { uint32_t methods = LIBINPUT_CONFIG_SCROLL_EDGE; - /* Any movement with more than one finger has random cursor - * jumps. Don't allow for 2fg scrolling on this device, see - * fdo bug 91135 */ - if (tp->device->model_flags & EVDEV_MODEL_HP_PAVILION_DM4_TOUCHPAD) - return LIBINPUT_CONFIG_SCROLL_EDGE; - if (tp->ntouches >= 2) methods |= LIBINPUT_CONFIG_SCROLL_2FG; @@ -2585,7 +1550,7 @@ static uint32_t tp_scroll_config_scroll_method_get_methods(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch; return tp_scroll_get_methods(tp); @@ -2595,7 +1560,7 @@ tp_scroll_config_scroll_method_set_method(struct libinput_device *device, enum libinput_config_scroll_method method) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch; uint64_t time = libinput_now(tp_libinput_context(tp)); @@ -2613,7 +1578,7 @@ static enum libinput_config_scroll_method tp_scroll_config_scroll_method_get_method(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch; return tp->scroll.method; @@ -2633,25 +1598,26 @@ method = LIBINPUT_CONFIG_SCROLL_EDGE; if ((methods & method) == 0) - evdev_log_bug_libinput(tp->device, - "invalid default scroll method %d\n", - method); + log_bug_libinput(tp_libinput_context(tp), + "Invalid default scroll method %d\n", + method); return method; } static enum libinput_config_scroll_method tp_scroll_config_scroll_method_get_default_method(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch; return tp_scroll_get_default_method(tp); } -static void +static int tp_init_scroll(struct tp_dispatch *tp, struct evdev_device *device) { - tp_edge_scroll_init(tp, device); + if (tp_edge_scroll_init(tp, device) != 0) + return -1; evdev_init_natural_scroll(device); @@ -2662,9 +1628,10 @@ tp->scroll.method = tp_scroll_get_default_method(tp); tp->device->base.config.scroll_method = &tp->scroll.config_method; - /* In mm for touchpads with valid resolution, see tp_init_accel() */ - tp->device->scroll.threshold = 0.0; - tp->device->scroll.direction_lock_threshold = 5.0; + /* In mm for touchpads with valid resolution, see tp_init_accel() */ + tp->device->scroll.threshold = 5.0; + + return 0; } static int @@ -2677,7 +1644,7 @@ tp_dwt_config_set(struct libinput_device *device, enum libinput_config_dwt_state enable) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch; switch(enable) { @@ -2696,7 +1663,7 @@ static enum libinput_config_dwt_state tp_dwt_config_get(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch; return tp->dwt.dwt_enabled ? @@ -2713,7 +1680,7 @@ static enum libinput_config_dwt_state tp_dwt_config_get_default(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch; return tp_dwt_default_enabled(tp) ? @@ -2721,28 +1688,12 @@ LIBINPUT_CONFIG_DWT_DISABLED; } -static inline bool -tp_is_tpkb_combo_below(struct evdev_device *device) -{ - const char *prop; - enum tpkbcombo_layout layout = TPKBCOMBO_LAYOUT_UNKNOWN; - - prop = udev_device_get_property_value(device->udev_device, - "LIBINPUT_ATTR_TPKBCOMBO_LAYOUT"); - if (!prop) - return false; - - return parse_tpkbcombo_layout_poperty(prop, &layout) && - layout == TPKBCOMBO_LAYOUT_BELOW; -} - -static void +static int tp_init_dwt(struct tp_dispatch *tp, struct evdev_device *device) { - if (device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD && - !tp_is_tpkb_combo_below(device)) - return; + if (tp_dwt_device_is_blacklisted(device)) + return 0; tp->dwt.config.is_available = tp_dwt_config_is_available; tp->dwt.config.set_enabled = tp_dwt_config_set; @@ -2751,191 +1702,85 @@ tp->dwt.dwt_enabled = tp_dwt_default_enabled(tp); device->base.config.dwt = &tp->dwt.config; - return; -} - -static inline void -tp_init_palmdetect_edge(struct tp_dispatch *tp, - struct evdev_device *device) -{ - double width, height; - struct phys_coords mm = { 0.0, 0.0 }; - struct device_coords edges; - - if (device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD && - !tp_is_tpkb_combo_below(device)) - return; - - evdev_device_get_size(device, &width, &height); - - /* Enable edge palm detection on touchpads >= 70 mm. Anything - smaller probably won't need it, until we find out it does */ - if (width < 70.0) - return; - - /* palm edges are 8% of the width on each side */ - mm.x = min(8, width * 0.08); - edges = evdev_device_mm_to_units(device, &mm); - tp->palm.left_edge = edges.x; - - mm.x = width - min(8, width * 0.08); - edges = evdev_device_mm_to_units(device, &mm); - tp->palm.right_edge = edges.x; - - if (!tp->buttons.has_topbuttons) { - /* top edge is 5% of the height */ - mm.y = height * 0.05; - edges = evdev_device_mm_to_units(device, &mm); - tp->palm.upper_edge = edges.y; - } + return 0; } static int -tp_read_palm_pressure_prop(struct tp_dispatch *tp, - const struct evdev_device *device) -{ - struct udev_device *udev_device = device->udev_device; - const char *prop; - int threshold; - const int default_palm_threshold = 130; - - prop = udev_device_get_property_value(udev_device, - "LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD"); - if (!prop) - return default_palm_threshold; - - threshold = parse_palm_pressure_property(prop); - - return threshold > 0 ? threshold : default_palm_threshold; -} - -static inline void -tp_init_palmdetect_pressure(struct tp_dispatch *tp, - struct evdev_device *device) -{ - if (!libevdev_has_event_code(device->evdev, EV_ABS, ABS_MT_PRESSURE)) { - tp->palm.use_pressure = false; - return; - } - - tp->palm.pressure_threshold = tp_read_palm_pressure_prop(tp, device); - tp->palm.use_pressure = true; - - evdev_log_debug(device, - "palm: pressure threshold is %d\n", - tp->palm.pressure_threshold); -} - -static inline void -tp_init_palmdetect_size(struct tp_dispatch *tp, - struct evdev_device *device) -{ - const char *prop; - int threshold; - - if (!tp->touch_size.use_touch_size) - return; - - prop = udev_device_get_property_value(device->udev_device, - "LIBINPUT_ATTR_PALM_SIZE_THRESHOLD"); - if (!prop) - return; - - threshold = parse_palm_size_property(prop); - if (threshold == 0) { - evdev_log_bug_client(device, - "palm: ignoring invalid threshold %s\n", - prop); - return; - } - - tp->palm.use_size = true; - tp->palm.size_threshold = threshold; -} - -static void tp_init_palmdetect(struct tp_dispatch *tp, struct evdev_device *device) { + int width, height; tp->palm.right_edge = INT_MAX; tp->palm.left_edge = INT_MIN; - tp->palm.upper_edge = INT_MIN; + tp->palm.vert_center = INT_MIN; - if (device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD && - !tp_is_tpkb_combo_below(device)) - return; + width = device->abs.dimensions.x; + height = device->abs.dimensions.y; + + /* Wacom doesn't have internal touchpads, + * Apple touchpads are always big enough to warrant palm detection */ + if (device->model_flags & EVDEV_MODEL_WACOM_TOUCHPAD) + return 0; + + /* Enable palm detection on touchpads >= 70 mm. Anything smaller + probably won't need it, until we find out it does */ + if (width/device->abs.absinfo_x->resolution < 70) + return 0; + + /* palm edges are 5% of the width on each side */ + tp->palm.right_edge = device->abs.absinfo_x->maximum - width * 0.05; + tp->palm.left_edge = device->abs.absinfo_x->minimum + width * 0.05; + tp->palm.vert_center = device->abs.absinfo_y->minimum + height/2; tp->palm.monitor_trackpoint = true; - if (libevdev_has_event_code(device->evdev, - EV_ABS, - ABS_MT_TOOL_TYPE)) - tp->palm.use_mt_tool = true; - - tp_init_palmdetect_edge(tp, device); - tp_init_palmdetect_pressure(tp, device); - tp_init_palmdetect_size(tp, device); + return 0; } -static void +static int tp_init_sendevents(struct tp_dispatch *tp, struct evdev_device *device) { - char timer_name[64]; - - snprintf(timer_name, - sizeof(timer_name), - "%s trackpoint", - evdev_device_get_sysname(device)); libinput_timer_init(&tp->palm.trackpoint_timer, tp_libinput_context(tp), - timer_name, tp_trackpoint_timeout, tp); - snprintf(timer_name, - sizeof(timer_name), - "%s keyboard", - evdev_device_get_sysname(device)); libinput_timer_init(&tp->dwt.keyboard_timer, tp_libinput_context(tp), - timer_name, tp_keyboard_timeout, tp); + return 0; } -static void +static int tp_init_thumb(struct tp_dispatch *tp) { struct evdev_device *device = tp->device; const struct input_absinfo *abs; double w = 0.0, h = 0.0; - struct device_coords edges; - struct phys_coords mm = { 0.0, 0.0 }; int xres, yres; + int ymax; double threshold; if (!tp->buttons.is_clickpad) - return; + return 0; /* if the touchpad is less than 50mm high, skip thumb detection. * it's too small to meaningfully interact with a thumb on the * touchpad */ evdev_device_get_size(device, &w, &h); if (h < 50) - return; + return 0; tp->thumb.detect_thumbs = true; tp->thumb.threshold = INT_MAX; /* detect thumbs by pressure in the bottom 15mm, detect thumbs by * lingering in the bottom 8mm */ - mm.y = h * 0.85; - edges = evdev_device_mm_to_units(device, &mm); - tp->thumb.upper_thumb_line = edges.y; - - mm.y = h * 0.92; - edges = evdev_device_mm_to_units(device, &mm); - tp->thumb.lower_thumb_line = edges.y; + ymax = tp->device->abs.absinfo_y->maximum; + yres = tp->device->abs.absinfo_y->resolution; + tp->thumb.upper_thumb_line = ymax - yres * 15; + tp->thumb.lower_thumb_line = ymax - yres * 8; abs = libevdev_get_abs_info(device->evdev, ABS_MT_PRESSURE); if (!abs) @@ -2957,16 +1802,20 @@ tp->thumb.threshold = max(100, threshold); out: - evdev_log_debug(device, - "thumb: enabled thumb detection%s\n", - tp->thumb.threshold != INT_MAX ? " (+pressure)" : ""); + log_debug(tp_libinput_context(tp), + "thumb: enabled thumb detection%s on '%s'\n", + tp->thumb.threshold != INT_MAX ? " (+pressure)" : "", + device->devname); + + return 0; } -static bool -tp_pass_sanity_check(struct tp_dispatch *tp, - struct evdev_device *device) +static int +tp_sanity_check(struct tp_dispatch *tp, + struct evdev_device *device) { struct libevdev *evdev = device->evdev; + struct libinput *libinput = tp_libinput_context(tp); if (!libevdev_has_event_code(evdev, EV_ABS, ABS_X)) goto error; @@ -2977,15 +1826,16 @@ if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_FINGER)) goto error; - return true; + return 0; error: - evdev_log_bug_kernel(device, - "device failed touchpad sanity checks\n"); - return false; + log_bug_kernel(libinput, + "device %s failed touchpad sanity checks\n", + device->devname); + return -1; } -static void +static int tp_init_default_resolution(struct tp_dispatch *tp, struct evdev_device *device) { @@ -2993,8 +1843,8 @@ touchpad_height_mm = 50; int xres, yres; - if (!device->abs.is_fake_resolution) - return; + if (!device->abs.fake_resolution) + return 0 ; /* we only get here if * - the touchpad provides no resolution @@ -3005,10 +1855,11 @@ * are old ones, so let's assume a small touchpad size and assume * that. */ - evdev_log_info(device, - "no resolution or size hints, assuming a size of %dx%dmm\n", - touchpad_width_mm, - touchpad_height_mm); + log_info(tp_libinput_context(tp), + "%s: no resolution or size hints, assuming a size of %dx%dmm\n", + device->devname, + touchpad_width_mm, + touchpad_height_mm); xres = device->abs.dimensions.x/touchpad_width_mm; yres = device->abs.dimensions.y/touchpad_height_mm; @@ -3016,184 +1867,82 @@ libevdev_set_abs_resolution(device->evdev, ABS_Y, yres); libevdev_set_abs_resolution(device->evdev, ABS_MT_POSITION_X, xres); libevdev_set_abs_resolution(device->evdev, ABS_MT_POSITION_Y, yres); - device->abs.is_fake_resolution = false; -} - -static inline void -tp_init_hysteresis(struct tp_dispatch *tp) -{ - int res_x, res_y; - - res_x = tp->device->abs.absinfo_x->resolution; - res_y = tp->device->abs.absinfo_y->resolution; - tp->hysteresis.margin.x = res_x/2; - tp->hysteresis.margin.y = res_y/2; - tp->hysteresis.enabled = false; -} - -static void -tp_init_pressure(struct tp_dispatch *tp, - struct evdev_device *device) -{ - const struct input_absinfo *abs; - unsigned int code = ABS_PRESSURE; - const char *prop; - int hi, lo; - - if (tp->has_mt) - code = ABS_MT_PRESSURE; + device->abs.fake_resolution = 0; - if (!libevdev_has_event_code(device->evdev, EV_ABS, code)) { - tp->pressure.use_pressure = false; - return; - } - - abs = libevdev_get_abs_info(device->evdev, code); - assert(abs); - - prop = udev_device_get_property_value(device->udev_device, - "LIBINPUT_ATTR_PRESSURE_RANGE"); - if (prop) { - if (!parse_range_property(prop, &hi, &lo)) { - evdev_log_bug_client(device, - "discarding invalid pressure range '%s'\n", - prop); - return; - } - - if (hi == 0 && lo == 0) { - evdev_log_info(device, - "pressure-based touch detection disabled\n"); - return; - } - } else { - unsigned int range = abs->maximum - abs->minimum; - - /* Approximately the synaptics defaults */ - hi = abs->minimum + 0.12 * range; - lo = abs->minimum + 0.10 * range; - } - - if (hi > abs->maximum || hi < abs->minimum || - lo > abs->maximum || lo < abs->minimum) { - evdev_log_bug_libinput(device, - "discarding out-of-bounds pressure range %d:%d\n", - hi, lo); - return; - } - - tp->pressure.use_pressure = true; - tp->pressure.high = hi; - tp->pressure.low = lo; - - evdev_log_debug(device, - "using pressure-based touch detection (%d:%d)\n", - lo, - hi); -} - -static bool -tp_init_touch_size(struct tp_dispatch *tp, - struct evdev_device *device) -{ - const char *prop; - int lo, hi; - - if (!libevdev_has_event_code(device->evdev, - EV_ABS, - ABS_MT_TOUCH_MAJOR)) { - return false; - } - - if (libevdev_get_num_slots(device->evdev) < 5) { - evdev_log_bug_libinput(device, - "Expected 5+ slots for touch size detection\n"); - return false; - } - - prop = udev_device_get_property_value(device->udev_device, - "LIBINPUT_ATTR_TOUCH_SIZE_RANGE"); - if (!prop) - return false; - - if (!parse_range_property(prop, &hi, &lo)) { - evdev_log_bug_client(device, - "discarding invalid touch size range '%s'\n", - prop); - return false; - } - - if (hi == 0 && lo == 0) { - evdev_log_info(device, - "touch size based touch detection disabled\n"); - return false; - } - - /* Thresholds apply for both major or minor */ - tp->touch_size.low = lo; - tp->touch_size.high = hi; - tp->touch_size.use_touch_size = true; - - evdev_log_debug(device, "using size-based touch detection\n"); - - return true; + return 0; } static int tp_init(struct tp_dispatch *tp, struct evdev_device *device) { - bool use_touch_size = false; + int width, height; + double diagonal; + int res_x, res_y; - tp->base.dispatch_type = DISPATCH_TOUCHPAD; tp->base.interface = &tp_interface; tp->device = device; - if (!tp_pass_sanity_check(tp, device)) - return false; + if (tp_sanity_check(tp, device) != 0) + return -1; - tp_init_default_resolution(tp, device); + if (tp_init_default_resolution(tp, device) != 0) + return -1; - if (!tp_init_slots(tp, device)) - return false; + if (tp_init_slots(tp, device) != 0) + return -1; + + res_x = tp->device->abs.absinfo_x->resolution; + res_y = tp->device->abs.absinfo_y->resolution; + width = device->abs.dimensions.x; + height = device->abs.dimensions.y; + diagonal = sqrt(width*width + height*height); - evdev_device_init_abs_range_warnings(device); + tp->reports_distance = libevdev_has_event_code(device->evdev, + EV_ABS, + ABS_MT_DISTANCE); - if (device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD) - use_touch_size = tp_init_touch_size(tp, device); + tp->hysteresis_margin.x = res_x/2; + tp->hysteresis_margin.y = res_y/2; - if (!use_touch_size) - tp_init_pressure(tp, device); + if (tp_init_accel(tp, diagonal) != 0) + return -1; - /* Set the dpi to that of the x axis, because that's what we normalize - to when needed*/ - device->dpi = device->abs.absinfo_x->resolution * 25.4; + if (tp_init_tap(tp) != 0) + return -1; - tp_init_hysteresis(tp); + if (tp_init_buttons(tp, device) != 0) + return -1; - if (!tp_init_accel(tp)) - return false; + if (tp_init_dwt(tp, device) != 0) + return -1; - tp_init_tap(tp); - tp_init_buttons(tp, device); - tp_init_dwt(tp, device); - tp_init_palmdetect(tp, device); - tp_init_sendevents(tp, device); - tp_init_scroll(tp, device); - tp_init_gesture(tp); - tp_init_thumb(tp); + if (tp_init_palmdetect(tp, device) != 0) + return -1; + + if (tp_init_sendevents(tp, device) != 0) + return -1; + + if (tp_init_scroll(tp, device) != 0) + return -1; + + if (tp_init_gesture(tp) != 0) + return -1; + + if (tp_init_thumb(tp) != 0) + return -1; device->seat_caps |= EVDEV_DEVICE_POINTER; if (tp->gesture.enabled) device->seat_caps |= EVDEV_DEVICE_GESTURE; - return true; + return 0; } static uint32_t tp_sendevents_get_modes(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; uint32_t modes = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED; if (evdev->tags & EVDEV_TAG_INTERNAL_TOUCHPAD) @@ -3209,7 +1958,7 @@ struct libinput_device *dev; list_for_each(dev, &device->base.seat->devices_list, link) { - struct evdev_device *d = evdev_device(dev); + struct evdev_device *d = (struct evdev_device*)dev; if (d->tags & EVDEV_TAG_EXTERNAL_MOUSE) { tp_suspend(tp, device); return; @@ -3221,7 +1970,7 @@ tp_sendevents_set_mode(struct libinput_device *device, enum libinput_config_send_events_mode mode) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch; /* DISABLED overrides any DISABLED_ON_ */ @@ -3254,7 +2003,7 @@ static enum libinput_config_send_events_mode tp_sendevents_get_mode(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device*)device; struct tp_dispatch *dispatch = (struct tp_dispatch*)evdev->dispatch; return dispatch->sendevents.current_mode; @@ -3283,17 +2032,52 @@ device->left_handed.enabled = device->left_handed.want_enabled; } +struct model_lookup_t { + uint16_t vendor; + uint16_t product_start; + uint16_t product_end; + enum touchpad_model model; +}; + +static struct model_lookup_t model_lookup_table[] = { + { 0x0002, 0x0007, 0x0007, MODEL_SYNAPTICS }, + { 0x0002, 0x0008, 0x0008, MODEL_ALPS }, + { 0x0002, 0x000e, 0x000e, MODEL_ELANTECH }, + { 0x05ac, 0, 0x0222, MODEL_APPLETOUCH }, + { 0x05ac, 0x0223, 0x0228, MODEL_UNIBODY_MACBOOK }, + { 0x05ac, 0x0229, 0x022b, MODEL_APPLETOUCH }, + { 0x05ac, 0x022c, 0xffff, MODEL_UNIBODY_MACBOOK }, + { 0, 0, 0, 0 } +}; + +static enum touchpad_model +tp_get_model(struct evdev_device *device) +{ + struct model_lookup_t *lookup; + uint16_t vendor = libevdev_get_id_vendor(device->evdev); + uint16_t product = libevdev_get_id_product(device->evdev); + + for (lookup = model_lookup_table; lookup->vendor; lookup++) { + if (lookup->vendor == vendor && + lookup->product_start <= product && + product <= lookup->product_end) + return lookup->model; + } + return MODEL_UNKNOWN; +} + struct evdev_dispatch * evdev_mt_touchpad_create(struct evdev_device *device) { struct tp_dispatch *tp; - bool want_left_handed = true; - - evdev_tag_touchpad(device, device->udev_device); tp = zalloc(sizeof *tp); + if (!tp) + return NULL; + + tp->model = tp_get_model(device); - if (!tp_init(tp, device)) { + if (tp_init(tp, device) != 0) { tp_interface_destroy(&tp->base); return NULL; } @@ -3306,10 +2090,7 @@ tp->sendevents.config.get_mode = tp_sendevents_get_mode; tp->sendevents.config.get_default_mode = tp_sendevents_get_default_mode; - if (device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD_ONEBUTTON) - want_left_handed = false; - if (want_left_handed) - evdev_init_left_handed(device, tp_change_to_left_handed); + evdev_init_left_handed(device, tp_change_to_left_handed); - return &tp->base; + return &tp->base; } diff -Nru libinput-1.10.3/src/evdev-mt-touchpad-edge-scroll.c libinput-0.21.0/src/evdev-mt-touchpad-edge-scroll.c --- libinput-1.10.3/src/evdev-mt-touchpad-edge-scroll.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-mt-touchpad-edge-scroll.c 2015-08-03 04:55:20.000000000 +0000 @@ -73,7 +73,7 @@ } uint32_t -tp_touch_get_edge(const struct tp_dispatch *tp, const struct tp_touch *t) +tp_touch_get_edge(struct tp_dispatch *tp, struct tp_touch *t) { uint32_t edge = EDGE_NONE; @@ -103,7 +103,7 @@ return; libinput_timer_set(&t->scroll.timer, - t->time + DEFAULT_SCROLL_LOCK_TIMEOUT); + t->millis + DEFAULT_SCROLL_LOCK_TIMEOUT); } static void @@ -137,6 +137,8 @@ struct tp_touch *t, enum scroll_event event) { + struct libinput *libinput = tp_libinput_context(tp); + switch (event) { case SCROLL_EVENT_TOUCH: if (tp_touch_get_edge(tp, t)) { @@ -151,7 +153,7 @@ case SCROLL_EVENT_RELEASE: case SCROLL_EVENT_TIMEOUT: case SCROLL_EVENT_POSTED: - evdev_log_bug_libinput(tp->device, + log_bug_libinput(libinput, "unexpected scroll event %d in none state\n", event); break; @@ -163,11 +165,13 @@ struct tp_touch *t, enum scroll_event event) { + struct libinput *libinput = tp_libinput_context(tp); + switch (event) { case SCROLL_EVENT_TOUCH: - evdev_log_bug_libinput(tp->device, - "unexpected scroll event %d in edge new state\n", - event); + log_bug_libinput(libinput, + "unexpected scroll event %d in edge new state\n", + event); break; case SCROLL_EVENT_MOTION: t->scroll.edge &= tp_touch_get_edge(tp, t); @@ -190,10 +194,12 @@ struct tp_touch *t, enum scroll_event event) { + struct libinput *libinput = tp_libinput_context(tp); + switch (event) { case SCROLL_EVENT_TOUCH: case SCROLL_EVENT_TIMEOUT: - evdev_log_bug_libinput(tp->device, + log_bug_libinput(libinput, "unexpected scroll event %d in edge state\n", event); break; @@ -219,11 +225,13 @@ struct tp_touch *t, enum scroll_event event) { + struct libinput *libinput = tp_libinput_context(tp); + switch (event) { case SCROLL_EVENT_TOUCH: case SCROLL_EVENT_TIMEOUT: case SCROLL_EVENT_POSTED: - evdev_log_bug_libinput(tp->device, + log_bug_libinput(libinput, "unexpected scroll event %d in area state\n", event); break; @@ -240,6 +248,7 @@ struct tp_touch *t, enum scroll_event event) { + struct libinput *libinput = tp_libinput_context(tp); enum tp_edge_scroll_touch_state current = t->scroll.edge_state; switch (current) { @@ -257,11 +266,11 @@ break; } - evdev_log_debug(tp->device, - "edge state: %s → %s → %s\n", - edge_state_to_str(current), - edge_event_to_str(event), - edge_state_to_str(t->scroll.edge_state)); + log_debug(libinput, + "edge state: %s → %s → %s\n", + edge_state_to_str(current), + edge_event_to_str(event), + edge_state_to_str(t->scroll.edge_state)); } static void @@ -272,52 +281,27 @@ tp_edge_scroll_handle_event(t->tp, t, SCROLL_EVENT_TIMEOUT); } -void +int tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device) { struct tp_touch *t; - double width, height; - bool want_horiz_scroll = true; - struct device_coords edges; - struct phys_coords mm = { 0.0, 0.0 }; - int i; - - evdev_device_get_size(device, &width, &height); - /* Touchpads smaller than 40mm are not tall enough to have a - horizontal scroll area, it takes too much space away. But - clickpads have enough space here anyway because of the - software button area (and all these tiny clickpads were built - when software buttons were a thing, e.g. Lenovo *20 series) - */ - if (!tp->buttons.is_clickpad) - want_horiz_scroll = (height >= 40); + int edge_width, edge_height; /* 7mm edge size */ - mm.x = width - 7; - mm.y = height - 7; - edges = evdev_device_mm_to_units(device, &mm); - - tp->scroll.right_edge = edges.x; - if (want_horiz_scroll) - tp->scroll.bottom_edge = edges.y; - else - tp->scroll.bottom_edge = INT_MAX; + edge_width = device->abs.absinfo_x->resolution * 7; + edge_height = device->abs.absinfo_y->resolution * 7; - i = 0; - tp_for_each_touch(tp, t) { - char timer_name[64]; + tp->scroll.right_edge = device->abs.absinfo_x->maximum - edge_width; + tp->scroll.bottom_edge = device->abs.absinfo_y->maximum - edge_height; - snprintf(timer_name, - sizeof(timer_name), - "%s (%d) edgescroll", - evdev_device_get_sysname(device), - i); + tp_for_each_touch(tp, t) { t->scroll.direction = -1; libinput_timer_init(&t->scroll.timer, tp_libinput_context(tp), - timer_name, tp_edge_scroll_handle_timeout, t); } + + return 0; } void @@ -325,10 +309,8 @@ { struct tp_touch *t; - tp_for_each_touch(tp, t) { + tp_for_each_touch(tp, t) libinput_timer_cancel(&t->scroll.timer); - libinput_timer_destroy(&t->scroll.timer); - } } void @@ -336,18 +318,6 @@ { struct tp_touch *t; - if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_EDGE) { - tp_for_each_touch(tp, t) { - if (t->state == TOUCH_BEGIN) - t->scroll.edge_state = - EDGE_SCROLL_TOUCH_STATE_AREA; - else if (t->state == TOUCH_END) - t->scroll.edge_state = - EDGE_SCROLL_TOUCH_STATE_NONE; - } - return; - } - tp_for_each_touch(tp, t) { if (!t->dirty) continue; @@ -362,13 +332,6 @@ case TOUCH_UPDATE: tp_edge_scroll_handle_event(tp, t, SCROLL_EVENT_MOTION); break; - case TOUCH_MAYBE_END: - /* This shouldn't happen we transfer to TOUCH_END - * before processing state */ - evdev_log_debug(tp->device, - "touch unexpected state %d\n", - t->state); - /* fallthrough */ case TOUCH_END: tp_edge_scroll_handle_event(tp, t, SCROLL_EVENT_RELEASE); break; @@ -379,22 +342,22 @@ int tp_edge_scroll_post_events(struct tp_dispatch *tp, uint64_t time) { - struct evdev_device *device = tp->device; + struct libinput_device *device = &tp->device->base; struct tp_touch *t; enum libinput_pointer_axis axis; double *delta; - struct device_coords raw; - struct device_float_coords fraw; struct normalized_coords normalized, tmp; const struct normalized_coords zero = { 0.0, 0.0 }; const struct discrete_coords zero_discrete = { 0.0, 0.0 }; + if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_EDGE) + return 0; + tp_for_each_touch(tp, t) { if (!t->dirty) continue; - if (t->palm.state != PALM_NONE || - t->thumb.state == THUMB_STATE_YES) + if (t->palm.state != PALM_NONE) continue; /* only scroll with the finger in the previous edge */ @@ -406,7 +369,7 @@ case EDGE_NONE: if (t->scroll.direction != -1) { /* Send stop scroll event */ - evdev_notify_axis(device, time, + pointer_notify_axis(device, time, AS_MASK(t->scroll.direction), LIBINPUT_POINTER_AXIS_SOURCE_FINGER, &zero, @@ -426,16 +389,13 @@ continue; /* Don't know direction yet, skip */ } - raw = tp_get_delta(t); - fraw.x = raw.x; - fraw.y = raw.y; - /* scroll is not accelerated */ - normalized = tp_filter_motion_unaccelerated(tp, &fraw, time); + normalized = tp_get_delta(t); + normalized = tp_filter_motion(tp, &normalized, time); switch (t->scroll.edge_state) { case EDGE_SCROLL_TOUCH_STATE_NONE: case EDGE_SCROLL_TOUCH_STATE_AREA: - evdev_log_bug_libinput(device, + log_bug_libinput(device->seat->libinput, "unexpected scroll state %d\n", t->scroll.edge_state); break; @@ -456,11 +416,11 @@ if (*delta == 0.0) continue; - evdev_notify_axis(device, time, - AS_MASK(axis), - LIBINPUT_POINTER_AXIS_SOURCE_FINGER, - &normalized, - &zero_discrete); + pointer_notify_axis(device, time, + AS_MASK(axis), + LIBINPUT_POINTER_AXIS_SOURCE_FINGER, + &normalized, + &zero_discrete); t->scroll.direction = axis; tp_edge_scroll_handle_event(tp, t, SCROLL_EVENT_POSTED); @@ -472,14 +432,14 @@ void tp_edge_scroll_stop_events(struct tp_dispatch *tp, uint64_t time) { - struct evdev_device *device = tp->device; + struct libinput_device *device = &tp->device->base; struct tp_touch *t; const struct normalized_coords zero = { 0.0, 0.0 }; const struct discrete_coords zero_discrete = { 0.0, 0.0 }; tp_for_each_touch(tp, t) { if (t->scroll.direction != -1) { - evdev_notify_axis(device, time, + pointer_notify_axis(device, time, AS_MASK(t->scroll.direction), LIBINPUT_POINTER_AXIS_SOURCE_FINGER, &zero, @@ -494,8 +454,7 @@ } int -tp_edge_scroll_touch_active(const struct tp_dispatch *tp, - const struct tp_touch *t) +tp_edge_scroll_touch_active(struct tp_dispatch *tp, struct tp_touch *t) { return t->scroll.edge_state == EDGE_SCROLL_TOUCH_STATE_AREA; } diff -Nru libinput-1.10.3/src/evdev-mt-touchpad-gestures.c libinput-0.21.0/src/evdev-mt-touchpad-gestures.c --- libinput-1.10.3/src/evdev-mt-touchpad-gestures.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-mt-touchpad-gestures.c 2015-08-03 21:42:14.000000000 +0000 @@ -30,62 +30,56 @@ #include "evdev-mt-touchpad.h" #define DEFAULT_GESTURE_SWITCH_TIMEOUT ms2us(100) -#define DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT ms2us(150) +#define DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT ms2us(500) static inline const char* -gesture_state_to_str(enum tp_gesture_state state) +gesture_state_to_str(enum tp_gesture_2fg_state state) { switch (state) { - CASE_RETURN_STRING(GESTURE_STATE_NONE); - CASE_RETURN_STRING(GESTURE_STATE_UNKNOWN); - CASE_RETURN_STRING(GESTURE_STATE_SCROLL); - CASE_RETURN_STRING(GESTURE_STATE_PINCH); - CASE_RETURN_STRING(GESTURE_STATE_SWIPE); + CASE_RETURN_STRING(GESTURE_2FG_STATE_NONE); + CASE_RETURN_STRING(GESTURE_2FG_STATE_UNKNOWN); + CASE_RETURN_STRING(GESTURE_2FG_STATE_SCROLL); + CASE_RETURN_STRING(GESTURE_2FG_STATE_PINCH); } return NULL; } -static struct device_float_coords +static struct normalized_coords tp_get_touches_delta(struct tp_dispatch *tp, bool average) { struct tp_touch *t; - unsigned int i, nactive = 0; - struct device_float_coords delta = {0.0, 0.0}; + unsigned int i, nchanged = 0; + struct normalized_coords normalized; + struct normalized_coords delta = {0.0, 0.0}; for (i = 0; i < tp->num_slots; i++) { t = &tp->touches[i]; - if (!tp_touch_active(tp, t)) - continue; - - nactive++; - - if (t->dirty) { - struct device_coords d; - - d = tp_get_delta(t); + if (tp_touch_active(tp, t) && t->dirty) { + nchanged++; + normalized = tp_get_delta(t); - delta.x += d.x; - delta.y += d.y; + delta.x += normalized.x; + delta.y += normalized.y; } } - if (!average || nactive == 0) + if (!average || nchanged == 0) return delta; - delta.x /= nactive; - delta.y /= nactive; + delta.x /= nchanged; + delta.y /= nchanged; return delta; } -static inline struct device_float_coords +static inline struct normalized_coords tp_get_combined_touches_delta(struct tp_dispatch *tp) { return tp_get_touches_delta(tp, false); } -static inline struct device_float_coords +static inline struct normalized_coords tp_get_average_touches_delta(struct tp_dispatch *tp) { return tp_get_touches_delta(tp, true); @@ -94,74 +88,77 @@ static void tp_gesture_start(struct tp_dispatch *tp, uint64_t time) { + struct libinput *libinput = tp->device->base.seat->libinput; const struct normalized_coords zero = { 0.0, 0.0 }; if (tp->gesture.started) return; - switch (tp->gesture.state) { - case GESTURE_STATE_NONE: - case GESTURE_STATE_UNKNOWN: - evdev_log_bug_libinput(tp->device, - "%s in unknown gesture mode\n", - __func__); - break; - case GESTURE_STATE_SCROLL: - /* NOP */ - break; - case GESTURE_STATE_PINCH: - gesture_notify_pinch(&tp->device->base, time, - LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, - tp->gesture.finger_count, - &zero, &zero, 1.0, 0.0); + switch (tp->gesture.finger_count) { + case 2: + switch (tp->gesture.twofinger_state) { + case GESTURE_2FG_STATE_NONE: + case GESTURE_2FG_STATE_UNKNOWN: + log_bug_libinput(libinput, + "%s in unknown gesture mode\n", + __func__); + break; + case GESTURE_2FG_STATE_SCROLL: + /* NOP */ + break; + case GESTURE_2FG_STATE_PINCH: + gesture_notify_pinch(&tp->device->base, time, + LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, + &zero, &zero, 1.0, 0.0); + break; + } break; - case GESTURE_STATE_SWIPE: + case 3: + case 4: gesture_notify_swipe(&tp->device->base, time, LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN, tp->gesture.finger_count, &zero, &zero); break; } - tp->gesture.started = true; } static void tp_gesture_post_pointer_motion(struct tp_dispatch *tp, uint64_t time) { + struct normalized_coords delta, unaccel; struct device_float_coords raw; - struct normalized_coords delta; /* When a clickpad is clicked, combine motion of all active touches */ if (tp->buttons.is_clickpad && tp->buttons.state) - raw = tp_get_combined_touches_delta(tp); + unaccel = tp_get_combined_touches_delta(tp); else - raw = tp_get_average_touches_delta(tp); - - delta = tp_filter_motion(tp, &raw, time); + unaccel = tp_get_average_touches_delta(tp); - if (!normalized_is_zero(delta) || !device_float_is_zero(raw)) { - struct device_float_coords unaccel; + delta = tp_filter_motion(tp, &unaccel, time); - unaccel = tp_scale_to_xaxis(tp, raw); + if (!normalized_is_zero(delta) || !normalized_is_zero(unaccel)) { + raw = tp_unnormalize_for_xaxis(tp, unaccel); pointer_notify_motion(&tp->device->base, time, &delta, - &unaccel); + &raw); } } static unsigned int -tp_gesture_get_active_touches(const struct tp_dispatch *tp, +tp_gesture_get_active_touches(struct tp_dispatch *tp, struct tp_touch **touches, unsigned int count) { - unsigned int n = 0; + unsigned int i, n = 0; struct tp_touch *t; memset(touches, 0, count * sizeof(struct tp_touch *)); - tp_for_each_touch(tp, t) { + for (i = 0; i < tp->ntouches; i++) { + t = &tp->touches[i]; if (tp_touch_active(tp, t)) { touches[n++] = t; if (n == count) @@ -182,23 +179,32 @@ return n; } -static uint32_t -tp_gesture_get_direction(struct tp_dispatch *tp, struct tp_touch *touch, - unsigned int nfingers) +static int +tp_gesture_get_direction(struct tp_dispatch *tp, struct tp_touch *touch) { - struct phys_coords mm; + struct normalized_coords normalized; struct device_float_coords delta; - double move_threshold = 1.0; /* mm */ + double move_threshold; - move_threshold *= (nfingers - 1); + /* + * Semi-mt touchpads have somewhat inaccurate coordinates when + * 2 fingers are down, so use a slightly larger threshold. + * Elantech semi-mt touchpads are accurate enough though. + */ + if (tp->semi_mt && + (tp->device->model_flags & EVDEV_MODEL_ELANTECH_TOUCHPAD) == 0) + move_threshold = TP_MM_TO_DPI_NORMALIZED(4); + else + move_threshold = TP_MM_TO_DPI_NORMALIZED(2); delta = device_delta(touch->point, touch->gesture.initial); - mm = tp_phys_delta(tp, delta); - if (length_in_mm(mm) < move_threshold) + normalized = tp_normalize_delta(tp, delta); + + if (normalized_length(normalized) < move_threshold) return UNDEFINED_DIRECTION; - return phys_get_direction(mm); + return normalized_get_direction(normalized); } static void @@ -215,7 +221,11 @@ delta = device_delta(first->point, second->point); normalized = tp_normalize_delta(tp, delta); *distance = normalized_length(normalized); - *angle = atan2(normalized.y, normalized.x) * 180.0 / M_PI; + + if (!tp->semi_mt) + *angle = atan2(normalized.y, normalized.x) * 180.0 / M_PI; + else + *angle = 0.0; *center = device_average(first->point, second->point); } @@ -235,166 +245,93 @@ tp->device->scroll.buildup = tp_normalize_delta(tp, average); } -static enum tp_gesture_state -tp_gesture_handle_state_none(struct tp_dispatch *tp, uint64_t time) +static enum tp_gesture_2fg_state +tp_gesture_twofinger_handle_state_none(struct tp_dispatch *tp, uint64_t time) { struct tp_touch *first, *second; - struct tp_touch *touches[4]; - unsigned int ntouches; - unsigned int i; - - ntouches = tp_gesture_get_active_touches(tp, touches, 4); - if (ntouches < 2) - return GESTURE_STATE_NONE; - - if (!tp->gesture.enabled) { - if (ntouches == 2) - return GESTURE_STATE_SCROLL; - else - return GESTURE_STATE_NONE; - } - - first = touches[0]; - second = touches[1]; - - /* For 3+ finger gestures we cheat. A human hand's finger - * arrangement means that for a 3 or 4 finger swipe gesture, the - * fingers are roughly arranged in a horizontal line. - * They will all move in the same direction, so we can simply look - * at the left and right-most ones only. If we have fake touches, we - * just take the left/right-most real touch position, since the fake - * touch has the same location as one of those. - * - * For a 3 or 4 finger pinch gesture, 2 or 3 fingers are roughly in - * a horizontal line, with the thumb below and left (right-handed - * users) or right (left-handed users). Again, the row of non-thumb - * fingers moves identically so we can look at the left and - * right-most only and then treat it like a two-finger - * gesture. - */ - if (ntouches > 2) { - second = touches[0]; - - for (i = 1; i < ntouches && i < tp->num_slots; i++) { - if (touches[i]->point.x < first->point.x) - first = touches[i]; - else if (touches[i]->point.x > second->point.x) - second = touches[i]; - } - if (first == second) - return GESTURE_STATE_NONE; + if (tp_gesture_get_active_touches(tp, tp->gesture.touches, 2) != 2) + return GESTURE_2FG_STATE_NONE; - } + first = tp->gesture.touches[0]; + second = tp->gesture.touches[1]; tp->gesture.initial_time = time; first->gesture.initial = first->point; second->gesture.initial = second->point; - tp->gesture.touches[0] = first; - tp->gesture.touches[1] = second; - return GESTURE_STATE_UNKNOWN; -} - -static inline int -tp_gesture_same_directions(int dir1, int dir2) -{ - /* - * In some cases (semi-mt touchpads) we may seen one finger move - * e.g. N/NE and the other W/NW so we not only check for overlapping - * directions, but also for neighboring bits being set. - * The ((dira & 0x80) && (dirb & 0x01)) checks are to check for bit 0 - * and 7 being set as they also represent neighboring directions. - */ - return ((dir1 | (dir1 >> 1)) & dir2) || - ((dir2 | (dir2 >> 1)) & dir1) || - ((dir1 & 0x80) && (dir2 & 0x01)) || - ((dir2 & 0x80) && (dir1 & 0x01)); + return GESTURE_2FG_STATE_UNKNOWN; } -static inline void -tp_gesture_init_pinch(struct tp_dispatch *tp) -{ - tp_gesture_get_pinch_info(tp, - &tp->gesture.initial_distance, - &tp->gesture.angle, - &tp->gesture.center); - tp->gesture.prev_scale = 1.0; -} - -static enum tp_gesture_state -tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time) +static enum tp_gesture_2fg_state +tp_gesture_twofinger_handle_state_unknown(struct tp_dispatch *tp, uint64_t time) { struct tp_touch *first = tp->gesture.touches[0], *second = tp->gesture.touches[1]; - uint32_t dir1, dir2; - int yres = tp->device->abs.absinfo_y->resolution; - int vert_distance; + int dir1, dir2; + /* if fingers stay unmoving for a while, assume (slow) scroll */ if (time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) { - /* for two-finger gestures, if the fingers stay unmoving for a - * while, assume (slow) scroll */ - if (tp->gesture.finger_count == 2) { - tp_gesture_set_scroll_buildup(tp); - return GESTURE_STATE_SCROLL; - /* more fingers than slots, don't bother with pinch, always - * assume swipe */ - } else if (tp->gesture.finger_count > tp->num_slots) { - return GESTURE_STATE_SWIPE; - } - - /* for 3+ finger gestures, check if one finger is > 20mm - below the others */ - vert_distance = abs(first->point.y - second->point.y); - if (vert_distance > 20 * yres && - tp->gesture.enabled) { - tp_gesture_init_pinch(tp); - return GESTURE_STATE_PINCH; - } else { - return GESTURE_STATE_SWIPE; - } + tp_gesture_set_scroll_buildup(tp); + return GESTURE_2FG_STATE_SCROLL; } /* Else wait for both fingers to have moved */ - dir1 = tp_gesture_get_direction(tp, first, tp->gesture.finger_count); - dir2 = tp_gesture_get_direction(tp, second, tp->gesture.finger_count); + dir1 = tp_gesture_get_direction(tp, first); + dir2 = tp_gesture_get_direction(tp, second); if (dir1 == UNDEFINED_DIRECTION || dir2 == UNDEFINED_DIRECTION) - return GESTURE_STATE_UNKNOWN; + return GESTURE_2FG_STATE_UNKNOWN; - /* If both touches are moving in the same direction assume - * scroll or swipe */ - if (tp->gesture.finger_count > tp->num_slots || - tp_gesture_same_directions(dir1, dir2)) { - if (tp->gesture.finger_count == 2) { - tp_gesture_set_scroll_buildup(tp); - return GESTURE_STATE_SCROLL; - } else if (tp->gesture.enabled) { - return GESTURE_STATE_SWIPE; - } - } else { - tp_gesture_init_pinch(tp); - return GESTURE_STATE_PINCH; + /* + * If both touches are moving in the same direction assume scroll. + * + * In some cases (semi-mt touchpads) We may seen one finger move + * e.g. N/NE and the other W/NW so we not only check for overlapping + * directions, but also for neighboring bits being set. + * The ((dira & 0x80) && (dirb & 0x01)) checks are to check for bit 0 + * and 7 being set as they also represent neighboring directions. + */ + if (((dir1 | (dir1 >> 1)) & dir2) || + ((dir2 | (dir2 >> 1)) & dir1) || + ((dir1 & 0x80) && (dir2 & 0x01)) || + ((dir2 & 0x80) && (dir1 & 0x01))) { + tp_gesture_set_scroll_buildup(tp); + return GESTURE_2FG_STATE_SCROLL; + } else if (tp->gesture.enabled) { + tp_gesture_get_pinch_info(tp, + &tp->gesture.initial_distance, + &tp->gesture.angle, + &tp->gesture.center); + tp->gesture.prev_scale = 1.0; + return GESTURE_2FG_STATE_PINCH; } - return GESTURE_STATE_UNKNOWN; + return GESTURE_2FG_STATE_UNKNOWN; } -static enum tp_gesture_state -tp_gesture_handle_state_scroll(struct tp_dispatch *tp, uint64_t time) +static enum tp_gesture_2fg_state +tp_gesture_twofinger_handle_state_scroll(struct tp_dispatch *tp, uint64_t time) { - struct device_float_coords raw; struct normalized_coords delta; if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG) - return GESTURE_STATE_SCROLL; + return GESTURE_2FG_STATE_SCROLL; - raw = tp_get_average_touches_delta(tp); + /* On some semi-mt models slot 0 is more accurate, so for semi-mt + * we only use slot 0. */ + if (tp->semi_mt) { + if (!tp->touches[0].dirty) + return GESTURE_2FG_STATE_SCROLL; + + delta = tp_get_delta(&tp->touches[0]); + } else { + delta = tp_get_average_touches_delta(tp); + } - /* scroll is not accelerated */ - delta = tp_filter_motion_unaccelerated(tp, &raw, time); + delta = tp_filter_motion(tp, &delta, time); if (normalized_is_zero(delta)) - return GESTURE_STATE_SCROLL; + return GESTURE_2FG_STATE_SCROLL; tp_gesture_start(tp, time); evdev_post_scroll(tp->device, @@ -402,32 +339,11 @@ LIBINPUT_POINTER_AXIS_SOURCE_FINGER, &delta); - return GESTURE_STATE_SCROLL; -} - -static enum tp_gesture_state -tp_gesture_handle_state_swipe(struct tp_dispatch *tp, uint64_t time) -{ - struct device_float_coords raw; - struct normalized_coords delta, unaccel; - - raw = tp_get_average_touches_delta(tp); - delta = tp_filter_motion(tp, &raw, time); - - if (!normalized_is_zero(delta) || !device_float_is_zero(raw)) { - unaccel = tp_normalize_delta(tp, raw); - tp_gesture_start(tp, time); - gesture_notify_swipe(&tp->device->base, time, - LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, - tp->gesture.finger_count, - &delta, &unaccel); - } - - return GESTURE_STATE_SWIPE; + return GESTURE_2FG_STATE_SCROLL; } -static enum tp_gesture_state -tp_gesture_handle_state_pinch(struct tp_dispatch *tp, uint64_t time) +static enum tp_gesture_2fg_state +tp_gesture_twofinger_handle_state_pinch(struct tp_dispatch *tp, uint64_t time) { double angle, angle_delta, distance, scale; struct device_float_coords center, fdelta; @@ -446,54 +362,65 @@ fdelta = device_float_delta(center, tp->gesture.center); tp->gesture.center = center; + unaccel = tp_normalize_delta(tp, fdelta); + delta = tp_filter_motion(tp, &unaccel, time); - delta = tp_filter_motion(tp, &fdelta, time); - - if (normalized_is_zero(delta) && device_float_is_zero(fdelta) && + if (normalized_is_zero(delta) && normalized_is_zero(unaccel) && scale == tp->gesture.prev_scale && angle_delta == 0.0) - return GESTURE_STATE_PINCH; + return GESTURE_2FG_STATE_PINCH; - unaccel = tp_normalize_delta(tp, fdelta); tp_gesture_start(tp, time); gesture_notify_pinch(&tp->device->base, time, LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, - tp->gesture.finger_count, &delta, &unaccel, scale, angle_delta); tp->gesture.prev_scale = scale; - return GESTURE_STATE_PINCH; + return GESTURE_2FG_STATE_PINCH; } static void -tp_gesture_post_gesture(struct tp_dispatch *tp, uint64_t time) +tp_gesture_post_twofinger(struct tp_dispatch *tp, uint64_t time) { - enum tp_gesture_state oldstate = tp->gesture.state; + enum tp_gesture_2fg_state oldstate = tp->gesture.twofinger_state; - if (tp->gesture.state == GESTURE_STATE_NONE) - tp->gesture.state = - tp_gesture_handle_state_none(tp, time); - - if (tp->gesture.state == GESTURE_STATE_UNKNOWN) - tp->gesture.state = - tp_gesture_handle_state_unknown(tp, time); - - if (tp->gesture.state == GESTURE_STATE_SCROLL) - tp->gesture.state = - tp_gesture_handle_state_scroll(tp, time); - - if (tp->gesture.state == GESTURE_STATE_SWIPE) - tp->gesture.state = - tp_gesture_handle_state_swipe(tp, time); - - if (tp->gesture.state == GESTURE_STATE_PINCH) - tp->gesture.state = - tp_gesture_handle_state_pinch(tp, time); - - evdev_log_debug(tp->device, - "gesture state: %s → %s\n", - gesture_state_to_str(oldstate), - gesture_state_to_str(tp->gesture.state)); + if (tp->gesture.twofinger_state == GESTURE_2FG_STATE_NONE) + tp->gesture.twofinger_state = + tp_gesture_twofinger_handle_state_none(tp, time); + + if (tp->gesture.twofinger_state == GESTURE_2FG_STATE_UNKNOWN) + tp->gesture.twofinger_state = + tp_gesture_twofinger_handle_state_unknown(tp, time); + + if (tp->gesture.twofinger_state == GESTURE_2FG_STATE_SCROLL) + tp->gesture.twofinger_state = + tp_gesture_twofinger_handle_state_scroll(tp, time); + + if (tp->gesture.twofinger_state == GESTURE_2FG_STATE_PINCH) + tp->gesture.twofinger_state = + tp_gesture_twofinger_handle_state_pinch(tp, time); + + log_debug(tp_libinput_context(tp), + "gesture state: %s → %s\n", + gesture_state_to_str(oldstate), + gesture_state_to_str(tp->gesture.twofinger_state)); +} + +static void +tp_gesture_post_swipe(struct tp_dispatch *tp, uint64_t time) +{ + struct normalized_coords delta, unaccel; + + unaccel = tp_get_average_touches_delta(tp); + delta = tp_filter_motion(tp, &unaccel, time); + + if (!normalized_is_zero(delta) || !normalized_is_zero(unaccel)) { + tp_gesture_start(tp, time); + gesture_notify_swipe(&tp->device->base, time, + LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, + tp->gesture.finger_count, + &delta, &unaccel); + } } void @@ -515,13 +442,14 @@ switch (tp->gesture.finger_count) { case 1: - if (tp->queued & TOUCHPAD_EVENT_MOTION) - tp_gesture_post_pointer_motion(tp, time); + tp_gesture_post_pointer_motion(tp, time); break; case 2: + tp_gesture_post_twofinger(tp, time); + break; case 3: case 4: - tp_gesture_post_gesture(tp, time); + tp_gesture_post_swipe(tp, time); break; } } @@ -540,37 +468,39 @@ static void tp_gesture_end(struct tp_dispatch *tp, uint64_t time, bool cancelled) { - enum tp_gesture_state state = tp->gesture.state; + struct libinput *libinput = tp->device->base.seat->libinput; + enum tp_gesture_2fg_state twofinger_state = tp->gesture.twofinger_state; - tp->gesture.state = GESTURE_STATE_NONE; + tp->gesture.twofinger_state = GESTURE_2FG_STATE_NONE; if (!tp->gesture.started) return; - switch (state) { - case GESTURE_STATE_NONE: - case GESTURE_STATE_UNKNOWN: - evdev_log_bug_libinput(tp->device, - "%s in unknown gesture mode\n", - __func__); - break; - case GESTURE_STATE_SCROLL: - tp_gesture_stop_twofinger_scroll(tp, time); - break; - case GESTURE_STATE_PINCH: - gesture_notify_pinch_end(&tp->device->base, time, - tp->gesture.finger_count, - tp->gesture.prev_scale, - cancelled); + switch (tp->gesture.finger_count) { + case 2: + switch (twofinger_state) { + case GESTURE_2FG_STATE_NONE: + case GESTURE_2FG_STATE_UNKNOWN: + log_bug_libinput(libinput, + "%s in unknown gesture mode\n", + __func__); + break; + case GESTURE_2FG_STATE_SCROLL: + tp_gesture_stop_twofinger_scroll(tp, time); + break; + case GESTURE_2FG_STATE_PINCH: + gesture_notify_pinch_end(&tp->device->base, time, + tp->gesture.prev_scale, + cancelled); + break; + } break; - case GESTURE_STATE_SWIPE: - gesture_notify_swipe_end(&tp->device->base, - time, - tp->gesture.finger_count, - cancelled); + case 3: + case 4: + gesture_notify_swipe_end(&tp->device->base, time, + tp->gesture.finger_count, cancelled); break; } - tp->gesture.started = false; } @@ -604,10 +534,13 @@ { unsigned int active_touches = 0; struct tp_touch *t; + int i = 0; tp_for_each_touch(tp, t) { if (tp_touch_active(tp, t)) active_touches++; + + i++; } if (active_touches != tp->gesture.finger_count) { @@ -631,26 +564,20 @@ } } -void +int tp_init_gesture(struct tp_dispatch *tp) { - char timer_name[64]; + if (tp->device->model_flags & EVDEV_MODEL_JUMPING_SEMI_MT) + tp->gesture.enabled = false; + else + tp->gesture.enabled = true; + + tp->gesture.twofinger_state = GESTURE_2FG_STATE_NONE; - /* two-finger scrolling is always enabled, this flag just - * decides whether we detect pinch. semi-mt devices are too - * unreliable to do pinch gestures. */ - tp->gesture.enabled = !tp->semi_mt && tp->num_slots > 1; - - tp->gesture.state = GESTURE_STATE_NONE; - - snprintf(timer_name, - sizeof(timer_name), - "%s gestures", - evdev_device_get_sysname(tp->device)); libinput_timer_init(&tp->gesture.finger_count_switch_timer, - tp_libinput_context(tp), - timer_name, + tp->device->base.seat->libinput, tp_gesture_finger_count_switch_timeout, tp); + return 0; } void diff -Nru libinput-1.10.3/src/evdev-mt-touchpad.h libinput-0.21.0/src/evdev-mt-touchpad.h --- libinput-1.10.3/src/evdev-mt-touchpad.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-mt-touchpad.h 2015-08-03 04:55:20.000000000 +0000 @@ -41,16 +41,23 @@ TOUCHPAD_EVENT_MOTION = (1 << 0), TOUCHPAD_EVENT_BUTTON_PRESS = (1 << 1), TOUCHPAD_EVENT_BUTTON_RELEASE = (1 << 2), - TOUCHPAD_EVENT_OTHERAXIS = (1 << 3), +}; + +enum touchpad_model { + MODEL_UNKNOWN = 0, + MODEL_SYNAPTICS, + MODEL_ALPS, + MODEL_APPLETOUCH, + MODEL_ELANTECH, + MODEL_UNIBODY_MACBOOK }; enum touch_state { TOUCH_NONE = 0, - TOUCH_HOVERING = 1, - TOUCH_BEGIN = 2, - TOUCH_UPDATE = 3, - TOUCH_MAYBE_END = 4, - TOUCH_END = 5, + TOUCH_HOVERING, + TOUCH_BEGIN, + TOUCH_UPDATE, + TOUCH_END }; enum touch_palm_state { @@ -58,14 +65,10 @@ PALM_EDGE, PALM_TYPING, PALM_TRACKPOINT, - PALM_TOOL_PALM, - PALM_PRESSURE, - PALM_TOUCH_SIZE, }; enum button_event { BUTTON_EVENT_IN_BOTTOM_R = 30, - BUTTON_EVENT_IN_BOTTOM_M, BUTTON_EVENT_IN_BOTTOM_L, BUTTON_EVENT_IN_TOP_R, BUTTON_EVENT_IN_TOP_M, @@ -94,7 +97,6 @@ TAP_STATE_TAPPED, TAP_STATE_TOUCH_2, TAP_STATE_TOUCH_2_HOLD, - TAP_STATE_TOUCH_2_RELEASE, TAP_STATE_TOUCH_3, TAP_STATE_TOUCH_3_HOLD, TAP_STATE_DRAGGING_OR_DOUBLETAP, @@ -104,7 +106,6 @@ TAP_STATE_DRAGGING_2, TAP_STATE_MULTITAP, TAP_STATE_MULTITAP_DOWN, - TAP_STATE_MULTITAP_PALM, TAP_STATE_DEAD, /**< finger count exceeded */ }; @@ -128,12 +129,11 @@ EDGE_SCROLL_TOUCH_STATE_AREA, }; -enum tp_gesture_state { - GESTURE_STATE_NONE, - GESTURE_STATE_UNKNOWN, - GESTURE_STATE_SCROLL, - GESTURE_STATE_PINCH, - GESTURE_STATE_SWIPE, +enum tp_gesture_2fg_state { + GESTURE_2FG_STATE_NONE, + GESTURE_2FG_STATE_UNKNOWN, + GESTURE_2FG_STATE_SCROLL, + GESTURE_2FG_STATE_PINCH, }; enum tp_thumb_state { @@ -148,14 +148,9 @@ bool has_ended; /* TRACKING_ID == -1 */ bool dirty; struct device_coords point; - struct device_coords last_point; - uint64_t time; + uint64_t millis; + int distance; /* distance == 0 means touch */ int pressure; - bool is_tool_palm; /* MT_TOOL_PALM */ - int major, minor; - - bool was_down; /* if distance == 0, false for pure hovering - touches */ struct { /* A quirk mostly used on Synaptics touchpads. In a @@ -167,18 +162,12 @@ } quirks; struct { - struct tp_history_point { - uint64_t time; - struct device_coords point; - } samples[TOUCHPAD_HISTORY_LENGTH]; + struct device_coords samples[TOUCHPAD_HISTORY_LENGTH]; unsigned int index; unsigned int count; } history; - struct { - struct device_coords center; - uint8_t x_motion_history; - } hysteresis; + struct device_coords hysteresis_center; /* A pinned touchpoint is the one that pressed the physical button * on a clickpad. After the release, it won't move until the center @@ -201,7 +190,6 @@ enum tp_tap_touch_state state; struct device_coords initial; bool is_thumb; - bool is_palm; } tap; struct { @@ -227,11 +215,6 @@ uint64_t first_touch_time; struct device_coords initial; } thumb; - - struct { - double last_speed; /* speed in mm/s at last sample */ - unsigned int exceeded_count; - } speed; }; struct tp_dispatch { @@ -242,10 +225,8 @@ unsigned int slot; /* current slot */ bool has_mt; bool semi_mt; - - /* true if we're reading events (i.e. not suspended) but we're - * ignoring them */ - bool ignore_events; + bool reports_distance; /* does the device support true hovering */ + enum touchpad_model model; unsigned int num_slots; /* number of slots */ unsigned int ntouches; /* no slots inc. fakes */ @@ -257,36 +238,11 @@ */ unsigned int fake_touches; - /* if pressure goes above high -> touch down, - if pressure then goes below low -> touch up */ - struct { - bool use_pressure; - int high; - int low; - } pressure; - - /* If touch size (either axis) goes above high -> touch down, - if touch size (either axis) goes below low -> touch up */ - struct { - bool use_touch_size; - int high; - int low; - - /* convert device units to angle */ - double orientation_to_angle; - } touch_size; - - struct { - bool enabled; - struct device_coords margin; - unsigned int other_event_count; - uint64_t last_motion_time; - } hysteresis; + struct device_coords hysteresis_margin; struct { double x_scale_coeff; double y_scale_coeff; - double xy_scale_coeff; } accel; struct { @@ -295,7 +251,7 @@ unsigned int finger_count; unsigned int finger_count_pending; struct libinput_timer finger_count_switch_timer; - enum tp_gesture_state state; + enum tp_gesture_2fg_state twofinger_state; struct tp_touch *touches[2]; uint64_t initial_time; double initial_distance; @@ -325,7 +281,6 @@ struct { int32_t top_edge; /* in device coordinates */ int32_t rightbutton_left_edge; /* in device coordinates */ - int32_t middlebutton_left_edge; /* in device coordinates */ } bottom_area; struct { @@ -356,37 +311,21 @@ struct libinput_timer timer; enum tp_tap_state state; uint32_t buttons_pressed; - uint64_t saved_press_time, - saved_release_time; + uint64_t multitap_last_time; - enum libinput_config_tap_button_map map; - enum libinput_config_tap_button_map want_map; - - bool drag_enabled; bool drag_lock_enabled; - - unsigned int nfingers_down; /* number of fingers down for tapping (excl. thumb/palm) */ } tap; struct { int32_t right_edge; /* in device coordinates */ int32_t left_edge; /* in device coordinates */ - int32_t upper_edge; /* in device coordinates */ + int32_t vert_center; /* in device coordinates */ bool trackpoint_active; struct libinput_event_listener trackpoint_listener; struct libinput_timer trackpoint_timer; uint64_t trackpoint_last_event_time; - uint32_t trackpoint_event_count; bool monitor_trackpoint; - - bool use_mt_tool; - - bool use_pressure; - int pressure_threshold; - - bool use_size; - int size_threshold; } palm; struct { @@ -398,20 +337,11 @@ struct libinput_device_config_dwt config; bool dwt_enabled; - /* We have to allow for more than one device node to be the - * internal dwt keyboard (Razer Blade). But they're the same - * physical device, so we don't care about per-keyboard - * key/modifier masks. - */ - struct paired_keyboard { - struct evdev_device *device; - struct libinput_event_listener listener; - } paired_keyboard[3]; - - unsigned long key_mask[NLONGS(KEY_CNT)]; - unsigned long mod_mask[NLONGS(KEY_CNT)]; bool keyboard_active; + struct libinput_event_listener keyboard_listener; struct libinput_timer keyboard_timer; + struct evdev_device *keyboard; + uint64_t keyboard_last_press_time; } dwt; @@ -421,49 +351,19 @@ int upper_thumb_line; int lower_thumb_line; } thumb; - - struct { - /* A quirk used on the T450 series Synaptics hardware. - * Slowly moving the finger causes multiple events with only - * ABS_MT_PRESSURE but no x/y information. When the x/y - * event comes, it will be a jump of ~20 units. We use the - * below to count non-motion events to discard that first - * event with the jump. - */ - unsigned int nonmotion_event_count; - } quirks; - - struct { - struct libinput_event_listener listener; - struct evdev_device *lid_switch; - } lid_switch; - - struct { - struct libinput_event_listener listener; - struct evdev_device *tablet_mode_switch; - } tablet_mode_switch; }; -static inline struct tp_dispatch* -tp_dispatch(struct evdev_dispatch *dispatch) -{ - evdev_verify_dispatch_type(dispatch, DISPATCH_TOUCHPAD); - - return container_of(dispatch, struct tp_dispatch, base); -} - #define tp_for_each_touch(_tp, _t) \ for (unsigned int _i = 0; _i < (_tp)->ntouches && (_t = &(_tp)->touches[_i]); _i++) static inline struct libinput* -tp_libinput_context(const struct tp_dispatch *tp) +tp_libinput_context(struct tp_dispatch *tp) { - return evdev_libinput_context(tp->device); + return tp->device->base.seat->libinput; } static inline struct normalized_coords -tp_normalize_delta(const struct tp_dispatch *tp, - struct device_float_coords delta) +tp_normalize_delta(struct tp_dispatch *tp, struct device_float_coords delta) { struct normalized_coords normalized; @@ -473,63 +373,42 @@ return normalized; } -static inline struct phys_coords -tp_phys_delta(const struct tp_dispatch *tp, - struct device_float_coords delta) -{ - struct phys_coords mm; - - mm.x = delta.x / tp->device->abs.absinfo_x->resolution; - mm.y = delta.y / tp->device->abs.absinfo_y->resolution; - - return mm; -} - /** - * Takes a set of device coordinates, returns that set of coordinates in the - * x-axis' resolution. + * Takes a dpi-normalized set of coordinates, returns a set of coordinates + * in the x-axis' coordinate space. */ static inline struct device_float_coords -tp_scale_to_xaxis(const struct tp_dispatch *tp, - struct device_float_coords delta) +tp_unnormalize_for_xaxis(struct tp_dispatch *tp, struct normalized_coords delta) { struct device_float_coords raw; - raw.x = delta.x; - raw.y = delta.y * tp->accel.xy_scale_coeff; + raw.x = delta.x / tp->accel.x_scale_coeff; + raw.y = delta.y / tp->accel.x_scale_coeff; /* <--- not a typo */ return raw; } -struct device_coords +struct normalized_coords tp_get_delta(struct tp_touch *t); struct normalized_coords tp_filter_motion(struct tp_dispatch *tp, - const struct device_float_coords *unaccelerated, + const struct normalized_coords *unaccelerated, uint64_t time); -struct normalized_coords -tp_filter_motion_unaccelerated(struct tp_dispatch *tp, - const struct device_float_coords *unaccelerated, - uint64_t time); - -bool -tp_touch_active(const struct tp_dispatch *tp, const struct tp_touch *t); +int +tp_touch_active(struct tp_dispatch *tp, struct tp_touch *t); int tp_tap_handle_state(struct tp_dispatch *tp, uint64_t time); -void -tp_tap_post_process_state(struct tp_dispatch *tp); - -void +int tp_init_tap(struct tp_dispatch *tp); void tp_remove_tap(struct tp_dispatch *tp); -void +int tp_init_buttons(struct tp_dispatch *tp, struct evdev_device *device); void @@ -540,7 +419,7 @@ void tp_remove_buttons(struct tp_dispatch *tp); -void +int tp_process_button(struct tp_dispatch *tp, const struct input_event *e, uint64_t time); @@ -552,16 +431,14 @@ int tp_post_button_events(struct tp_dispatch *tp, uint64_t time); -void +int tp_button_handle_state(struct tp_dispatch *tp, uint64_t time); -bool -tp_button_touch_active(const struct tp_dispatch *tp, - const struct tp_touch *t); +int +tp_button_touch_active(struct tp_dispatch *tp, struct tp_touch *t); bool -tp_button_is_inside_softbutton_area(const struct tp_dispatch *tp, - const struct tp_touch *t); +tp_button_is_inside_softbutton_area(struct tp_dispatch *tp, struct tp_touch *t); void tp_release_all_taps(struct tp_dispatch *tp, @@ -574,9 +451,9 @@ tp_tap_resume(struct tp_dispatch *tp, uint64_t time); bool -tp_tap_dragging(const struct tp_dispatch *tp); +tp_tap_dragging(struct tp_dispatch *tp); -void +int tp_edge_scroll_init(struct tp_dispatch *tp, struct evdev_device *device); void @@ -592,13 +469,12 @@ tp_edge_scroll_stop_events(struct tp_dispatch *tp, uint64_t time); int -tp_edge_scroll_touch_active(const struct tp_dispatch *tp, - const struct tp_touch *t); +tp_edge_scroll_touch_active(struct tp_dispatch *tp, struct tp_touch *t); uint32_t -tp_touch_get_edge(const struct tp_dispatch *tp, const struct tp_touch *t); +tp_touch_get_edge(struct tp_dispatch *tp, struct tp_touch *t); -void +int tp_init_gesture(struct tp_dispatch *tp); void @@ -620,9 +496,6 @@ tp_gesture_stop_twofinger_scroll(struct tp_dispatch *tp, uint64_t time); bool -tp_palm_tap_is_palm(const struct tp_dispatch *tp, const struct tp_touch *t); - -void -tp_clickpad_middlebutton_apply_config(struct evdev_device *device); +tp_palm_tap_is_palm(struct tp_dispatch *tp, struct tp_touch *t); #endif diff -Nru libinput-1.10.3/src/evdev-mt-touchpad-tap.c libinput-0.21.0/src/evdev-mt-touchpad-tap.c --- libinput-1.10.3/src/evdev-mt-touchpad-tap.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-mt-touchpad-tap.c 2015-08-03 04:55:20.000000000 +0000 @@ -22,7 +22,9 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef HAVE_CONFIG_H #include "config.h" +#endif #include #include @@ -35,7 +37,7 @@ #define DEFAULT_TAP_TIMEOUT_PERIOD ms2us(180) #define DEFAULT_DRAG_TIMEOUT_PERIOD ms2us(300) -#define DEFAULT_TAP_MOVE_THRESHOLD 1.3 /* mm */ +#define DEFAULT_TAP_MOVE_THRESHOLD TP_MM_TO_DPI_NORMALIZED(3) enum tap_event { TAP_EVENT_TOUCH = 12, @@ -44,8 +46,6 @@ TAP_EVENT_BUTTON, TAP_EVENT_TIMEOUT, TAP_EVENT_THUMB, - TAP_EVENT_PALM, - TAP_EVENT_PALM_UP, }; /***************************************** @@ -69,7 +69,6 @@ CASE_RETURN_STRING(TAP_STATE_TAPPED); CASE_RETURN_STRING(TAP_STATE_TOUCH_2); CASE_RETURN_STRING(TAP_STATE_TOUCH_2_HOLD); - CASE_RETURN_STRING(TAP_STATE_TOUCH_2_RELEASE); CASE_RETURN_STRING(TAP_STATE_TOUCH_3); CASE_RETURN_STRING(TAP_STATE_TOUCH_3_HOLD); CASE_RETURN_STRING(TAP_STATE_DRAGGING); @@ -79,7 +78,6 @@ CASE_RETURN_STRING(TAP_STATE_DRAGGING_2); CASE_RETURN_STRING(TAP_STATE_MULTITAP); CASE_RETURN_STRING(TAP_STATE_MULTITAP_DOWN); - CASE_RETURN_STRING(TAP_STATE_MULTITAP_PALM); CASE_RETURN_STRING(TAP_STATE_DEAD); } return NULL; @@ -95,22 +93,10 @@ CASE_RETURN_STRING(TAP_EVENT_TIMEOUT); CASE_RETURN_STRING(TAP_EVENT_BUTTON); CASE_RETURN_STRING(TAP_EVENT_THUMB); - CASE_RETURN_STRING(TAP_EVENT_PALM); - CASE_RETURN_STRING(TAP_EVENT_PALM_UP); } return NULL; } -static inline void -log_tap_bug(struct tp_dispatch *tp, enum tap_event event) -{ - evdev_log_bug_libinput(tp->device, - "invalid tap event %s in state %s\n", - tap_event_to_str(event), - tap_state_to_str(tp->tap.state)); - -} - static void tp_tap_notify(struct tp_dispatch *tp, uint64_t time, @@ -118,17 +104,14 @@ enum libinput_button_state state) { int32_t button; - int32_t button_map[2][3] = { - { BTN_LEFT, BTN_RIGHT, BTN_MIDDLE }, - { BTN_LEFT, BTN_MIDDLE, BTN_RIGHT }, - }; - assert(tp->tap.map < ARRAY_LENGTH(button_map)); - - if (nfingers > 3) + switch (nfingers) { + case 1: button = BTN_LEFT; break; + case 2: button = BTN_RIGHT; break; + case 3: button = BTN_MIDDLE; break; + default: return; - - button = button_map[tp->tap.map][nfingers - 1]; + } if (state == LIBINPUT_BUTTON_STATE_PRESSED) tp->tap.buttons_pressed |= (1 << nfingers); @@ -164,16 +147,18 @@ struct tp_touch *t, enum tap_event event, uint64_t time) { + struct libinput *libinput = tp_libinput_context(tp); + switch (event) { case TAP_EVENT_TOUCH: tp->tap.state = TAP_STATE_TOUCH; - tp->tap.saved_press_time = time; tp_tap_set_timer(tp, time); break; case TAP_EVENT_RELEASE: break; case TAP_EVENT_MOTION: - log_tap_bug(tp, event); + log_bug_libinput(libinput, + "invalid tap event, no fingers are down\n"); break; case TAP_EVENT_TIMEOUT: break; @@ -181,13 +166,8 @@ tp->tap.state = TAP_STATE_DEAD; break; case TAP_EVENT_THUMB: - log_tap_bug(tp, event); - break; - case TAP_EVENT_PALM: - tp->tap.state = TAP_STATE_IDLE; - t->tap.state = TAP_TOUCH_STATE_DEAD; - break; - case TAP_EVENT_PALM_UP: + log_bug_libinput(libinput, + "invalid tap event, no fingers down, no thumb\n"); break; } } @@ -201,25 +181,12 @@ switch (event) { case TAP_EVENT_TOUCH: tp->tap.state = TAP_STATE_TOUCH_2; - tp->tap.saved_press_time = time; tp_tap_set_timer(tp, time); break; case TAP_EVENT_RELEASE: - tp_tap_notify(tp, - tp->tap.saved_press_time, - 1, - LIBINPUT_BUTTON_STATE_PRESSED); - if (tp->tap.drag_enabled) { - tp->tap.state = TAP_STATE_TAPPED; - tp->tap.saved_release_time = time; - tp_tap_set_timer(tp, time); - } else { - tp_tap_notify(tp, - time, - 1, - LIBINPUT_BUTTON_STATE_RELEASED); - tp->tap.state = TAP_STATE_IDLE; - } + tp->tap.state = TAP_STATE_TAPPED; + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_PRESSED); + tp_tap_set_timer(tp, time); break; case TAP_EVENT_TIMEOUT: case TAP_EVENT_MOTION: @@ -232,17 +199,9 @@ case TAP_EVENT_THUMB: tp->tap.state = TAP_STATE_IDLE; t->tap.is_thumb = true; - tp->tap.nfingers_down--; t->tap.state = TAP_TOUCH_STATE_DEAD; tp_tap_clear_timer(tp); break; - case TAP_EVENT_PALM: - tp->tap.state = TAP_STATE_IDLE; - t->tap.state = TAP_TOUCH_STATE_DEAD; - tp_tap_clear_timer(tp); - break; - case TAP_EVENT_PALM_UP: - break; } } @@ -255,7 +214,6 @@ switch (event) { case TAP_EVENT_TOUCH: tp->tap.state = TAP_STATE_TOUCH_2; - tp->tap.saved_press_time = time; tp_tap_set_timer(tp, time); break; case TAP_EVENT_RELEASE: @@ -270,14 +228,8 @@ case TAP_EVENT_THUMB: tp->tap.state = TAP_STATE_IDLE; t->tap.is_thumb = true; - tp->tap.nfingers_down--; t->tap.state = TAP_TOUCH_STATE_DEAD; break; - case TAP_EVENT_PALM: - tp->tap.state = TAP_STATE_IDLE; - break; - case TAP_EVENT_PALM_UP: - break; } } @@ -286,35 +238,27 @@ struct tp_touch *t, enum tap_event event, uint64_t time) { + struct libinput *libinput = tp_libinput_context(tp); + switch (event) { case TAP_EVENT_MOTION: case TAP_EVENT_RELEASE: - log_tap_bug(tp, event); + log_bug_libinput(libinput, + "invalid tap event when fingers are up\n"); break; case TAP_EVENT_TOUCH: tp->tap.state = TAP_STATE_DRAGGING_OR_DOUBLETAP; - tp->tap.saved_press_time = time; tp_tap_set_timer(tp, time); break; case TAP_EVENT_TIMEOUT: tp->tap.state = TAP_STATE_IDLE; - tp_tap_notify(tp, - tp->tap.saved_release_time, - 1, - LIBINPUT_BUTTON_STATE_RELEASED); + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); break; case TAP_EVENT_BUTTON: tp->tap.state = TAP_STATE_DEAD; - tp_tap_notify(tp, - tp->tap.saved_release_time, - 1, - LIBINPUT_BUTTON_STATE_RELEASED); + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); break; case TAP_EVENT_THUMB: - case TAP_EVENT_PALM: - log_tap_bug(tp, event); - break; - case TAP_EVENT_PALM_UP: break; } } @@ -328,13 +272,15 @@ switch (event) { case TAP_EVENT_TOUCH: tp->tap.state = TAP_STATE_TOUCH_3; - tp->tap.saved_press_time = time; tp_tap_set_timer(tp, time); break; case TAP_EVENT_RELEASE: - tp->tap.state = TAP_STATE_TOUCH_2_RELEASE; - tp->tap.saved_release_time = time; - tp_tap_set_timer(tp, time); + tp->tap.state = TAP_STATE_HOLD; + if (t->tap.state == TAP_TOUCH_STATE_TOUCH) { + tp_tap_notify(tp, time, 2, LIBINPUT_BUTTON_STATE_PRESSED); + tp_tap_notify(tp, time, 2, LIBINPUT_BUTTON_STATE_RELEASED); + } + tp_tap_clear_timer(tp); break; case TAP_EVENT_MOTION: tp_tap_clear_timer(tp); @@ -347,12 +293,6 @@ break; case TAP_EVENT_THUMB: break; - case TAP_EVENT_PALM: - tp->tap.state = TAP_STATE_TOUCH; - tp_tap_set_timer(tp, time); /* overwrite timer */ - break; - case TAP_EVENT_PALM_UP: - break; } } @@ -365,7 +305,6 @@ switch (event) { case TAP_EVENT_TOUCH: tp->tap.state = TAP_STATE_TOUCH_3; - tp->tap.saved_press_time = time; tp_tap_set_timer(tp, time); break; case TAP_EVENT_RELEASE: @@ -380,71 +319,6 @@ break; case TAP_EVENT_THUMB: break; - case TAP_EVENT_PALM: - tp->tap.state = TAP_STATE_HOLD; - break; - case TAP_EVENT_PALM_UP: - break; - } -} - -static void -tp_tap_touch2_release_handle_event(struct tp_dispatch *tp, - struct tp_touch *t, - enum tap_event event, uint64_t time) -{ - - switch (event) { - case TAP_EVENT_TOUCH: - tp->tap.state = TAP_STATE_TOUCH_2_HOLD; - t->tap.state = TAP_TOUCH_STATE_DEAD; - tp_tap_clear_timer(tp); - break; - case TAP_EVENT_RELEASE: - tp_tap_notify(tp, - tp->tap.saved_press_time, - 2, - LIBINPUT_BUTTON_STATE_PRESSED); - tp_tap_notify(tp, - tp->tap.saved_release_time, - 2, - LIBINPUT_BUTTON_STATE_RELEASED); - tp->tap.state = TAP_STATE_IDLE; - break; - case TAP_EVENT_MOTION: - case TAP_EVENT_TIMEOUT: - tp->tap.state = TAP_STATE_HOLD; - break; - case TAP_EVENT_BUTTON: - tp->tap.state = TAP_STATE_DEAD; - break; - case TAP_EVENT_THUMB: - break; - case TAP_EVENT_PALM: - /* There's only one saved press time and it's overwritten by - * the last touch down. So in the case of finger down, palm - * down, finger up, palm detected, we use the - * palm touch's press time here instead of the finger's press - * time. Let's wait and see if that's an issue. - */ - tp_tap_notify(tp, - tp->tap.saved_press_time, - 1, - LIBINPUT_BUTTON_STATE_PRESSED); - if (tp->tap.drag_enabled) { - tp->tap.state = TAP_STATE_TAPPED; - tp->tap.saved_release_time = time; - tp_tap_set_timer(tp, time); - } else { - tp_tap_notify(tp, - time, - 1, - LIBINPUT_BUTTON_STATE_RELEASED); - tp->tap.state = TAP_STATE_IDLE; - } - break; - case TAP_EVENT_PALM_UP: - break; } } @@ -467,10 +341,7 @@ case TAP_EVENT_RELEASE: tp->tap.state = TAP_STATE_TOUCH_2_HOLD; if (t->tap.state == TAP_TOUCH_STATE_TOUCH) { - tp_tap_notify(tp, - tp->tap.saved_press_time, - 3, - LIBINPUT_BUTTON_STATE_PRESSED); + tp_tap_notify(tp, time, 3, LIBINPUT_BUTTON_STATE_PRESSED); tp_tap_notify(tp, time, 3, LIBINPUT_BUTTON_STATE_RELEASED); } break; @@ -479,11 +350,6 @@ break; case TAP_EVENT_THUMB: break; - case TAP_EVENT_PALM: - tp->tap.state = TAP_STATE_TOUCH_2; - break; - case TAP_EVENT_PALM_UP: - break; } } @@ -509,11 +375,6 @@ break; case TAP_EVENT_THUMB: break; - case TAP_EVENT_PALM: - tp->tap.state = TAP_STATE_TOUCH_2_HOLD; - break; - case TAP_EVENT_PALM_UP: - break; } } @@ -528,11 +389,7 @@ break; case TAP_EVENT_RELEASE: tp->tap.state = TAP_STATE_MULTITAP; - tp_tap_notify(tp, - tp->tap.saved_release_time, - 1, - LIBINPUT_BUTTON_STATE_RELEASED); - tp->tap.saved_release_time = time; + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); break; case TAP_EVENT_MOTION: case TAP_EVENT_TIMEOUT: @@ -540,18 +397,10 @@ break; case TAP_EVENT_BUTTON: tp->tap.state = TAP_STATE_DEAD; - tp_tap_notify(tp, - tp->tap.saved_release_time, - 1, - LIBINPUT_BUTTON_STATE_RELEASED); + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); break; case TAP_EVENT_THUMB: break; - case TAP_EVENT_PALM: - tp->tap.state = TAP_STATE_TAPPED; - break; - case TAP_EVENT_PALM_UP: - break; } } @@ -587,15 +436,6 @@ break; case TAP_EVENT_THUMB: break; - case TAP_EVENT_PALM: - tp_tap_notify(tp, - tp->tap.saved_release_time, - 1, - LIBINPUT_BUTTON_STATE_RELEASED); - tp->tap.state = TAP_STATE_IDLE; - break; - case TAP_EVENT_PALM_UP: - break; } } @@ -622,9 +462,6 @@ tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); break; case TAP_EVENT_THUMB: - case TAP_EVENT_PALM: - break; - case TAP_EVENT_PALM_UP: break; } } @@ -654,15 +491,6 @@ break; case TAP_EVENT_THUMB: break; - case TAP_EVENT_PALM: - tp_tap_notify(tp, - tp->tap.saved_release_time, - 1, - LIBINPUT_BUTTON_STATE_RELEASED); - tp->tap.state = TAP_STATE_IDLE; - break; - case TAP_EVENT_PALM_UP: - break; } } @@ -690,11 +518,6 @@ break; case TAP_EVENT_THUMB: break; - case TAP_EVENT_PALM: - tp->tap.state = TAP_STATE_DRAGGING_OR_DOUBLETAP; - break; - case TAP_EVENT_PALM_UP: - break; } } @@ -703,41 +526,33 @@ struct tp_touch *t, enum tap_event event, uint64_t time) { + struct libinput *libinput = tp_libinput_context(tp); + switch (event) { case TAP_EVENT_RELEASE: - log_tap_bug(tp, event); + log_bug_libinput(libinput, + "invalid tap event, no fingers are down\n"); break; case TAP_EVENT_TOUCH: tp->tap.state = TAP_STATE_MULTITAP_DOWN; - tp_tap_notify(tp, - tp->tap.saved_press_time, - 1, - LIBINPUT_BUTTON_STATE_PRESSED); - tp->tap.saved_press_time = time; + tp->tap.multitap_last_time = time; + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_PRESSED); tp_tap_set_timer(tp, time); break; case TAP_EVENT_MOTION: - log_tap_bug(tp, event); + log_bug_libinput(libinput, + "invalid tap event, no fingers are down\n"); break; case TAP_EVENT_TIMEOUT: tp->tap.state = TAP_STATE_IDLE; - tp_tap_notify(tp, - tp->tap.saved_press_time, - 1, - LIBINPUT_BUTTON_STATE_PRESSED); - tp_tap_notify(tp, - tp->tap.saved_release_time, - 1, - LIBINPUT_BUTTON_STATE_RELEASED); + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_PRESSED); + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); break; case TAP_EVENT_BUTTON: tp->tap.state = TAP_STATE_IDLE; tp_tap_clear_timer(tp); break; case TAP_EVENT_THUMB: - case TAP_EVENT_PALM: - break; - case TAP_EVENT_PALM_UP: break; } } @@ -751,66 +566,33 @@ switch (event) { case TAP_EVENT_RELEASE: tp->tap.state = TAP_STATE_MULTITAP; - tp_tap_notify(tp, - tp->tap.saved_release_time, - 1, - LIBINPUT_BUTTON_STATE_RELEASED); - tp->tap.saved_release_time = time; + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); break; case TAP_EVENT_TOUCH: tp->tap.state = TAP_STATE_DRAGGING_2; + tp_tap_notify(tp, + tp->tap.multitap_last_time, + 1, + LIBINPUT_BUTTON_STATE_RELEASED); + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_PRESSED); tp_tap_clear_timer(tp); break; case TAP_EVENT_MOTION: case TAP_EVENT_TIMEOUT: tp->tap.state = TAP_STATE_DRAGGING; - tp_tap_clear_timer(tp); - break; - case TAP_EVENT_BUTTON: - tp->tap.state = TAP_STATE_DEAD; tp_tap_notify(tp, - tp->tap.saved_release_time, + tp->tap.multitap_last_time, 1, LIBINPUT_BUTTON_STATE_RELEASED); + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_PRESSED); tp_tap_clear_timer(tp); break; - case TAP_EVENT_THUMB: - break; - case TAP_EVENT_PALM: - tp->tap.state = TAP_STATE_MULTITAP_PALM; - break; - case TAP_EVENT_PALM_UP: - break; - } -} - -static void -tp_tap_multitap_palm_handle_event(struct tp_dispatch *tp, - struct tp_touch *t, - enum tap_event event, - uint64_t time) -{ - switch (event) { - case TAP_EVENT_RELEASE: - /* This is the palm finger */ - break; - case TAP_EVENT_TOUCH: - tp->tap.state = TAP_STATE_MULTITAP_DOWN; - break; - case TAP_EVENT_MOTION: - break; - case TAP_EVENT_TIMEOUT: case TAP_EVENT_BUTTON: - tp->tap.state = TAP_STATE_IDLE; + tp->tap.state = TAP_STATE_DEAD; + tp_tap_notify(tp, time, 1, LIBINPUT_BUTTON_STATE_RELEASED); tp_tap_clear_timer(tp); - tp_tap_notify(tp, - tp->tap.saved_release_time, - 1, - LIBINPUT_BUTTON_STATE_RELEASED); break; case TAP_EVENT_THUMB: - case TAP_EVENT_PALM: - case TAP_EVENT_PALM_UP: break; } } @@ -824,7 +606,7 @@ switch (event) { case TAP_EVENT_RELEASE: - if (tp->tap.nfingers_down == 0) + if (tp->nfingers_down == 0) tp->tap.state = TAP_STATE_IDLE; break; case TAP_EVENT_TOUCH: @@ -834,11 +616,6 @@ break; case TAP_EVENT_THUMB: break; - case TAP_EVENT_PALM: - case TAP_EVENT_PALM_UP: - if (tp->tap.nfingers_down == 0) - tp->tap.state = TAP_STATE_IDLE; - break; } } @@ -848,6 +625,7 @@ enum tap_event event, uint64_t time) { + struct libinput *libinput = tp_libinput_context(tp); enum tp_tap_state current; current = tp->tap.state; @@ -871,9 +649,6 @@ case TAP_STATE_TOUCH_2_HOLD: tp_tap_touch2_hold_handle_event(tp, t, event, time); break; - case TAP_STATE_TOUCH_2_RELEASE: - tp_tap_touch2_release_handle_event(tp, t, event, time); - break; case TAP_STATE_TOUCH_3: tp_tap_touch3_handle_event(tp, t, event, time); break; @@ -901,9 +676,6 @@ case TAP_STATE_MULTITAP_DOWN: tp_tap_multitap_down_handle_event(tp, t, event, time); break; - case TAP_STATE_MULTITAP_PALM: - tp_tap_multitap_palm_handle_event(tp, t, event, time); - break; case TAP_STATE_DEAD: tp_tap_dead_handle_event(tp, t, event, time); break; @@ -912,7 +684,7 @@ if (tp->tap.state == TAP_STATE_IDLE || tp->tap.state == TAP_STATE_DEAD) tp_tap_clear_timer(tp); - evdev_log_debug(tp->device, + log_debug(libinput, "tap state: %s → %s → %s\n", tap_state_to_str(current), tap_event_to_str(event), @@ -923,24 +695,11 @@ tp_tap_exceeds_motion_threshold(struct tp_dispatch *tp, struct tp_touch *t) { - struct phys_coords mm = - tp_phys_delta(tp, device_delta(t->point, t->tap.initial)); - - /* if we have more fingers down than slots, we know that synaptics - * touchpads are likely to give us pointer jumps. - * This triggers the movement threshold, making three-finger taps - * less reliable (#101435) - * - * This uses the real nfingers_down, not the one for taps. - */ - if (tp->device->model_flags & EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD && - (tp->nfingers_down > 2 || tp->old_nfingers_down > 2) && - (tp->nfingers_down > tp->num_slots || - tp->old_nfingers_down > tp->num_slots)) { - return false; - } + struct normalized_coords norm = + tp_normalize_delta(tp, device_delta(t->point, + t->tap.initial)); - return length_in_mm(mm) > DEFAULT_TAP_MOVE_THRESHOLD; + return normalized_length(norm) > DEFAULT_TAP_MOVE_THRESHOLD; } static bool @@ -977,32 +736,7 @@ if (t->tap.is_thumb) continue; - /* A palm tap needs to be properly relased because we might - * be who-knows-where in the state machine. Otherwise, we - * ignore any event from it. - */ - if (t->tap.is_palm) { - if (t->state == TOUCH_END) - tp_tap_handle_event(tp, - t, - TAP_EVENT_PALM_UP, - time); - continue; - } - - if (t->state == TOUCH_HOVERING) - continue; - - if (t->palm.state != PALM_NONE) { - assert(!t->tap.is_palm); - tp_tap_handle_event(tp, t, TAP_EVENT_PALM, time); - t->tap.is_palm = true; - t->tap.state = TAP_TOUCH_STATE_DEAD; - if (t->state != TOUCH_BEGIN) { - assert(tp->tap.nfingers_down > 0); - tp->tap.nfingers_down--; - } - } else if (t->state == TOUCH_BEGIN) { + if (t->state == TOUCH_BEGIN) { /* The simple version: if a touch is a thumb on * begin we ignore it. All other thumb touches * follow the normal tap state for now */ @@ -1013,7 +747,6 @@ t->tap.state = TAP_TOUCH_STATE_TOUCH; t->tap.initial = t->point; - tp->tap.nfingers_down++; tp_tap_handle_event(tp, t, TAP_EVENT_TOUCH, time); /* If we think this is a palm, pretend there's a @@ -1024,11 +757,7 @@ tp_tap_handle_event(tp, t, TAP_EVENT_MOTION, time); } else if (t->state == TOUCH_END) { - if (t->was_down) { - assert(tp->tap.nfingers_down >= 1); - tp->tap.nfingers_down--; - tp_tap_handle_event(tp, t, TAP_EVENT_RELEASE, time); - } + tp_tap_handle_event(tp, t, TAP_EVENT_RELEASE, time); t->tap.state = TAP_TOUCH_STATE_IDLE; } else if (tp->tap.state != TAP_STATE_IDLE && tp_tap_exceeds_motion_threshold(tp, t)) { @@ -1071,29 +800,9 @@ } - assert(tp->tap.nfingers_down <= tp->nfingers_down); - if (tp->nfingers_down == 0) - assert(tp->tap.nfingers_down == 0); - return filter_motion; } -static inline void -tp_tap_update_map(struct tp_dispatch *tp) -{ - if (tp->tap.state != TAP_STATE_IDLE) - return; - - if (tp->tap.map != tp->tap.want_map) - tp->tap.map = tp->tap.want_map; -} - -void -tp_tap_post_process_state(struct tp_dispatch *tp) -{ - tp_tap_update_map(tp); -} - static void tp_tap_handle_timeout(uint64_t time, void *data) { @@ -1123,19 +832,9 @@ return; if (tp_tap_enabled(tp)) { - struct tp_touch *t; - - /* On resume, all touches are considered palms */ - tp_for_each_touch(tp, t) { - if (t->state == TOUCH_NONE) - continue; - - t->tap.is_palm = true; - t->tap.state = TAP_TOUCH_STATE_DEAD; - } - - tp->tap.state = TAP_STATE_IDLE; - tp->tap.nfingers_down = 0; + /* Must restart in DEAD if fingers are down atm */ + tp->tap.state = + tp->nfingers_down ? TAP_STATE_DEAD : TAP_STATE_IDLE; } else { tp_release_all_taps(tp, time); } @@ -1144,19 +843,23 @@ static int tp_tap_config_count(struct libinput_device *device) { - struct evdev_dispatch *dispatch = evdev_device(device)->dispatch; - struct tp_dispatch *tp = tp_dispatch(dispatch); + struct evdev_dispatch *dispatch; + struct tp_dispatch *tp = NULL; + + dispatch = ((struct evdev_device *) device)->dispatch; + tp = container_of(dispatch, tp, base); - return min(tp->ntouches, 3U); /* we only do up to 3 finger tap */ + return min(tp->ntouches, 3); /* we only do up to 3 finger tap */ } static enum libinput_config_status tp_tap_config_set_enabled(struct libinput_device *device, enum libinput_config_tap_state enabled) { - struct evdev_dispatch *dispatch = evdev_device(device)->dispatch; - struct tp_dispatch *tp = tp_dispatch(dispatch); + struct evdev_dispatch *dispatch = ((struct evdev_device *) device)->dispatch; + struct tp_dispatch *tp = NULL; + tp = container_of(dispatch, tp, base); tp_tap_enabled_update(tp, tp->tap.suspended, (enabled == LIBINPUT_CONFIG_TAP_ENABLED), libinput_now(device->seat->libinput)); @@ -1167,8 +870,11 @@ static enum libinput_config_tap_state tp_tap_config_is_enabled(struct libinput_device *device) { - struct evdev_dispatch *dispatch = evdev_device(device)->dispatch; - struct tp_dispatch *tp = tp_dispatch(dispatch); + struct evdev_dispatch *dispatch; + struct tp_dispatch *tp = NULL; + + dispatch = ((struct evdev_device *) device)->dispatch; + tp = container_of(dispatch, tp, base); return tp->tap.enabled ? LIBINPUT_CONFIG_TAP_ENABLED : LIBINPUT_CONFIG_TAP_DISABLED; @@ -1199,82 +905,19 @@ static enum libinput_config_tap_state tp_tap_config_get_default(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device *)device; return tp_tap_default(evdev); } static enum libinput_config_status -tp_tap_config_set_map(struct libinput_device *device, - enum libinput_config_tap_button_map map) -{ - struct evdev_dispatch *dispatch = evdev_device(device)->dispatch; - struct tp_dispatch *tp = tp_dispatch(dispatch); - - tp->tap.want_map = map; - - tp_tap_update_map(tp); - - return LIBINPUT_CONFIG_STATUS_SUCCESS; -} - -static enum libinput_config_tap_button_map -tp_tap_config_get_map(struct libinput_device *device) -{ - struct evdev_dispatch *dispatch = evdev_device(device)->dispatch; - struct tp_dispatch *tp = tp_dispatch(dispatch); - - return tp->tap.want_map; -} - -static enum libinput_config_tap_button_map -tp_tap_config_get_default_map(struct libinput_device *device) -{ - return LIBINPUT_CONFIG_TAP_MAP_LRM; -} - -static enum libinput_config_status -tp_tap_config_set_drag_enabled(struct libinput_device *device, - enum libinput_config_drag_state enabled) -{ - struct evdev_dispatch *dispatch = evdev_device(device)->dispatch; - struct tp_dispatch *tp = tp_dispatch(dispatch); - - tp->tap.drag_enabled = enabled; - - return LIBINPUT_CONFIG_STATUS_SUCCESS; -} - -static enum libinput_config_drag_state -tp_tap_config_get_drag_enabled(struct libinput_device *device) -{ - struct evdev_dispatch *dispatch = evdev_device(device)->dispatch; - struct tp_dispatch *tp = tp_dispatch(dispatch); - - return tp->tap.drag_enabled; -} - -static inline enum libinput_config_drag_state -tp_drag_default(struct evdev_device *device) -{ - return LIBINPUT_CONFIG_DRAG_ENABLED; -} - -static enum libinput_config_drag_state -tp_tap_config_get_default_drag_enabled(struct libinput_device *device) -{ - struct evdev_device *evdev = evdev_device(device); - - return tp_drag_default(evdev); -} - -static enum libinput_config_status tp_tap_config_set_draglock_enabled(struct libinput_device *device, enum libinput_config_drag_lock_state enabled) { - struct evdev_dispatch *dispatch = evdev_device(device)->dispatch; - struct tp_dispatch *tp = tp_dispatch(dispatch); + struct evdev_dispatch *dispatch = ((struct evdev_device *) device)->dispatch; + struct tp_dispatch *tp = NULL; + tp = container_of(dispatch, tp, base); tp->tap.drag_lock_enabled = enabled; return LIBINPUT_CONFIG_STATUS_SUCCESS; @@ -1283,8 +926,10 @@ static enum libinput_config_drag_lock_state tp_tap_config_get_draglock_enabled(struct libinput_device *device) { - struct evdev_dispatch *dispatch = evdev_device(device)->dispatch; - struct tp_dispatch *tp = tp_dispatch(dispatch); + struct evdev_device *evdev = (struct evdev_device *)device; + struct tp_dispatch *tp = NULL; + + tp = container_of(evdev->dispatch, tp, base); return tp->tap.drag_lock_enabled; } @@ -1298,26 +943,18 @@ static enum libinput_config_drag_lock_state tp_tap_config_get_default_draglock_enabled(struct libinput_device *device) { - struct evdev_device *evdev = evdev_device(device); + struct evdev_device *evdev = (struct evdev_device *)device; return tp_drag_lock_default(evdev); } -void +int tp_init_tap(struct tp_dispatch *tp) { - char timer_name[64]; - tp->tap.config.count = tp_tap_config_count; tp->tap.config.set_enabled = tp_tap_config_set_enabled; tp->tap.config.get_enabled = tp_tap_config_is_enabled; tp->tap.config.get_default = tp_tap_config_get_default; - tp->tap.config.set_map = tp_tap_config_set_map; - tp->tap.config.get_map = tp_tap_config_get_map; - tp->tap.config.get_default_map = tp_tap_config_get_default_map; - tp->tap.config.set_drag_enabled = tp_tap_config_set_drag_enabled; - tp->tap.config.get_drag_enabled = tp_tap_config_get_drag_enabled; - tp->tap.config.get_default_drag_enabled = tp_tap_config_get_default_drag_enabled; tp->tap.config.set_draglock_enabled = tp_tap_config_set_draglock_enabled; tp->tap.config.get_draglock_enabled = tp_tap_config_get_draglock_enabled; tp->tap.config.get_default_draglock_enabled = tp_tap_config_get_default_draglock_enabled; @@ -1325,19 +962,13 @@ tp->tap.state = TAP_STATE_IDLE; tp->tap.enabled = tp_tap_default(tp->device); - tp->tap.map = LIBINPUT_CONFIG_TAP_MAP_LRM; - tp->tap.want_map = tp->tap.map; - tp->tap.drag_enabled = tp_drag_default(tp->device); tp->tap.drag_lock_enabled = tp_drag_lock_default(tp->device); - snprintf(timer_name, - sizeof(timer_name), - "%s tap", - evdev_device_get_sysname(tp->device)); libinput_timer_init(&tp->tap.timer, tp_libinput_context(tp), - timer_name, tp_tap_handle_timeout, tp); + + return 0; } void @@ -1349,7 +980,6 @@ void tp_release_all_taps(struct tp_dispatch *tp, uint64_t now) { - struct tp_touch *t; int i; for (i = 1; i <= 3; i++) { @@ -1357,20 +987,7 @@ tp_tap_notify(tp, now, i, LIBINPUT_BUTTON_STATE_RELEASED); } - /* To neutralize all current touches, we make them all palms */ - tp_for_each_touch(tp, t) { - if (t->state == TOUCH_NONE) - continue; - - if (t->tap.is_palm) - continue; - - t->tap.is_palm = true; - t->tap.state = TAP_TOUCH_STATE_DEAD; - } - - tp->tap.state = TAP_STATE_IDLE; - tp->tap.nfingers_down = 0; + tp->tap.state = tp->nfingers_down ? TAP_STATE_DEAD : TAP_STATE_IDLE; } void @@ -1386,7 +1003,7 @@ } bool -tp_tap_dragging(const struct tp_dispatch *tp) +tp_tap_dragging(struct tp_dispatch *tp) { switch (tp->tap.state) { case TAP_STATE_DRAGGING: diff -Nru libinput-1.10.3/src/evdev-tablet.c libinput-0.21.0/src/evdev-tablet.c --- libinput-1.10.3/src/evdev-tablet.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-tablet.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2076 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * Copyright © 2014 Lyude Paul - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the copyright holders not be used in - * advertising or publicity pertaining to distribution of the software - * without specific, written prior permission. The copyright holders make - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ -#include "config.h" -#include "libinput-version.h" -#include "evdev-tablet.h" - -#include -#include -#include - -#if HAVE_LIBWACOM -#include -#endif - -/* The tablet sends events every ~2ms , 50ms should be plenty enough to - detect out-of-range */ -#define FORCED_PROXOUT_TIMEOUT ms2us(50) - -#define tablet_set_status(tablet_,s_) (tablet_)->status |= (s_) -#define tablet_unset_status(tablet_,s_) (tablet_)->status &= ~(s_) -#define tablet_has_status(tablet_,s_) (!!((tablet_)->status & (s_))) - -static inline void -tablet_get_pressed_buttons(struct tablet_dispatch *tablet, - struct button_state *buttons) -{ - size_t i; - const struct button_state *state = &tablet->button_state, - *prev_state = &tablet->prev_button_state; - - for (i = 0; i < sizeof(buttons->bits); i++) - buttons->bits[i] = state->bits[i] & ~(prev_state->bits[i]); -} - -static inline void -tablet_get_released_buttons(struct tablet_dispatch *tablet, - struct button_state *buttons) -{ - size_t i; - const struct button_state *state = &tablet->button_state, - *prev_state = &tablet->prev_button_state; - - for (i = 0; i < sizeof(buttons->bits); i++) - buttons->bits[i] = prev_state->bits[i] & - ~(state->bits[i]); -} - -/* Merge the previous state with the current one so all buttons look like - * they just got pressed in this frame */ -static inline void -tablet_force_button_presses(struct tablet_dispatch *tablet) -{ - struct button_state *state = &tablet->button_state, - *prev_state = &tablet->prev_button_state; - size_t i; - - for (i = 0; i < sizeof(state->bits); i++) { - state->bits[i] = state->bits[i] | prev_state->bits[i]; - prev_state->bits[i] = 0; - } -} - -static inline size_t -tablet_history_size(const struct tablet_dispatch *tablet) -{ - return ARRAY_LENGTH(tablet->history.samples); -} - -static inline void -tablet_history_reset(struct tablet_dispatch *tablet) -{ - tablet->history.count = 0; -} - -static inline void -tablet_history_push(struct tablet_dispatch *tablet, - const struct tablet_axes *axes) -{ - unsigned int index = (tablet->history.index + 1) % - tablet_history_size(tablet); - - tablet->history.samples[index] = *axes; - tablet->history.index = index; - tablet->history.count = min(tablet->history.count + 1, - tablet_history_size(tablet)); - - if (tablet->history.count < tablet_history_size(tablet)) - tablet_history_push(tablet, axes); -} - -/** - * Return a previous axis state, where index of 0 means "most recent", 1 is - * "one before most recent", etc. - */ -static inline const struct tablet_axes* -tablet_history_get(const struct tablet_dispatch *tablet, unsigned int index) -{ - size_t sz = tablet_history_size(tablet); - - assert(index < sz); - assert(index < tablet->history.count); - - index = (tablet->history.index + sz - index) % sz; - return &tablet->history.samples[index]; -} - -static inline void -tablet_reset_changed_axes(struct tablet_dispatch *tablet) -{ - memset(tablet->changed_axes, 0, sizeof(tablet->changed_axes)); -} - -static bool -tablet_device_has_axis(struct tablet_dispatch *tablet, - enum libinput_tablet_tool_axis axis) -{ - struct libevdev *evdev = tablet->device->evdev; - bool has_axis = false; - unsigned int code; - - if (axis == LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z) { - has_axis = (libevdev_has_event_code(evdev, - EV_KEY, - BTN_TOOL_MOUSE) && - libevdev_has_event_code(evdev, - EV_ABS, - ABS_TILT_X) && - libevdev_has_event_code(evdev, - EV_ABS, - ABS_TILT_Y)); - code = axis_to_evcode(axis); - has_axis |= libevdev_has_event_code(evdev, - EV_ABS, - code); - } else if (axis == LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL) { - has_axis = libevdev_has_event_code(evdev, - EV_REL, - REL_WHEEL); - } else { - code = axis_to_evcode(axis); - has_axis = libevdev_has_event_code(evdev, - EV_ABS, - code); - } - - return has_axis; -} - -static inline bool -tablet_filter_axis_fuzz(const struct tablet_dispatch *tablet, - const struct evdev_device *device, - const struct input_event *e, - enum libinput_tablet_tool_axis axis) -{ - int delta, fuzz; - int current, previous; - - previous = tablet->prev_value[axis]; - current = e->value; - delta = previous - current; - - fuzz = libevdev_get_abs_fuzz(device->evdev, e->code); - - /* ABS_DISTANCE doesn't have have fuzz set and causes continuous - * updates for the cursor/lens tools. Add a minimum fuzz of 2, same - * as the xf86-input-wacom driver - */ - switch (e->code) { - case ABS_DISTANCE: - fuzz = max(2, fuzz); - break; - default: - break; - } - - return abs(delta) <= fuzz; -} - -static void -tablet_process_absolute(struct tablet_dispatch *tablet, - struct evdev_device *device, - struct input_event *e, - uint64_t time) -{ - enum libinput_tablet_tool_axis axis; - - switch (e->code) { - case ABS_X: - case ABS_Y: - case ABS_Z: - case ABS_PRESSURE: - case ABS_TILT_X: - case ABS_TILT_Y: - case ABS_DISTANCE: - case ABS_WHEEL: - axis = evcode_to_axis(e->code); - if (axis == LIBINPUT_TABLET_TOOL_AXIS_NONE) { - evdev_log_bug_libinput(device, - "Invalid ABS event code %#x\n", - e->code); - break; - } - - tablet->prev_value[axis] = tablet->current_value[axis]; - if (tablet_filter_axis_fuzz(tablet, device, e, axis)) - break; - - tablet->current_value[axis] = e->value; - set_bit(tablet->changed_axes, axis); - tablet_set_status(tablet, TABLET_AXES_UPDATED); - break; - /* tool_id is the identifier for the tool we can use in libwacom - * to identify it (if we have one anyway) */ - case ABS_MISC: - tablet->current_tool_id = e->value; - break; - /* Intuos 3 strip data. Should only happen on the Pad device, not on - the Pen device. */ - case ABS_RX: - case ABS_RY: - /* Only on the 4D mouse (Intuos2), obsolete */ - case ABS_RZ: - /* Only on the 4D mouse (Intuos2), obsolete. - The 24HD sends ABS_THROTTLE on the Pad device for the second - wheel but we shouldn't get here on kernel >= 3.17. - */ - case ABS_THROTTLE: - default: - evdev_log_info(device, - "Unhandled ABS event code %#x\n", - e->code); - break; - } -} - -static void -tablet_change_to_left_handed(struct evdev_device *device) -{ - struct tablet_dispatch *tablet = tablet_dispatch(device->dispatch); - - if (device->left_handed.enabled == device->left_handed.want_enabled) - return; - - if (!tablet_has_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY)) - return; - - device->left_handed.enabled = device->left_handed.want_enabled; -} - -static void -tablet_update_tool(struct tablet_dispatch *tablet, - struct evdev_device *device, - enum libinput_tablet_tool_type tool, - bool enabled) -{ - assert(tool != LIBINPUT_TOOL_NONE); - - if (enabled) { - tablet->current_tool_type = tool; - tablet_set_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY); - tablet_unset_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY); - } - else if (!tablet_has_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY)) { - tablet_set_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY); - } -} - -static inline double -normalize_slider(const struct input_absinfo *absinfo) -{ - double range = absinfo->maximum - absinfo->minimum; - double value = (absinfo->value - absinfo->minimum) / range; - - return value * 2 - 1; -} - -static inline double -normalize_distance(const struct input_absinfo *absinfo) -{ - double range = absinfo->maximum - absinfo->minimum; - double value = (absinfo->value - absinfo->minimum) / range; - - return value; -} - -static inline double -normalize_pressure(const struct input_absinfo *absinfo, - struct libinput_tablet_tool *tool) -{ - double range = absinfo->maximum - absinfo->minimum; - int offset = tool->has_pressure_offset ? - tool->pressure_offset : 0; - double value = (absinfo->value - offset - absinfo->minimum) / range; - - return value; -} - -static inline double -adjust_tilt(const struct input_absinfo *absinfo) -{ - double range = absinfo->maximum - absinfo->minimum; - double value = (absinfo->value - absinfo->minimum) / range; - const int WACOM_MAX_DEGREES = 64; - - /* If resolution is nonzero, it's in units/radian. But require - * a min/max less/greater than zero so we can assume 0 is the - * center */ - if (absinfo->resolution != 0 && - absinfo->maximum > 0 && - absinfo->minimum < 0) { - value = 180.0/M_PI * absinfo->value/absinfo->resolution; - } else { - /* Wacom supports physical [-64, 64] degrees, so map to that by - * default. If other tablets have a different physical range or - * nonzero physical offsets, they need extra treatment - * here. - */ - /* Map to the (-1, 1) range */ - value = (value * 2) - 1; - value *= WACOM_MAX_DEGREES; - } - - return value; -} - -static inline int32_t -invert_axis(const struct input_absinfo *absinfo) -{ - return absinfo->maximum - (absinfo->value - absinfo->minimum); -} - -static void -convert_tilt_to_rotation(struct tablet_dispatch *tablet) -{ - const int offset = 5; - double x, y; - double angle = 0.0; - - /* Wacom Intuos 4, 5, Pro mouse calculates rotation from the x/y tilt - values. The device has a 175 degree CCW hardware offset but since we use - atan2 the effective offset is just 5 degrees. - */ - x = tablet->axes.tilt.x; - y = tablet->axes.tilt.y; - - /* atan2 is CCW, we want CW -> negate x */ - if (x || y) - angle = ((180.0 * atan2(-x, y)) / M_PI); - - angle = fmod(360 + angle - offset, 360); - - tablet->axes.rotation = angle; - set_bit(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z); -} - -static double -convert_to_degrees(const struct input_absinfo *absinfo, double offset) -{ - /* range is [0, 360[, i.e. range + 1 */ - double range = absinfo->maximum - absinfo->minimum + 1; - double value = (absinfo->value - absinfo->minimum) / range; - - return fmod(value * 360.0 + offset, 360.0); -} - -static inline double -normalize_wheel(struct tablet_dispatch *tablet, - int value) -{ - struct evdev_device *device = tablet->device; - - return value * device->scroll.wheel_click_angle.x; -} - -static inline void -tablet_update_xy(struct tablet_dispatch *tablet, - struct evdev_device *device) -{ - const struct input_absinfo *absinfo; - int value; - - if (bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_X) || - bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_Y)) { - absinfo = libevdev_get_abs_info(device->evdev, ABS_X); - - if (device->left_handed.enabled) - value = invert_axis(absinfo); - else - value = absinfo->value; - - tablet->axes.point.x = value; - - absinfo = libevdev_get_abs_info(device->evdev, ABS_Y); - - if (device->left_handed.enabled) - value = invert_axis(absinfo); - else - value = absinfo->value; - - tablet->axes.point.y = value; - - evdev_transform_absolute(device, &tablet->axes.point); - } -} - -static inline struct normalized_coords -tablet_tool_process_delta(struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool, - const struct evdev_device *device, - struct tablet_axes *axes, - uint64_t time) -{ - const struct normalized_coords zero = { 0.0, 0.0 }; - struct device_coords delta = { 0, 0 }; - struct device_float_coords accel; - - if (!tablet_has_status(tablet, - TABLET_TOOL_ENTERING_PROXIMITY) && - (bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_X) || - bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_Y))) { - delta.x = axes->point.x - tablet->last_smooth_point.x; - delta.y = axes->point.y - tablet->last_smooth_point.y; - } - - tablet->last_smooth_point = axes->point; - - accel.x = 1.0 * delta.x; - accel.y = 1.0 * delta.y; - - if (device_float_is_zero(accel)) - return zero; - - return filter_dispatch(device->pointer.filter, - &accel, - tool, - time); -} - -static inline void -tablet_update_pressure(struct tablet_dispatch *tablet, - struct evdev_device *device, - struct libinput_tablet_tool *tool) -{ - const struct input_absinfo *absinfo; - - if (bit_is_set(tablet->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_PRESSURE)) { - absinfo = libevdev_get_abs_info(device->evdev, ABS_PRESSURE); - tablet->axes.pressure = normalize_pressure(absinfo, tool); - } -} - -static inline void -tablet_update_distance(struct tablet_dispatch *tablet, - struct evdev_device *device) -{ - const struct input_absinfo *absinfo; - - if (bit_is_set(tablet->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_DISTANCE)) { - absinfo = libevdev_get_abs_info(device->evdev, ABS_DISTANCE); - tablet->axes.distance = normalize_distance(absinfo); - } -} - -static inline void -tablet_update_slider(struct tablet_dispatch *tablet, - struct evdev_device *device) -{ - const struct input_absinfo *absinfo; - - if (bit_is_set(tablet->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_SLIDER)) { - absinfo = libevdev_get_abs_info(device->evdev, ABS_WHEEL); - tablet->axes.slider = normalize_slider(absinfo); - } -} - -static inline void -tablet_update_tilt(struct tablet_dispatch *tablet, - struct evdev_device *device) -{ - const struct input_absinfo *absinfo; - - /* mouse rotation resets tilt to 0 so always fetch both axes if - * either has changed */ - if (bit_is_set(tablet->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_TILT_X) || - bit_is_set(tablet->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_TILT_Y)) { - - absinfo = libevdev_get_abs_info(device->evdev, ABS_TILT_X); - tablet->axes.tilt.x = adjust_tilt(absinfo); - - absinfo = libevdev_get_abs_info(device->evdev, ABS_TILT_Y); - tablet->axes.tilt.y = adjust_tilt(absinfo); - - if (device->left_handed.enabled) { - tablet->axes.tilt.x *= -1; - tablet->axes.tilt.y *= -1; - } - } -} - -static inline void -tablet_update_artpen_rotation(struct tablet_dispatch *tablet, - struct evdev_device *device) -{ - const struct input_absinfo *absinfo; - - if (bit_is_set(tablet->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z)) { - absinfo = libevdev_get_abs_info(device->evdev, - ABS_Z); - /* artpen has 0 with buttons pointing east */ - tablet->axes.rotation = convert_to_degrees(absinfo, 90); - } -} - -static inline void -tablet_update_mouse_rotation(struct tablet_dispatch *tablet, - struct evdev_device *device) -{ - if (bit_is_set(tablet->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_TILT_X) || - bit_is_set(tablet->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_TILT_Y)) { - convert_tilt_to_rotation(tablet); - } -} - -static inline void -tablet_update_rotation(struct tablet_dispatch *tablet, - struct evdev_device *device) -{ - /* We must check ROTATION_Z after TILT_X/Y so that the tilt axes are - * already normalized and set if we have the mouse/lens tool */ - if (tablet->current_tool_type == LIBINPUT_TABLET_TOOL_TYPE_MOUSE || - tablet->current_tool_type == LIBINPUT_TABLET_TOOL_TYPE_LENS) { - tablet_update_mouse_rotation(tablet, device); - clear_bit(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_TILT_X); - clear_bit(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_TILT_Y); - tablet->axes.tilt.x = 0; - tablet->axes.tilt.y = 0; - - /* tilt is already converted to left-handed, so mouse - * rotation is converted to left-handed automatically */ - } else { - - tablet_update_artpen_rotation(tablet, device); - - if (device->left_handed.enabled) { - double r = tablet->axes.rotation; - tablet->axes.rotation = fmod(180 + r, 360); - } - } -} - -static inline void -tablet_update_wheel(struct tablet_dispatch *tablet, - struct evdev_device *device) -{ - int a; - - a = LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL; - if (bit_is_set(tablet->changed_axes, a)) { - /* tablet->axes.wheel_discrete is already set */ - tablet->axes.wheel = normalize_wheel(tablet, - tablet->axes.wheel_discrete); - } else { - tablet->axes.wheel = 0; - tablet->axes.wheel_discrete = 0; - } -} - -static void -tablet_smoothen_axes(const struct tablet_dispatch *tablet, - struct tablet_axes *axes) -{ - size_t i; - size_t count = tablet_history_size(tablet); - struct tablet_axes smooth = { 0 }; - - for (i = 0; i < count; i++) { - const struct tablet_axes *a = tablet_history_get(tablet, i); - - smooth.point.x += a->point.x; - smooth.point.y += a->point.y; - - smooth.tilt.x += a->tilt.x; - smooth.tilt.y += a->tilt.y; - } - - axes->point.x = smooth.point.x/count; - axes->point.y = smooth.point.y/count; - - axes->tilt.x = smooth.tilt.x/count; - axes->tilt.y = smooth.tilt.y/count; -} - -static bool -tablet_check_notify_axes(struct tablet_dispatch *tablet, - struct evdev_device *device, - struct libinput_tablet_tool *tool, - struct tablet_axes *axes_out, - uint64_t time) -{ - struct tablet_axes axes = {0}; - const char tmp[sizeof(tablet->changed_axes)] = {0}; - bool rc = false; - - if (memcmp(tmp, tablet->changed_axes, sizeof(tmp)) == 0) { - axes = tablet->axes; - goto out; - } - - tablet_update_xy(tablet, device); - tablet_update_pressure(tablet, device, tool); - tablet_update_distance(tablet, device); - tablet_update_slider(tablet, device); - tablet_update_tilt(tablet, device); - tablet_update_wheel(tablet, device); - /* We must check ROTATION_Z after TILT_X/Y so that the tilt axes are - * already normalized and set if we have the mouse/lens tool */ - tablet_update_rotation(tablet, device); - - axes.point = tablet->axes.point; - axes.pressure = tablet->axes.pressure; - axes.distance = tablet->axes.distance; - axes.slider = tablet->axes.slider; - axes.tilt = tablet->axes.tilt; - axes.wheel = tablet->axes.wheel; - axes.wheel_discrete = tablet->axes.wheel_discrete; - axes.rotation = tablet->axes.rotation; - - rc = true; - -out: - tablet_history_push(tablet, &tablet->axes); - tablet_smoothen_axes(tablet, &axes); - - /* The delta relies on the last *smooth* point, so we do it last */ - axes.delta = tablet_tool_process_delta(tablet, tool, device, &axes, time); - - *axes_out = axes; - - return rc; -} - -static void -tablet_update_button(struct tablet_dispatch *tablet, - uint32_t evcode, - uint32_t enable) -{ - switch (evcode) { - case BTN_LEFT: - case BTN_RIGHT: - case BTN_MIDDLE: - case BTN_SIDE: - case BTN_EXTRA: - case BTN_FORWARD: - case BTN_BACK: - case BTN_TASK: - case BTN_STYLUS: - case BTN_STYLUS2: - break; - default: - evdev_log_info(tablet->device, - "Unhandled button %s (%#x)\n", - libevdev_event_code_get_name(EV_KEY, evcode), - evcode); - return; - } - - if (enable) { - set_bit(tablet->button_state.bits, evcode); - tablet_set_status(tablet, TABLET_BUTTONS_PRESSED); - } else { - clear_bit(tablet->button_state.bits, evcode); - tablet_set_status(tablet, TABLET_BUTTONS_RELEASED); - } -} - -static inline enum libinput_tablet_tool_type -tablet_evcode_to_tool(int code) -{ - enum libinput_tablet_tool_type type; - - switch (code) { - case BTN_TOOL_PEN: type = LIBINPUT_TABLET_TOOL_TYPE_PEN; break; - case BTN_TOOL_RUBBER: type = LIBINPUT_TABLET_TOOL_TYPE_ERASER; break; - case BTN_TOOL_BRUSH: type = LIBINPUT_TABLET_TOOL_TYPE_BRUSH; break; - case BTN_TOOL_PENCIL: type = LIBINPUT_TABLET_TOOL_TYPE_PENCIL; break; - case BTN_TOOL_AIRBRUSH: type = LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH; break; - case BTN_TOOL_MOUSE: type = LIBINPUT_TABLET_TOOL_TYPE_MOUSE; break; - case BTN_TOOL_LENS: type = LIBINPUT_TABLET_TOOL_TYPE_LENS; break; - default: - abort(); - } - - return type; -} - -static void -tablet_process_key(struct tablet_dispatch *tablet, - struct evdev_device *device, - struct input_event *e, - uint64_t time) -{ - switch (e->code) { - case BTN_TOOL_FINGER: - evdev_log_bug_libinput(device, - "Invalid tool 'finger' on tablet interface\n"); - break; - case BTN_TOOL_PEN: - case BTN_TOOL_RUBBER: - case BTN_TOOL_BRUSH: - case BTN_TOOL_PENCIL: - case BTN_TOOL_AIRBRUSH: - case BTN_TOOL_MOUSE: - case BTN_TOOL_LENS: - tablet_update_tool(tablet, - device, - tablet_evcode_to_tool(e->code), - e->value); - break; - case BTN_TOUCH: - if (!bit_is_set(tablet->axis_caps, - LIBINPUT_TABLET_TOOL_AXIS_PRESSURE)) { - if (e->value) - tablet_set_status(tablet, - TABLET_TOOL_ENTERING_CONTACT); - else - tablet_set_status(tablet, - TABLET_TOOL_LEAVING_CONTACT); - } - break; - default: - tablet_update_button(tablet, e->code, e->value); - break; - } -} - -static void -tablet_process_relative(struct tablet_dispatch *tablet, - struct evdev_device *device, - struct input_event *e, - uint64_t time) -{ - enum libinput_tablet_tool_axis axis; - - switch (e->code) { - case REL_WHEEL: - axis = rel_evcode_to_axis(e->code); - if (axis == LIBINPUT_TABLET_TOOL_AXIS_NONE) { - evdev_log_bug_libinput(device, - "Invalid ABS event code %#x\n", - e->code); - break; - } - set_bit(tablet->changed_axes, axis); - tablet->axes.wheel_discrete = -1 * e->value; - tablet_set_status(tablet, TABLET_AXES_UPDATED); - break; - default: - evdev_log_info(device, - "Unhandled relative axis %s (%#x)\n", - libevdev_event_code_get_name(EV_REL, e->code), - e->code); - return; - } -} - -static void -tablet_process_misc(struct tablet_dispatch *tablet, - struct evdev_device *device, - struct input_event *e, - uint64_t time) -{ - switch (e->code) { - case MSC_SERIAL: - if (e->value != -1) - tablet->current_tool_serial = e->value; - - break; - case MSC_SCAN: - break; - default: - evdev_log_info(device, - "Unhandled MSC event code %s (%#x)\n", - libevdev_event_code_get_name(EV_MSC, e->code), - e->code); - break; - } -} - -static inline void -copy_axis_cap(const struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool, - enum libinput_tablet_tool_axis axis) -{ - if (bit_is_set(tablet->axis_caps, axis)) - set_bit(tool->axis_caps, axis); -} - -static inline void -copy_button_cap(const struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool, - uint32_t button) -{ - struct libevdev *evdev = tablet->device->evdev; - if (libevdev_has_event_code(evdev, EV_KEY, button)) - set_bit(tool->buttons, button); -} - -static inline int -tool_set_bits_from_libwacom(const struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool) -{ - int rc = 1; - -#if HAVE_LIBWACOM - WacomDeviceDatabase *db; - const WacomStylus *s = NULL; - int code; - WacomStylusType type; - WacomAxisTypeFlags axes; - - db = libwacom_database_new(); - if (!db) { - evdev_log_info(tablet->device, - "Failed to initialize libwacom context.\n"); - goto out; - } - s = libwacom_stylus_get_for_id(db, tool->tool_id); - if (!s) - goto out; - - type = libwacom_stylus_get_type(s); - if (type == WSTYLUS_PUCK) { - for (code = BTN_LEFT; - code < BTN_LEFT + libwacom_stylus_get_num_buttons(s); - code++) - copy_button_cap(tablet, tool, code); - } else { - if (libwacom_stylus_get_num_buttons(s) >= 2) - copy_button_cap(tablet, tool, BTN_STYLUS2); - if (libwacom_stylus_get_num_buttons(s) >= 1) - copy_button_cap(tablet, tool, BTN_STYLUS); - } - - if (libwacom_stylus_has_wheel(s)) - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL); - - axes = libwacom_stylus_get_axes(s); - - if (axes & WACOM_AXIS_TYPE_TILT) { - /* tilt on the puck is converted to rotation */ - if (type == WSTYLUS_PUCK) { - set_bit(tool->axis_caps, - LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z); - } else { - copy_axis_cap(tablet, - tool, - LIBINPUT_TABLET_TOOL_AXIS_TILT_X); - copy_axis_cap(tablet, - tool, - LIBINPUT_TABLET_TOOL_AXIS_TILT_Y); - } - } - if (axes & WACOM_AXIS_TYPE_ROTATION_Z) - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z); - if (axes & WACOM_AXIS_TYPE_DISTANCE) - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_DISTANCE); - if (axes & WACOM_AXIS_TYPE_SLIDER) - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_SLIDER); - if (axes & WACOM_AXIS_TYPE_PRESSURE) - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_PRESSURE); - - rc = 0; -out: - if (db) - libwacom_database_destroy(db); -#endif - return rc; -} - -static void -tool_set_bits(const struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool) -{ - enum libinput_tablet_tool_type type = tool->type; - - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_X); - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_Y); - -#if HAVE_LIBWACOM - if (tool_set_bits_from_libwacom(tablet, tool) == 0) - return; -#endif - /* If we don't have libwacom, we simply copy any axis we have on the - tablet onto the tool. Except we know that mice only have rotation - anyway. - */ - switch (type) { - case LIBINPUT_TABLET_TOOL_TYPE_PEN: - case LIBINPUT_TABLET_TOOL_TYPE_ERASER: - case LIBINPUT_TABLET_TOOL_TYPE_PENCIL: - case LIBINPUT_TABLET_TOOL_TYPE_BRUSH: - case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH: - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_PRESSURE); - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_DISTANCE); - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_TILT_X); - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_TILT_Y); - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_SLIDER); - - /* Rotation is special, it can be either ABS_Z or - * BTN_TOOL_MOUSE+ABS_TILT_X/Y. Aiptek tablets have - * mouse+tilt (and thus rotation), but they do not have - * ABS_Z. So let's not copy the axis bit if we don't have - * ABS_Z, otherwise we try to get the value from it later on - * proximity in and go boom because the absinfo isn't there. - */ - if (libevdev_has_event_code(tablet->device->evdev, EV_ABS, - ABS_Z)) - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z); - break; - case LIBINPUT_TABLET_TOOL_TYPE_MOUSE: - case LIBINPUT_TABLET_TOOL_TYPE_LENS: - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z); - copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL); - break; - default: - break; - } - - /* If we don't have libwacom, copy all pen-related buttons from the - tablet vs all mouse-related buttons */ - switch (type) { - case LIBINPUT_TABLET_TOOL_TYPE_PEN: - case LIBINPUT_TABLET_TOOL_TYPE_BRUSH: - case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH: - case LIBINPUT_TABLET_TOOL_TYPE_PENCIL: - case LIBINPUT_TABLET_TOOL_TYPE_ERASER: - copy_button_cap(tablet, tool, BTN_STYLUS); - copy_button_cap(tablet, tool, BTN_STYLUS2); - break; - case LIBINPUT_TABLET_TOOL_TYPE_MOUSE: - case LIBINPUT_TABLET_TOOL_TYPE_LENS: - copy_button_cap(tablet, tool, BTN_LEFT); - copy_button_cap(tablet, tool, BTN_MIDDLE); - copy_button_cap(tablet, tool, BTN_RIGHT); - copy_button_cap(tablet, tool, BTN_SIDE); - copy_button_cap(tablet, tool, BTN_EXTRA); - break; - default: - break; - } -} - -static inline int -axis_range_percentage(const struct input_absinfo *a, double percent) -{ - return (a->maximum - a->minimum) * percent/100.0 + a->minimum; -} - -static struct libinput_tablet_tool * -tablet_get_tool(struct tablet_dispatch *tablet, - enum libinput_tablet_tool_type type, - uint32_t tool_id, - uint32_t serial) -{ - struct libinput *libinput = tablet_libinput_context(tablet); - struct libinput_tablet_tool *tool = NULL, *t; - struct list *tool_list; - - if (serial) { - tool_list = &libinput->tool_list; - /* Check if we already have the tool in our list of tools */ - list_for_each(t, tool_list, link) { - if (type == t->type && serial == t->serial) { - tool = t; - break; - } - } - } - - /* If we get a tool with a delayed serial number, we already created - * a 0-serial number tool for it earlier. Re-use that, even though - * it means we can't distinguish this tool from others. - * https://bugs.freedesktop.org/show_bug.cgi?id=97526 - */ - if (!tool) { - tool_list = &tablet->tool_list; - /* We can't guarantee that tools without serial numbers are - * unique, so we keep them local to the tablet that they come - * into proximity of instead of storing them in the global tool - * list - * Same as above, but don't bother checking the serial number - */ - list_for_each(t, tool_list, link) { - if (type == t->type) { - tool = t; - break; - } - } - - /* Didn't find the tool but we have a serial. Switch - * tool_list back so we create in the correct list */ - if (!tool && serial) - tool_list = &libinput->tool_list; - } - - /* If we didn't already have the new_tool in our list of tools, - * add it */ - if (!tool) { - const struct input_absinfo *pressure; - - tool = zalloc(sizeof *tool); - - *tool = (struct libinput_tablet_tool) { - .type = type, - .serial = serial, - .tool_id = tool_id, - .refcount = 1, - }; - - tool->pressure_offset = 0; - tool->has_pressure_offset = false; - tool->pressure_threshold.lower = 0; - tool->pressure_threshold.upper = 1; - - pressure = libevdev_get_abs_info(tablet->device->evdev, - ABS_PRESSURE); - if (pressure) { - tool->pressure_offset = pressure->minimum; - - /* 5 and 1% of the pressure range */ - tool->pressure_threshold.upper = - axis_range_percentage(pressure, 5); - tool->pressure_threshold.lower = - axis_range_percentage(pressure, 1); - } - - tool_set_bits(tablet, tool); - - list_insert(tool_list, &tool->link); - } - - return tool; -} - -static void -tablet_notify_button_mask(struct tablet_dispatch *tablet, - struct evdev_device *device, - uint64_t time, - struct libinput_tablet_tool *tool, - const struct button_state *buttons, - enum libinput_button_state state) -{ - struct libinput_device *base = &device->base; - size_t i; - size_t nbits = 8 * sizeof(buttons->bits); - enum libinput_tablet_tool_tip_state tip_state; - - tip_state = tablet_has_status(tablet, TABLET_TOOL_IN_CONTACT) ? - LIBINPUT_TABLET_TOOL_TIP_DOWN : LIBINPUT_TABLET_TOOL_TIP_UP; - - for (i = 0; i < nbits; i++) { - if (!bit_is_set(buttons->bits, i)) - continue; - - tablet_notify_button(base, - time, - tool, - tip_state, - &tablet->axes, - i, - state); - } -} - -static void -tablet_notify_buttons(struct tablet_dispatch *tablet, - struct evdev_device *device, - uint64_t time, - struct libinput_tablet_tool *tool, - enum libinput_button_state state) -{ - struct button_state buttons; - - if (state == LIBINPUT_BUTTON_STATE_PRESSED) - tablet_get_pressed_buttons(tablet, &buttons); - else - tablet_get_released_buttons(tablet, &buttons); - - tablet_notify_button_mask(tablet, - device, - time, - tool, - &buttons, - state); -} - -static void -sanitize_pressure_distance(struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool) -{ - bool tool_in_contact; - const struct input_absinfo *distance, - *pressure; - - distance = libevdev_get_abs_info(tablet->device->evdev, ABS_DISTANCE); - pressure = libevdev_get_abs_info(tablet->device->evdev, ABS_PRESSURE); - - if (!pressure || !distance) - return; - - if (!bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_DISTANCE) && - !bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_PRESSURE)) - return; - - tool_in_contact = (pressure->value > tool->pressure_offset); - - /* Keep distance and pressure mutually exclusive */ - if (distance && - (bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_DISTANCE) || - bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_PRESSURE)) && - distance->value > distance->minimum && - pressure->value > pressure->minimum) { - if (tool_in_contact) { - clear_bit(tablet->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_DISTANCE); - tablet->axes.distance = 0; - } else { - clear_bit(tablet->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_PRESSURE); - tablet->axes.pressure = 0; - } - } else if (bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_PRESSURE) && - !tool_in_contact) { - /* Make sure that the last axis value sent to the caller is a 0 */ - if (tablet->axes.pressure == 0) - clear_bit(tablet->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_PRESSURE); - else - tablet->axes.pressure = 0; - } -} - -static inline void -sanitize_mouse_lens_rotation(struct tablet_dispatch *tablet) -{ - /* If we have a mouse/lens cursor and the tilt changed, the rotation - changed. Mark this, calculate the angle later */ - if ((tablet->current_tool_type == LIBINPUT_TABLET_TOOL_TYPE_MOUSE || - tablet->current_tool_type == LIBINPUT_TABLET_TOOL_TYPE_LENS) && - (bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_TILT_X) || - bit_is_set(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_TILT_Y))) - set_bit(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z); -} - -static void -sanitize_tablet_axes(struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool) -{ - sanitize_pressure_distance(tablet, tool); - sanitize_mouse_lens_rotation(tablet); -} - -static void -detect_pressure_offset(struct tablet_dispatch *tablet, - struct evdev_device *device, - struct libinput_tablet_tool *tool) -{ - const struct input_absinfo *pressure, *distance; - int offset; - - if (!bit_is_set(tablet->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_PRESSURE)) - return; - - pressure = libevdev_get_abs_info(device->evdev, ABS_PRESSURE); - distance = libevdev_get_abs_info(device->evdev, ABS_DISTANCE); - - if (!pressure || !distance) - return; - - offset = pressure->value - pressure->minimum; - - if (tool->has_pressure_offset) { - if (offset < tool->pressure_offset) - tool->pressure_offset = offset; - return; - } - - if (offset == 0) - return; - - /* we only set a pressure offset on proximity in */ - if (!tablet_has_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY)) - return; - - /* If we're closer than 50% of the distance axis, skip pressure - * offset detection, too likely to be wrong */ - if (distance->value < axis_range_percentage(distance, 50)) - return; - - if (offset > axis_range_percentage(pressure, 20)) { - evdev_log_error(device, - "Ignoring pressure offset greater than 20%% detected on tool %s (serial %#x). " - "See http://wayland.freedesktop.org/libinput/doc/%s/tablet-support.html\n", - tablet_tool_type_to_string(tool->type), - tool->serial, - LIBINPUT_VERSION); - return; - } - - evdev_log_info(device, - "Pressure offset detected on tool %s (serial %#x). " - "See http://wayland.freedesktop.org/libinput/doc/%s/tablet-support.html\n", - tablet_tool_type_to_string(tool->type), - tool->serial, - LIBINPUT_VERSION); - tool->pressure_offset = offset; - tool->has_pressure_offset = true; - tool->pressure_threshold.lower = pressure->minimum; -} - -static void -detect_tool_contact(struct tablet_dispatch *tablet, - struct evdev_device *device, - struct libinput_tablet_tool *tool) -{ - const struct input_absinfo *p; - int pressure; - - if (!bit_is_set(tool->axis_caps, LIBINPUT_TABLET_TOOL_AXIS_PRESSURE)) - return; - - /* if we have pressure, always use that for contact, not BTN_TOUCH */ - if (tablet_has_status(tablet, TABLET_TOOL_ENTERING_CONTACT)) - evdev_log_bug_libinput(device, - "Invalid status: entering contact\n"); - if (tablet_has_status(tablet, TABLET_TOOL_LEAVING_CONTACT) && - !tablet_has_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY)) - evdev_log_bug_libinput(device, - "Invalid status: leaving contact\n"); - - p = libevdev_get_abs_info(tablet->device->evdev, ABS_PRESSURE); - if (!p) { - evdev_log_bug_libinput(device, - "Missing pressure axis\n"); - return; - } - pressure = p->value; - - if (tool->has_pressure_offset) - pressure -= (tool->pressure_offset - p->minimum); - - if (pressure <= tool->pressure_threshold.lower && - tablet_has_status(tablet, TABLET_TOOL_IN_CONTACT)) { - tablet_set_status(tablet, TABLET_TOOL_LEAVING_CONTACT); - } else if (pressure >= tool->pressure_threshold.upper && - !tablet_has_status(tablet, TABLET_TOOL_IN_CONTACT)) { - tablet_set_status(tablet, TABLET_TOOL_ENTERING_CONTACT); - } -} - -static void -tablet_mark_all_axes_changed(struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool) -{ - static_assert(sizeof(tablet->changed_axes) == - sizeof(tool->axis_caps), - "Mismatching array sizes"); - - memcpy(tablet->changed_axes, - tool->axis_caps, - sizeof(tablet->changed_axes)); -} - -static void -tablet_update_proximity_state(struct tablet_dispatch *tablet, - struct evdev_device *device, - struct libinput_tablet_tool *tool) -{ - const struct input_absinfo *distance; - int dist_max = tablet->cursor_proximity_threshold; - int dist; - - distance = libevdev_get_abs_info(tablet->device->evdev, ABS_DISTANCE); - if (!distance) - return; - - dist = distance->value; - if (dist == 0) - return; - - /* Tool got into permitted range */ - if (dist < dist_max && - (tablet_has_status(tablet, TABLET_TOOL_OUT_OF_RANGE) || - tablet_has_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY))) { - tablet_unset_status(tablet, - TABLET_TOOL_OUT_OF_RANGE); - tablet_unset_status(tablet, - TABLET_TOOL_OUT_OF_PROXIMITY); - tablet_set_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY); - tablet_mark_all_axes_changed(tablet, tool); - - tablet_set_status(tablet, TABLET_BUTTONS_PRESSED); - tablet_force_button_presses(tablet); - return; - } - - if (dist < dist_max) - return; - - /* Still out of range/proximity */ - if (tablet_has_status(tablet, TABLET_TOOL_OUT_OF_RANGE) || - tablet_has_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY)) - return; - - /* Tool entered prox but is outside of permitted range */ - if (tablet_has_status(tablet, - TABLET_TOOL_ENTERING_PROXIMITY)) { - tablet_set_status(tablet, - TABLET_TOOL_OUT_OF_RANGE); - tablet_unset_status(tablet, - TABLET_TOOL_ENTERING_PROXIMITY); - return; - } - - /* Tool was in prox and is now outside of range. Set leaving - * proximity, on the next event it will be OUT_OF_PROXIMITY and thus - * caught by the above conditions */ - tablet_set_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY); -} - -static inline bool -tablet_send_proximity_in(struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool, - struct evdev_device *device, - struct tablet_axes *axes, - uint64_t time) -{ - if (!tablet_has_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY)) - return false; - - tablet_notify_proximity(&device->base, - time, - tool, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN, - tablet->changed_axes, - axes); - tablet_unset_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY); - tablet_unset_status(tablet, TABLET_AXES_UPDATED); - - tablet_reset_changed_axes(tablet); - axes->delta.x = 0; - axes->delta.y = 0; - - return true; -} - -static inline bool -tablet_send_proximity_out(struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool, - struct evdev_device *device, - struct tablet_axes *axes, - uint64_t time) -{ - if (!tablet_has_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY)) - return false; - - tablet_notify_proximity(&device->base, - time, - tool, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT, - tablet->changed_axes, - axes); - - tablet_set_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY); - tablet_unset_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY); - - tablet_reset_changed_axes(tablet); - axes->delta.x = 0; - axes->delta.y = 0; - - return true; -} - -static inline bool -tablet_send_tip(struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool, - struct evdev_device *device, - struct tablet_axes *axes, - uint64_t time) -{ - if (tablet_has_status(tablet, TABLET_TOOL_ENTERING_CONTACT)) { - tablet_notify_tip(&device->base, - time, - tool, - LIBINPUT_TABLET_TOOL_TIP_DOWN, - tablet->changed_axes, - axes); - tablet_unset_status(tablet, TABLET_AXES_UPDATED); - tablet_unset_status(tablet, TABLET_TOOL_ENTERING_CONTACT); - tablet_set_status(tablet, TABLET_TOOL_IN_CONTACT); - - tablet_reset_changed_axes(tablet); - axes->delta.x = 0; - axes->delta.y = 0; - - return true; - } - - if (tablet_has_status(tablet, TABLET_TOOL_LEAVING_CONTACT)) { - tablet_notify_tip(&device->base, - time, - tool, - LIBINPUT_TABLET_TOOL_TIP_UP, - tablet->changed_axes, - axes); - tablet_unset_status(tablet, TABLET_AXES_UPDATED); - tablet_unset_status(tablet, TABLET_TOOL_LEAVING_CONTACT); - tablet_unset_status(tablet, TABLET_TOOL_IN_CONTACT); - - tablet_reset_changed_axes(tablet); - axes->delta.x = 0; - axes->delta.y = 0; - - return true; - } - - return false; -} - -static inline void -tablet_send_axes(struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool, - struct evdev_device *device, - struct tablet_axes *axes, - uint64_t time) -{ - enum libinput_tablet_tool_tip_state tip_state; - - if (!tablet_has_status(tablet, TABLET_AXES_UPDATED)) - return; - - if (tablet_has_status(tablet, - TABLET_TOOL_IN_CONTACT)) - tip_state = LIBINPUT_TABLET_TOOL_TIP_DOWN; - else - tip_state = LIBINPUT_TABLET_TOOL_TIP_UP; - - tablet_notify_axis(&device->base, - time, - tool, - tip_state, - tablet->changed_axes, - axes); - tablet_unset_status(tablet, TABLET_AXES_UPDATED); - tablet_reset_changed_axes(tablet); - axes->delta.x = 0; - axes->delta.y = 0; -} - -static inline void -tablet_send_buttons(struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool, - struct evdev_device *device, - uint64_t time) -{ - if (tablet_has_status(tablet, TABLET_BUTTONS_RELEASED)) { - tablet_notify_buttons(tablet, - device, - time, - tool, - LIBINPUT_BUTTON_STATE_RELEASED); - tablet_unset_status(tablet, TABLET_BUTTONS_RELEASED); - } - - if (tablet_has_status(tablet, TABLET_BUTTONS_PRESSED)) { - tablet_notify_buttons(tablet, - device, - time, - tool, - LIBINPUT_BUTTON_STATE_PRESSED); - tablet_unset_status(tablet, TABLET_BUTTONS_PRESSED); - } -} - -static void -tablet_send_events(struct tablet_dispatch *tablet, - struct libinput_tablet_tool *tool, - struct evdev_device *device, - uint64_t time) -{ - struct tablet_axes axes = {0}; - - if (tablet_has_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY)) { - /* Tool is leaving proximity, we can't rely on the last axis - * information (it'll be mostly 0), so we just get the - * current state and skip over updating the axes. - */ - axes = tablet->axes; - - /* Dont' send an axis event, but we may have a tip event - * update */ - tablet_unset_status(tablet, TABLET_AXES_UPDATED); - } else { - tablet_check_notify_axes(tablet, device, tool, &axes, time); - } - - assert(tablet->axes.delta.x == 0); - assert(tablet->axes.delta.y == 0); - - tablet_send_proximity_in(tablet, tool, device, &axes, time); - if (!tablet_send_tip(tablet, tool, device, &axes, time)) - tablet_send_axes(tablet, tool, device, &axes, time); - - tablet_unset_status(tablet, TABLET_TOOL_ENTERING_CONTACT); - tablet_reset_changed_axes(tablet); - - tablet_send_buttons(tablet, tool, device, time); - - if (tablet_send_proximity_out(tablet, tool, device, &axes, time)) { - tablet_change_to_left_handed(device); - tablet_history_reset(tablet); - } -} - -static void -tablet_flush(struct tablet_dispatch *tablet, - struct evdev_device *device, - uint64_t time) -{ - struct libinput_tablet_tool *tool = - tablet_get_tool(tablet, - tablet->current_tool_type, - tablet->current_tool_id, - tablet->current_tool_serial); - - if (!tool) - return; /* OOM */ - - if (tool->type == LIBINPUT_TABLET_TOOL_TYPE_MOUSE || - tool->type == LIBINPUT_TABLET_TOOL_TYPE_LENS) - tablet_update_proximity_state(tablet, device, tool); - - if (tablet_has_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY) || - tablet_has_status(tablet, TABLET_TOOL_OUT_OF_RANGE)) - return; - - if (tablet_has_status(tablet, TABLET_TOOL_LEAVING_PROXIMITY)) { - /* Release all stylus buttons */ - memset(tablet->button_state.bits, - 0, - sizeof(tablet->button_state.bits)); - tablet_set_status(tablet, TABLET_BUTTONS_RELEASED); - if (tablet_has_status(tablet, TABLET_TOOL_IN_CONTACT)) - tablet_set_status(tablet, TABLET_TOOL_LEAVING_CONTACT); - } else if (tablet_has_status(tablet, TABLET_AXES_UPDATED) || - tablet_has_status(tablet, TABLET_TOOL_ENTERING_PROXIMITY)) { - if (tablet_has_status(tablet, - TABLET_TOOL_ENTERING_PROXIMITY)) - tablet_mark_all_axes_changed(tablet, tool); - detect_pressure_offset(tablet, device, tool); - detect_tool_contact(tablet, device, tool); - sanitize_tablet_axes(tablet, tool); - } - - tablet_send_events(tablet, tool, device, time); -} - -static inline void -tablet_set_touch_device_enabled(struct evdev_device *touch_device, - bool enable) -{ - struct evdev_dispatch *dispatch; - - if (touch_device == NULL) - return; - - dispatch = touch_device->dispatch; - if (dispatch->interface->toggle_touch) - dispatch->interface->toggle_touch(dispatch, - touch_device, - enable); -} - -static inline void -tablet_toggle_touch_device(struct tablet_dispatch *tablet, - struct evdev_device *tablet_device) -{ - bool enable_events; - - enable_events = tablet_has_status(tablet, - TABLET_TOOL_OUT_OF_RANGE) || - tablet_has_status(tablet, TABLET_NONE) || - tablet_has_status(tablet, - TABLET_TOOL_LEAVING_PROXIMITY) || - tablet_has_status(tablet, - TABLET_TOOL_OUT_OF_PROXIMITY); - - tablet_set_touch_device_enabled(tablet->touch_device, enable_events); -} - -static inline void -tablet_reset_state(struct tablet_dispatch *tablet) -{ - /* Update state */ - memcpy(&tablet->prev_button_state, - &tablet->button_state, - sizeof(tablet->button_state)); -} - -static inline void -tablet_proximity_out_quirk_set_timer(struct tablet_dispatch *tablet, - uint64_t time) -{ - libinput_timer_set(&tablet->quirks.prox_out_timer, - time + FORCED_PROXOUT_TIMEOUT); -} - -static void -tablet_proximity_out_quirk_timer_func(uint64_t now, void *data) -{ - struct tablet_dispatch *tablet = data; - struct input_event events[2] = { - { .time = us2tv(now), - .type = EV_KEY, - .code = BTN_TOOL_PEN, - .value = 0 }, - { .time = us2tv(now), - .type = EV_SYN, - .code = SYN_REPORT, - .value = 0 }, - }; - struct input_event *e; - - if (tablet->quirks.last_event_time > now - FORCED_PROXOUT_TIMEOUT) { - tablet_proximity_out_quirk_set_timer(tablet, - tablet->quirks.last_event_time); - return; - } - - tablet->quirks.proximity_out_in_progress = true; - ARRAY_FOR_EACH(events, e) { - tablet->base.interface->process(&tablet->base, - tablet->device, - e, - now); - } - tablet->quirks.proximity_out_in_progress = false; - - tablet->quirks.proximity_out_forced = true; -} - -/** - * Handling for the proximity out workaround. Some tablets only send - * BTN_TOOL_PEN on the very first event, then leave it set even when the pen - * leaves the detectable range. To libinput this looks like we always have - * the pen in proximity. - * - * To avoid this, we set a timer on BTN_TOOL_PEN in. We expect the tablet to - * continuously send events, and while it's doing so we keep updating the - * timer. Once we go Xms without an event we assume proximity out and inject - * a BTN_TOOL_PEN event into the sequence through the timer func. - * - * We need to remember that we did that, on the first event after the - * timeout we need to inject a BTN_TOOL_PEN event again to force proximity - * in. - */ -static inline void -tablet_proximity_out_quirk_update(struct tablet_dispatch *tablet, - struct evdev_device *device, - struct input_event *e, - uint64_t time) -{ - if (!tablet->quirks.need_to_force_prox_out) - return; - - if (e->type == EV_SYN) { - /* If the timer function forced prox out before, - fake a BTN_TOOL_PEN event */ - if (tablet->quirks.proximity_out_forced) { - - struct input_event fake_event = { - .time = us2tv(time), - .type = EV_KEY, - .code = BTN_TOOL_PEN, - .value = 1, - }; - - tablet->base.interface->process(&tablet->base, - device, - &fake_event, - time); - tablet->quirks.proximity_out_forced = false; - } - tablet->quirks.last_event_time = time; - } else if (e->type == EV_KEY && e->code == BTN_TOOL_PEN) { - if (e->value) { - tablet_proximity_out_quirk_set_timer(tablet, time); - } else { - /* If we get a BTN_TOOL_PEN 0 when *not* injecting - * events it means the tablet will give us the right - * events after all and we can disable our - * timer-based proximity out. - */ - if (!tablet->quirks.proximity_out_in_progress) - tablet->quirks.need_to_force_prox_out = false; - - libinput_timer_cancel(&tablet->quirks.prox_out_timer); - } - } -} - -static void -tablet_process(struct evdev_dispatch *dispatch, - struct evdev_device *device, - struct input_event *e, - uint64_t time) -{ - struct tablet_dispatch *tablet = tablet_dispatch(dispatch); - - /* Warning: this may inject events */ - tablet_proximity_out_quirk_update(tablet, device, e, time); - - switch (e->type) { - case EV_ABS: - tablet_process_absolute(tablet, device, e, time); - break; - case EV_REL: - tablet_process_relative(tablet, device, e, time); - break; - case EV_KEY: - tablet_process_key(tablet, device, e, time); - break; - case EV_MSC: - tablet_process_misc(tablet, device, e, time); - break; - case EV_SYN: - tablet_flush(tablet, device, time); - tablet_toggle_touch_device(tablet, device); - tablet_reset_state(tablet); - break; - default: - evdev_log_error(device, - "Unexpected event type %s (%#x)\n", - libevdev_event_type_get_name(e->type), - e->type); - break; - } -} - -static void -tablet_suspend(struct evdev_dispatch *dispatch, - struct evdev_device *device) -{ - struct tablet_dispatch *tablet = tablet_dispatch(dispatch); - - tablet_set_touch_device_enabled(tablet->touch_device, true); -} - -static void -tablet_destroy(struct evdev_dispatch *dispatch) -{ - struct tablet_dispatch *tablet = tablet_dispatch(dispatch); - struct libinput_tablet_tool *tool, *tmp; - - libinput_timer_cancel(&tablet->quirks.prox_out_timer); - libinput_timer_destroy(&tablet->quirks.prox_out_timer); - - list_for_each_safe(tool, tmp, &tablet->tool_list, link) { - libinput_tablet_tool_unref(tool); - } - - free(tablet); -} - -static void -tablet_device_added(struct evdev_device *device, - struct evdev_device *added_device) -{ - struct tablet_dispatch *tablet = tablet_dispatch(device->dispatch); - - if (libinput_device_get_device_group(&device->base) != - libinput_device_get_device_group(&added_device->base)) - return; - - /* Touch screens or external touchpads only */ - if (evdev_device_has_capability(added_device, LIBINPUT_DEVICE_CAP_TOUCH) || - (evdev_device_has_capability(added_device, LIBINPUT_DEVICE_CAP_POINTER) && - (added_device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD))) - tablet->touch_device = added_device; -} - -static void -tablet_device_removed(struct evdev_device *device, - struct evdev_device *removed_device) -{ - struct tablet_dispatch *tablet = tablet_dispatch(device->dispatch); - - if (tablet->touch_device == removed_device) - tablet->touch_device = NULL; -} - -static void -tablet_check_initial_proximity(struct evdev_device *device, - struct evdev_dispatch *dispatch) -{ - struct tablet_dispatch *tablet = tablet_dispatch(dispatch); - struct libinput *li = tablet_libinput_context(tablet); - bool tool_in_prox = false; - int code, state; - enum libinput_tablet_tool_type tool; - - for (tool = LIBINPUT_TABLET_TOOL_TYPE_PEN; - tool <= LIBINPUT_TABLET_TOOL_TYPE_MAX; - tool++) { - code = tablet_tool_to_evcode(tool); - - /* we only expect one tool to be in proximity at a time */ - if (libevdev_fetch_event_value(device->evdev, - EV_KEY, - code, - &state) && state) { - tool_in_prox = true; - break; - } - } - - if (!tool_in_prox) - return; - - tablet_update_tool(tablet, device, tool, state); - if (tablet->quirks.need_to_force_prox_out) - tablet_proximity_out_quirk_set_timer(tablet, libinput_now(li)); - - tablet->current_tool_id = - libevdev_get_event_value(device->evdev, - EV_ABS, - ABS_MISC); - - /* we can't fetch MSC_SERIAL from the kernel, so we set the serial - * to 0 for now. On the first real event from the device we get the - * serial (if any) and that event will be converted into a proximity - * event */ - tablet->current_tool_serial = 0; -} - -static struct evdev_dispatch_interface tablet_interface = { - .process = tablet_process, - .suspend = tablet_suspend, - .remove = NULL, - .destroy = tablet_destroy, - .device_added = tablet_device_added, - .device_removed = tablet_device_removed, - .device_suspended = NULL, - .device_resumed = NULL, - .post_added = tablet_check_initial_proximity, - .toggle_touch = NULL, - .get_switch_state = NULL, -}; - -static void -tablet_init_calibration(struct tablet_dispatch *tablet, - struct evdev_device *device) -{ - if (libevdev_has_property(device->evdev, INPUT_PROP_DIRECT)) - evdev_init_calibration(device, &tablet->calibration); -} - -static void -tablet_init_proximity_threshold(struct tablet_dispatch *tablet, - struct evdev_device *device) -{ - /* This rules out most of the bamboos and other devices, we're - * pretty much down to - */ - if (!libevdev_has_event_code(device->evdev, EV_KEY, BTN_TOOL_MOUSE) && - !libevdev_has_event_code(device->evdev, EV_KEY, BTN_TOOL_LENS)) - return; - - /* 42 is the default proximity threshold the xf86-input-wacom driver - * uses for Intuos/Cintiq models. Graphire models have a threshold - * of 10 but since they haven't been manufactured in ages and the - * intersection of users having a graphire, running libinput and - * wanting to use the mouse/lens cursor tool is small enough to not - * worry about it for now. If we need to, we can introduce a udev - * property later. - * - * Value is in device coordinates. - */ - tablet->cursor_proximity_threshold = 42; -} - -static uint32_t -tablet_accel_config_get_profiles(struct libinput_device *libinput_device) -{ - return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE; -} - -static enum libinput_config_status -tablet_accel_config_set_profile(struct libinput_device *libinput_device, - enum libinput_config_accel_profile profile) -{ - return LIBINPUT_CONFIG_STATUS_UNSUPPORTED; -} - -static enum libinput_config_accel_profile -tablet_accel_config_get_profile(struct libinput_device *libinput_device) -{ - return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE; -} - -static enum libinput_config_accel_profile -tablet_accel_config_get_default_profile(struct libinput_device *libinput_device) -{ - return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE; -} - -static int -tablet_init_accel(struct tablet_dispatch *tablet, struct evdev_device *device) -{ - const struct input_absinfo *x, *y; - struct motion_filter *filter; - - x = device->abs.absinfo_x; - y = device->abs.absinfo_y; - - filter = create_pointer_accelerator_filter_tablet(x->resolution, - y->resolution); - if (!filter) - return -1; - - evdev_device_init_pointer_acceleration(device, filter); - - /* we override the profile hooks for accel configuration with hooks - * that don't allow selection of profiles */ - device->pointer.config.get_profiles = tablet_accel_config_get_profiles; - device->pointer.config.set_profile = tablet_accel_config_set_profile; - device->pointer.config.get_profile = tablet_accel_config_get_profile; - device->pointer.config.get_default_profile = tablet_accel_config_get_default_profile; - - return 0; -} - -static void -tablet_init_left_handed(struct evdev_device *device) -{ - if (evdev_tablet_has_left_handed(device)) - evdev_init_left_handed(device, - tablet_change_to_left_handed); -} - -static int -tablet_reject_device(struct evdev_device *device) -{ - struct libevdev *evdev = device->evdev; - double w, h; - bool has_xy, has_pen, has_btn_stylus, has_size; - - has_xy = libevdev_has_event_code(evdev, EV_ABS, ABS_X) && - libevdev_has_event_code(evdev, EV_ABS, ABS_Y); - has_pen = libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_PEN); - has_btn_stylus = libevdev_has_event_code(evdev, EV_KEY, BTN_STYLUS); - has_size = evdev_device_get_size(device, &w, &h) == 0; - - if (has_xy && (has_pen || has_btn_stylus) && has_size) - return 0; - - evdev_log_bug_libinput(device, - "missing tablet capabilities:%s%s%s%s." - "Ignoring this device.\n", - has_xy ? "" : " xy", - has_pen ? "" : " pen", - has_btn_stylus ? "" : " btn-stylus", - has_size ? "" : " resolution"); - return -1; -} - -static int -tablet_init(struct tablet_dispatch *tablet, - struct evdev_device *device) -{ - struct libevdev *evdev = device->evdev; - enum libinput_tablet_tool_axis axis; - bool want_proximity_quirk = false; - int rc; - - tablet->base.dispatch_type = DISPATCH_TABLET; - tablet->base.interface = &tablet_interface; - tablet->device = device; - tablet->status = TABLET_NONE; - tablet->current_tool_type = LIBINPUT_TOOL_NONE; - list_init(&tablet->tool_list); - - if (tablet_reject_device(device)) - return -1; - - tablet_init_calibration(tablet, device); - tablet_init_proximity_threshold(tablet, device); - rc = tablet_init_accel(tablet, device); - if (rc != 0) - return rc; - - tablet_init_left_handed(device); - - for (axis = LIBINPUT_TABLET_TOOL_AXIS_X; - axis <= LIBINPUT_TABLET_TOOL_AXIS_MAX; - axis++) { - if (tablet_device_has_axis(tablet, axis)) - set_bit(tablet->axis_caps, axis); - } - - tablet_set_status(tablet, TABLET_TOOL_OUT_OF_PROXIMITY); - - if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_PEN)) { - libevdev_enable_event_code(evdev, EV_KEY, BTN_TOOL_PEN, NULL); - want_proximity_quirk = true; - tablet->quirks.proximity_out_forced = true; - } - - if (device->model_flags & EVDEV_MODEL_TABLET_NO_PROXIMITY_OUT) - want_proximity_quirk = true; - - if (want_proximity_quirk) { - tablet->quirks.need_to_force_prox_out = true; - libinput_timer_init(&tablet->quirks.prox_out_timer, - tablet_libinput_context(tablet), - "proxout", - tablet_proximity_out_quirk_timer_func, - tablet); - } - - return 0; -} - -struct evdev_dispatch * -evdev_tablet_create(struct evdev_device *device) -{ - struct tablet_dispatch *tablet; - - tablet = zalloc(sizeof *tablet); - - if (tablet_init(tablet, device) != 0) { - tablet_destroy(&tablet->base); - return NULL; - } - - return &tablet->base; -} diff -Nru libinput-1.10.3/src/evdev-tablet.h libinput-0.21.0/src/evdev-tablet.h --- libinput-1.10.3/src/evdev-tablet.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-tablet.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,244 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * Copyright © 2014 Lyude Paul - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the copyright holders not be used in - * advertising or publicity pertaining to distribution of the software - * without specific, written prior permission. The copyright holders make - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef EVDEV_TABLET_H -#define EVDEV_TABLET_H - -#include "evdev.h" - -#define LIBINPUT_TABLET_TOOL_AXIS_NONE 0 -#define LIBINPUT_TOOL_NONE 0 -#define LIBINPUT_TABLET_TOOL_TYPE_MAX LIBINPUT_TABLET_TOOL_TYPE_LENS - -#define TABLET_HISTORY_LENGTH 4 - -enum tablet_status { - TABLET_NONE = 0, - TABLET_AXES_UPDATED = 1 << 0, - TABLET_BUTTONS_PRESSED = 1 << 1, - TABLET_BUTTONS_RELEASED = 1 << 2, - TABLET_TOOL_IN_CONTACT = 1 << 3, - TABLET_TOOL_LEAVING_PROXIMITY = 1 << 4, - TABLET_TOOL_OUT_OF_PROXIMITY = 1 << 5, - TABLET_TOOL_ENTERING_PROXIMITY = 1 << 6, - TABLET_TOOL_ENTERING_CONTACT = 1 << 7, - TABLET_TOOL_LEAVING_CONTACT = 1 << 8, - TABLET_TOOL_OUT_OF_RANGE = 1 << 9, -}; - -struct button_state { - unsigned char bits[NCHARS(KEY_CNT)]; -}; - -struct tablet_dispatch { - struct evdev_dispatch base; - struct evdev_device *device; - unsigned int status; - unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)]; - struct tablet_axes axes; /* for assembling the current state */ - struct device_coords last_smooth_point; - struct { - unsigned int index; - unsigned int count; - struct tablet_axes samples[TABLET_HISTORY_LENGTH]; - } history; - - unsigned char axis_caps[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)]; - int current_value[LIBINPUT_TABLET_TOOL_AXIS_MAX + 1]; - int prev_value[LIBINPUT_TABLET_TOOL_AXIS_MAX + 1]; - - /* Only used for tablets that don't report serial numbers */ - struct list tool_list; - - struct button_state button_state; - struct button_state prev_button_state; - - enum libinput_tablet_tool_type current_tool_type; - uint32_t current_tool_id; - uint32_t current_tool_serial; - - uint32_t cursor_proximity_threshold; - - struct libinput_device_config_calibration calibration; - - /* The paired touch device on devices with both pen & touch */ - struct evdev_device *touch_device; - - struct { - bool need_to_force_prox_out; - struct libinput_timer prox_out_timer; - bool proximity_out_forced; - uint64_t last_event_time; - - /* true while injecting BTN_TOOL_PEN events */ - bool proximity_out_in_progress; - } quirks; -}; - -static inline struct tablet_dispatch* -tablet_dispatch(struct evdev_dispatch *dispatch) -{ - evdev_verify_dispatch_type(dispatch, DISPATCH_TABLET); - - return container_of(dispatch, struct tablet_dispatch, base); -} - -static inline enum libinput_tablet_tool_axis -evcode_to_axis(const uint32_t evcode) -{ - enum libinput_tablet_tool_axis axis; - - switch (evcode) { - case ABS_X: - axis = LIBINPUT_TABLET_TOOL_AXIS_X; - break; - case ABS_Y: - axis = LIBINPUT_TABLET_TOOL_AXIS_Y; - break; - case ABS_Z: - axis = LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z; - break; - case ABS_DISTANCE: - axis = LIBINPUT_TABLET_TOOL_AXIS_DISTANCE; - break; - case ABS_PRESSURE: - axis = LIBINPUT_TABLET_TOOL_AXIS_PRESSURE; - break; - case ABS_TILT_X: - axis = LIBINPUT_TABLET_TOOL_AXIS_TILT_X; - break; - case ABS_TILT_Y: - axis = LIBINPUT_TABLET_TOOL_AXIS_TILT_Y; - break; - case ABS_WHEEL: - axis = LIBINPUT_TABLET_TOOL_AXIS_SLIDER; - break; - default: - axis = LIBINPUT_TABLET_TOOL_AXIS_NONE; - break; - } - - return axis; -} - -static inline enum libinput_tablet_tool_axis -rel_evcode_to_axis(const uint32_t evcode) -{ - enum libinput_tablet_tool_axis axis; - - switch (evcode) { - case REL_WHEEL: - axis = LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL; - break; - default: - axis = LIBINPUT_TABLET_TOOL_AXIS_NONE; - break; - } - - return axis; -} - -static inline uint32_t -axis_to_evcode(const enum libinput_tablet_tool_axis axis) -{ - uint32_t evcode; - - switch (axis) { - case LIBINPUT_TABLET_TOOL_AXIS_X: - evcode = ABS_X; - break; - case LIBINPUT_TABLET_TOOL_AXIS_Y: - evcode = ABS_Y; - break; - case LIBINPUT_TABLET_TOOL_AXIS_DISTANCE: - evcode = ABS_DISTANCE; - break; - case LIBINPUT_TABLET_TOOL_AXIS_PRESSURE: - evcode = ABS_PRESSURE; - break; - case LIBINPUT_TABLET_TOOL_AXIS_TILT_X: - evcode = ABS_TILT_X; - break; - case LIBINPUT_TABLET_TOOL_AXIS_TILT_Y: - evcode = ABS_TILT_Y; - break; - case LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z: - evcode = ABS_Z; - break; - case LIBINPUT_TABLET_TOOL_AXIS_SLIDER: - evcode = ABS_WHEEL; - break; - default: - abort(); - } - - return evcode; -} - -static inline int -tablet_tool_to_evcode(enum libinput_tablet_tool_type type) -{ - int code; - - switch (type) { - case LIBINPUT_TABLET_TOOL_TYPE_PEN: code = BTN_TOOL_PEN; break; - case LIBINPUT_TABLET_TOOL_TYPE_ERASER: code = BTN_TOOL_RUBBER; break; - case LIBINPUT_TABLET_TOOL_TYPE_BRUSH: code = BTN_TOOL_BRUSH; break; - case LIBINPUT_TABLET_TOOL_TYPE_PENCIL: code = BTN_TOOL_PENCIL; break; - case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH: code = BTN_TOOL_AIRBRUSH; break; - case LIBINPUT_TABLET_TOOL_TYPE_MOUSE: code = BTN_TOOL_MOUSE; break; - case LIBINPUT_TABLET_TOOL_TYPE_LENS: code = BTN_TOOL_LENS; break; - default: - abort(); - } - - return code; -} - -static inline const char * -tablet_tool_type_to_string(enum libinput_tablet_tool_type type) -{ - const char *str; - - switch (type) { - case LIBINPUT_TABLET_TOOL_TYPE_PEN: str = "pen"; break; - case LIBINPUT_TABLET_TOOL_TYPE_ERASER: str = "eraser"; break; - case LIBINPUT_TABLET_TOOL_TYPE_BRUSH: str = "brush"; break; - case LIBINPUT_TABLET_TOOL_TYPE_PENCIL: str = "pencil"; break; - case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH: str = "airbrush"; break; - case LIBINPUT_TABLET_TOOL_TYPE_MOUSE: str = "mouse"; break; - case LIBINPUT_TABLET_TOOL_TYPE_LENS: str = "lens"; break; - default: - abort(); - } - - return str; -} - -static inline struct libinput * -tablet_libinput_context(const struct tablet_dispatch *tablet) -{ - return evdev_libinput_context(tablet->device); -} - -#endif diff -Nru libinput-1.10.3/src/evdev-tablet-pad.c libinput-0.21.0/src/evdev-tablet-pad.c --- libinput-1.10.3/src/evdev-tablet-pad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-tablet-pad.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,695 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the copyright holders not be used in - * advertising or publicity pertaining to distribution of the software - * without specific, written prior permission. The copyright holders make - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "config.h" -#include "evdev-tablet-pad.h" - -#include -#include -#include - -#define pad_set_status(pad_,s_) (pad_)->status |= (s_) -#define pad_unset_status(pad_,s_) (pad_)->status &= ~(s_) -#define pad_has_status(pad_,s_) (!!((pad_)->status & (s_))) - -static void -pad_get_buttons_pressed(struct pad_dispatch *pad, - struct button_state *buttons) -{ - struct button_state *state = &pad->button_state; - struct button_state *prev_state = &pad->prev_button_state; - unsigned int i; - - for (i = 0; i < sizeof(buttons->bits); i++) - buttons->bits[i] = state->bits[i] & ~(prev_state->bits[i]); -} - -static void -pad_get_buttons_released(struct pad_dispatch *pad, - struct button_state *buttons) -{ - struct button_state *state = &pad->button_state; - struct button_state *prev_state = &pad->prev_button_state; - unsigned int i; - - for (i = 0; i < sizeof(buttons->bits); i++) - buttons->bits[i] = prev_state->bits[i] & ~(state->bits[i]); -} - -static inline bool -pad_button_is_down(const struct pad_dispatch *pad, - uint32_t button) -{ - return bit_is_set(pad->button_state.bits, button); -} - -static inline bool -pad_any_button_down(const struct pad_dispatch *pad) -{ - const struct button_state *state = &pad->button_state; - unsigned int i; - - for (i = 0; i < sizeof(state->bits); i++) - if (state->bits[i] != 0) - return true; - - return false; -} - -static inline void -pad_button_set_down(struct pad_dispatch *pad, - uint32_t button, - bool is_down) -{ - struct button_state *state = &pad->button_state; - - if (is_down) { - set_bit(state->bits, button); - pad_set_status(pad, PAD_BUTTONS_PRESSED); - } else { - clear_bit(state->bits, button); - pad_set_status(pad, PAD_BUTTONS_RELEASED); - } -} - -static void -pad_process_absolute(struct pad_dispatch *pad, - struct evdev_device *device, - struct input_event *e, - uint64_t time) -{ - switch (e->code) { - case ABS_WHEEL: - pad->changed_axes |= PAD_AXIS_RING1; - pad_set_status(pad, PAD_AXES_UPDATED); - break; - case ABS_THROTTLE: - pad->changed_axes |= PAD_AXIS_RING2; - pad_set_status(pad, PAD_AXES_UPDATED); - break; - case ABS_RX: - pad->changed_axes |= PAD_AXIS_STRIP1; - pad_set_status(pad, PAD_AXES_UPDATED); - break; - case ABS_RY: - pad->changed_axes |= PAD_AXIS_STRIP2; - pad_set_status(pad, PAD_AXES_UPDATED); - break; - case ABS_MISC: - /* The wacom driver always sends a 0 axis event on finger - up, but we also get an ABS_MISC 15 on touch down and - ABS_MISC 0 on touch up, on top of the actual event. This - is kernel behavior for xf86-input-wacom backwards - compatibility after the 3.17 wacom HID move. - - We use that event to tell when we truly went a full - rotation around the wheel vs. a finger release. - - FIXME: On the Intuos5 and later the kernel merges all - states into that event, so if any finger is down on any - button, the wheel release won't trigger the ABS_MISC 0 - but still send a 0 event. We can't currently detect this. - */ - pad->have_abs_misc_terminator = true; - break; - default: - evdev_log_info(device, - "Unhandled EV_ABS event code %#x\n", - e->code); - break; - } -} - -static inline double -normalize_ring(const struct input_absinfo *absinfo) -{ - /* libinput has 0 as the ring's northernmost point in the device's - current logical rotation, increasing clockwise to 1. Wacom has - 0 on the left-most wheel position. - */ - double range = absinfo->maximum - absinfo->minimum + 1; - double value = (absinfo->value - absinfo->minimum) / range - 0.25; - - if (value < 0.0) - value += 1.0; - - return value; -} - -static inline double -normalize_strip(const struct input_absinfo *absinfo) -{ - /* strip axes don't use a proper value, they just shift the bit left - * for each position. 0 isn't a real value either, it's only sent on - * finger release */ - double min = 0, - max = log2(absinfo->maximum); - double range = max - min; - double value = (log2(absinfo->value) - min) / range; - - return value; -} - -static inline double -pad_handle_ring(struct pad_dispatch *pad, - struct evdev_device *device, - unsigned int code) -{ - const struct input_absinfo *absinfo; - double degrees; - - absinfo = libevdev_get_abs_info(device->evdev, code); - assert(absinfo); - - degrees = normalize_ring(absinfo) * 360; - - if (device->left_handed.enabled) - degrees = fmod(degrees + 180, 360); - - return degrees; -} - -static inline double -pad_handle_strip(struct pad_dispatch *pad, - struct evdev_device *device, - unsigned int code) -{ - const struct input_absinfo *absinfo; - double pos; - - absinfo = libevdev_get_abs_info(device->evdev, code); - assert(absinfo); - - if (absinfo->value == 0) - return 0.0; - - pos = normalize_strip(absinfo); - - if (device->left_handed.enabled) - pos = 1.0 - pos; - - return pos; -} - -static inline struct libinput_tablet_pad_mode_group * -pad_ring_get_mode_group(struct pad_dispatch *pad, - unsigned int ring) -{ - struct libinput_tablet_pad_mode_group *group; - - list_for_each(group, &pad->modes.mode_group_list, link) { - if (libinput_tablet_pad_mode_group_has_ring(group, ring)) - return group; - } - - assert(!"Unable to find ring mode group"); - - return NULL; -} - -static inline struct libinput_tablet_pad_mode_group * -pad_strip_get_mode_group(struct pad_dispatch *pad, - unsigned int strip) -{ - struct libinput_tablet_pad_mode_group *group; - - list_for_each(group, &pad->modes.mode_group_list, link) { - if (libinput_tablet_pad_mode_group_has_strip(group, strip)) - return group; - } - - assert(!"Unable to find strip mode group"); - - return NULL; -} - -static void -pad_check_notify_axes(struct pad_dispatch *pad, - struct evdev_device *device, - uint64_t time) -{ - struct libinput_device *base = &device->base; - struct libinput_tablet_pad_mode_group *group; - double value; - bool send_finger_up = false; - - /* Suppress the reset to 0 on finger up. See the - comment in pad_process_absolute */ - if (pad->have_abs_misc_terminator && - libevdev_get_event_value(device->evdev, EV_ABS, ABS_MISC) == 0) - send_finger_up = true; - - if (pad->changed_axes & PAD_AXIS_RING1) { - value = pad_handle_ring(pad, device, ABS_WHEEL); - if (send_finger_up) - value = -1.0; - - group = pad_ring_get_mode_group(pad, 0); - tablet_pad_notify_ring(base, - time, - 0, - value, - LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER, - group); - } - - if (pad->changed_axes & PAD_AXIS_RING2) { - value = pad_handle_ring(pad, device, ABS_THROTTLE); - if (send_finger_up) - value = -1.0; - - group = pad_ring_get_mode_group(pad, 1); - tablet_pad_notify_ring(base, - time, - 1, - value, - LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER, - group); - } - - if (pad->changed_axes & PAD_AXIS_STRIP1) { - value = pad_handle_strip(pad, device, ABS_RX); - if (send_finger_up) - value = -1.0; - - group = pad_strip_get_mode_group(pad, 0); - tablet_pad_notify_strip(base, - time, - 0, - value, - LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER, - group); - } - - if (pad->changed_axes & PAD_AXIS_STRIP2) { - value = pad_handle_strip(pad, device, ABS_RY); - if (send_finger_up) - value = -1.0; - - group = pad_strip_get_mode_group(pad, 1); - tablet_pad_notify_strip(base, - time, - 1, - value, - LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER, - group); - } - - pad->changed_axes = PAD_AXIS_NONE; - pad->have_abs_misc_terminator = false; -} - -static void -pad_process_key(struct pad_dispatch *pad, - struct evdev_device *device, - struct input_event *e, - uint64_t time) -{ - uint32_t button = e->code; - uint32_t is_press = e->value != 0; - - pad_button_set_down(pad, button, is_press); -} - -static inline struct libinput_tablet_pad_mode_group * -pad_button_get_mode_group(struct pad_dispatch *pad, - unsigned int button) -{ - struct libinput_tablet_pad_mode_group *group; - - list_for_each(group, &pad->modes.mode_group_list, link) { - if (libinput_tablet_pad_mode_group_has_button(group, button)) - return group; - } - - assert(!"Unable to find button mode group\n"); - - return NULL; -} - -static void -pad_notify_button_mask(struct pad_dispatch *pad, - struct evdev_device *device, - uint64_t time, - const struct button_state *buttons, - enum libinput_button_state state) -{ - struct libinput_device *base = &device->base; - struct libinput_tablet_pad_mode_group *group; - int32_t code; - unsigned int i; - - for (i = 0; i < sizeof(buttons->bits); i++) { - unsigned char buttons_slice = buttons->bits[i]; - - code = i * 8; - while (buttons_slice) { - int enabled; - char map; - - code++; - enabled = (buttons_slice & 1); - buttons_slice >>= 1; - - if (!enabled) - continue; - - map = pad->button_map[code - 1]; - if (map != -1) { - group = pad_button_get_mode_group(pad, map); - pad_button_update_mode(group, map, state); - tablet_pad_notify_button(base, time, map, state, group); - } - } - } -} - -static void -pad_notify_buttons(struct pad_dispatch *pad, - struct evdev_device *device, - uint64_t time, - enum libinput_button_state state) -{ - struct button_state buttons; - - if (state == LIBINPUT_BUTTON_STATE_PRESSED) - pad_get_buttons_pressed(pad, &buttons); - else - pad_get_buttons_released(pad, &buttons); - - pad_notify_button_mask(pad, device, time, &buttons, state); -} - -static void -pad_change_to_left_handed(struct evdev_device *device) -{ - struct pad_dispatch *pad = (struct pad_dispatch*)device->dispatch; - - if (device->left_handed.enabled == device->left_handed.want_enabled) - return; - - if (pad_any_button_down(pad)) - return; - - device->left_handed.enabled = device->left_handed.want_enabled; -} - -static void -pad_flush(struct pad_dispatch *pad, - struct evdev_device *device, - uint64_t time) -{ - if (pad_has_status(pad, PAD_AXES_UPDATED)) { - pad_check_notify_axes(pad, device, time); - pad_unset_status(pad, PAD_AXES_UPDATED); - } - - if (pad_has_status(pad, PAD_BUTTONS_RELEASED)) { - pad_notify_buttons(pad, - device, - time, - LIBINPUT_BUTTON_STATE_RELEASED); - pad_unset_status(pad, PAD_BUTTONS_RELEASED); - - pad_change_to_left_handed(device); - } - - if (pad_has_status(pad, PAD_BUTTONS_PRESSED)) { - pad_notify_buttons(pad, - device, - time, - LIBINPUT_BUTTON_STATE_PRESSED); - pad_unset_status(pad, PAD_BUTTONS_PRESSED); - } - - /* Update state */ - memcpy(&pad->prev_button_state, - &pad->button_state, - sizeof(pad->button_state)); -} - -static void -pad_process(struct evdev_dispatch *dispatch, - struct evdev_device *device, - struct input_event *e, - uint64_t time) -{ - struct pad_dispatch *pad = pad_dispatch(dispatch); - - switch (e->type) { - case EV_ABS: - pad_process_absolute(pad, device, e, time); - break; - case EV_KEY: - pad_process_key(pad, device, e, time); - break; - case EV_SYN: - pad_flush(pad, device, time); - break; - case EV_MSC: - /* The EKR sends the serial as MSC_SERIAL, ignore this for - * now */ - break; - default: - evdev_log_error(device, - "Unexpected event type %s (%#x)\n", - libevdev_event_type_get_name(e->type), - e->type); - break; - } -} - -static void -pad_suspend(struct evdev_dispatch *dispatch, - struct evdev_device *device) -{ - struct pad_dispatch *pad = pad_dispatch(dispatch); - struct libinput *libinput = pad_libinput_context(pad); - unsigned int code; - - for (code = KEY_ESC; code < KEY_CNT; code++) { - if (pad_button_is_down(pad, code)) - pad_button_set_down(pad, code, false); - } - - pad_flush(pad, device, libinput_now(libinput)); -} - -static void -pad_destroy(struct evdev_dispatch *dispatch) -{ - struct pad_dispatch *pad = pad_dispatch(dispatch); - - pad_destroy_leds(pad); - free(pad); -} - -static struct evdev_dispatch_interface pad_interface = { - .process = pad_process, - .suspend = pad_suspend, - .remove = NULL, - .destroy = pad_destroy, - .device_added = NULL, - .device_removed = NULL, - .device_suspended = NULL, - .device_resumed = NULL, - .post_added = NULL, - .toggle_touch = NULL, - .get_switch_state = NULL, -}; - -static void -pad_init_buttons(struct pad_dispatch *pad, - struct evdev_device *device) -{ - unsigned int code; - size_t i; - int map = 0; - - for (i = 0; i < ARRAY_LENGTH(pad->button_map); i++) - pad->button_map[i] = -1; - - /* we match wacom_report_numbered_buttons() from the kernel */ - for (code = BTN_0; code < BTN_0 + 10; code++) { - if (libevdev_has_event_code(device->evdev, EV_KEY, code)) - pad->button_map[code] = map++; - } - - for (code = BTN_BASE; code < BTN_BASE + 2; code++) { - if (libevdev_has_event_code(device->evdev, EV_KEY, code)) - pad->button_map[code] = map++; - } - - for (code = BTN_A; code < BTN_A + 6; code++) { - if (libevdev_has_event_code(device->evdev, EV_KEY, code)) - pad->button_map[code] = map++; - } - - for (code = BTN_LEFT; code < BTN_LEFT + 7; code++) { - if (libevdev_has_event_code(device->evdev, EV_KEY, code)) - pad->button_map[code] = map++; - } - - pad->nbuttons = map; -} - -static void -pad_init_left_handed(struct evdev_device *device) -{ - if (evdev_tablet_has_left_handed(device)) - evdev_init_left_handed(device, - pad_change_to_left_handed); -} - -static int -pad_init(struct pad_dispatch *pad, struct evdev_device *device) -{ - pad->base.dispatch_type = DISPATCH_TABLET_PAD; - pad->base.interface = &pad_interface; - pad->device = device; - pad->status = PAD_NONE; - pad->changed_axes = PAD_AXIS_NONE; - - pad_init_buttons(pad, device); - pad_init_left_handed(device); - if (pad_init_leds(pad, device) != 0) - return 1; - - return 0; -} - -static uint32_t -pad_sendevents_get_modes(struct libinput_device *device) -{ - return LIBINPUT_CONFIG_SEND_EVENTS_DISABLED; -} - -static enum libinput_config_status -pad_sendevents_set_mode(struct libinput_device *device, - enum libinput_config_send_events_mode mode) -{ - struct evdev_device *evdev = evdev_device(device); - struct pad_dispatch *pad = (struct pad_dispatch*)evdev->dispatch; - - if (mode == pad->sendevents.current_mode) - return LIBINPUT_CONFIG_STATUS_SUCCESS; - - switch(mode) { - case LIBINPUT_CONFIG_SEND_EVENTS_ENABLED: - break; - case LIBINPUT_CONFIG_SEND_EVENTS_DISABLED: - pad_suspend(evdev->dispatch, evdev); - break; - default: - return LIBINPUT_CONFIG_STATUS_UNSUPPORTED; - } - - pad->sendevents.current_mode = mode; - - return LIBINPUT_CONFIG_STATUS_SUCCESS; -} - -static enum libinput_config_send_events_mode -pad_sendevents_get_mode(struct libinput_device *device) -{ - struct evdev_device *evdev = evdev_device(device); - struct pad_dispatch *dispatch = (struct pad_dispatch*)evdev->dispatch; - - return dispatch->sendevents.current_mode; -} - -static enum libinput_config_send_events_mode -pad_sendevents_get_default_mode(struct libinput_device *device) -{ - return LIBINPUT_CONFIG_SEND_EVENTS_ENABLED; -} - -struct evdev_dispatch * -evdev_tablet_pad_create(struct evdev_device *device) -{ - struct pad_dispatch *pad; - - pad = zalloc(sizeof *pad); - - if (pad_init(pad, device) != 0) { - pad_destroy(&pad->base); - return NULL; - } - - device->base.config.sendevents = &pad->sendevents.config; - pad->sendevents.current_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED; - pad->sendevents.config.get_modes = pad_sendevents_get_modes; - pad->sendevents.config.set_mode = pad_sendevents_set_mode; - pad->sendevents.config.get_mode = pad_sendevents_get_mode; - pad->sendevents.config.get_default_mode = pad_sendevents_get_default_mode; - - return &pad->base; -} - -int -evdev_device_tablet_pad_get_num_buttons(struct evdev_device *device) -{ - struct pad_dispatch *pad = (struct pad_dispatch*)device->dispatch; - - if (!(device->seat_caps & EVDEV_DEVICE_TABLET_PAD)) - return -1; - - return pad->nbuttons; -} - -int -evdev_device_tablet_pad_get_num_rings(struct evdev_device *device) -{ - int nrings = 0; - - if (!(device->seat_caps & EVDEV_DEVICE_TABLET_PAD)) - return -1; - - if (libevdev_has_event_code(device->evdev, EV_ABS, ABS_WHEEL)) { - nrings++; - if (libevdev_has_event_code(device->evdev, - EV_ABS, - ABS_THROTTLE)) - nrings++; - } - - return nrings; -} - -int -evdev_device_tablet_pad_get_num_strips(struct evdev_device *device) -{ - int nstrips = 0; - - if (!(device->seat_caps & EVDEV_DEVICE_TABLET_PAD)) - return -1; - - if (libevdev_has_event_code(device->evdev, EV_ABS, ABS_RX)) { - nstrips++; - if (libevdev_has_event_code(device->evdev, - EV_ABS, - ABS_RY)) - nstrips++; - } - - return nstrips; -} diff -Nru libinput-1.10.3/src/evdev-tablet-pad.h libinput-0.21.0/src/evdev-tablet-pad.h --- libinput-1.10.3/src/evdev-tablet-pad.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-tablet-pad.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,95 +0,0 @@ -/* - * Copyright © 2015 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the copyright holders not be used in - * advertising or publicity pertaining to distribution of the software - * without specific, written prior permission. The copyright holders make - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef EVDEV_BUTTONSET_WACOM_H -#define EVDEV_BUTTONSET_WACOM_H - -#include "evdev.h" - -#define LIBINPUT_BUTTONSET_AXIS_NONE 0 - -enum pad_status { - PAD_NONE = 0, - PAD_AXES_UPDATED = 1 << 0, - PAD_BUTTONS_PRESSED = 1 << 1, - PAD_BUTTONS_RELEASED = 1 << 2, -}; - -enum pad_axes { - PAD_AXIS_NONE = 0, - PAD_AXIS_RING1 = 1 << 0, - PAD_AXIS_RING2 = 1 << 1, - PAD_AXIS_STRIP1 = 1 << 2, - PAD_AXIS_STRIP2 = 1 << 3, -}; - -struct button_state { - unsigned char bits[NCHARS(KEY_CNT)]; -}; - -struct pad_dispatch { - struct evdev_dispatch base; - struct evdev_device *device; - unsigned char status; - uint32_t changed_axes; - - struct button_state button_state; - struct button_state prev_button_state; - - char button_map[KEY_CNT]; - unsigned int nbuttons; - - bool have_abs_misc_terminator; - - struct { - struct libinput_device_config_send_events config; - enum libinput_config_send_events_mode current_mode; - } sendevents; - - struct { - struct list mode_group_list; - } modes; -}; - -static inline struct pad_dispatch* -pad_dispatch(struct evdev_dispatch *dispatch) -{ - evdev_verify_dispatch_type(dispatch, DISPATCH_TABLET_PAD); - - return container_of(dispatch, struct pad_dispatch, base); -} - -static inline struct libinput * -pad_libinput_context(const struct pad_dispatch *pad) -{ - return evdev_libinput_context(pad->device); -} - -int -pad_init_leds(struct pad_dispatch *pad, struct evdev_device *device); -void -pad_destroy_leds(struct pad_dispatch *pad); -void -pad_button_update_mode(struct libinput_tablet_pad_mode_group *g, - unsigned int pressed_button, - enum libinput_button_state state); -#endif diff -Nru libinput-1.10.3/src/evdev-tablet-pad-leds.c libinput-0.21.0/src/evdev-tablet-pad-leds.c --- libinput-1.10.3/src/evdev-tablet-pad-leds.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/evdev-tablet-pad-leds.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,638 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the copyright holders not be used in - * advertising or publicity pertaining to distribution of the software - * without specific, written prior permission. The copyright holders make - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include "config.h" - -#include -#include -#include -#include - -#include "evdev-tablet-pad.h" - -#if HAVE_LIBWACOM -#include -#endif - -struct pad_led_group { - struct libinput_tablet_pad_mode_group base; - struct list led_list; - struct list toggle_button_list; -}; - -struct pad_mode_toggle_button { - struct list link; - unsigned int button_index; -}; - -struct pad_mode_led { - struct list link; - /* /sys/devices/..../input1235/input1235::wacom-led_0.1/brightness */ - int brightness_fd; - int mode_idx; -}; - -static inline struct pad_mode_toggle_button * -pad_mode_toggle_button_new(struct pad_dispatch *pad, - struct libinput_tablet_pad_mode_group *group, - unsigned int button_index) -{ - struct pad_mode_toggle_button *button; - - button = zalloc(sizeof *button); - button->button_index = button_index; - - return button; -} - -static inline void -pad_mode_toggle_button_destroy(struct pad_mode_toggle_button* button) -{ - list_remove(&button->link); - free(button); -} - -static inline int -pad_led_group_get_mode(struct pad_led_group *group) -{ - char buf[4] = {0}; - int rc; - unsigned int brightness; - struct pad_mode_led *led; - - list_for_each(led, &group->led_list, link) { - rc = lseek(led->brightness_fd, 0, SEEK_SET); - if (rc == -1) - return -errno; - - rc = read(led->brightness_fd, buf, sizeof(buf) - 1); - if (rc == -1) - return -errno; - - rc = sscanf(buf, "%u\n", &brightness); - if (rc != 1) - return -EINVAL; - - /* Assumption: only one LED lit up at any time */ - if (brightness != 0) - return led->mode_idx; - } - - return -EINVAL; -} - -static inline void -pad_led_destroy(struct libinput *libinput, - struct pad_mode_led *led) -{ - list_remove(&led->link); - if (led->brightness_fd != -1) - close_restricted(libinput, led->brightness_fd); - free(led); -} - -static inline struct pad_mode_led * -pad_led_new(struct libinput *libinput, const char *prefix, int group, int mode) -{ - struct pad_mode_led *led; - char path[PATH_MAX]; - int rc, fd; - - led = zalloc(sizeof *led); - led->brightness_fd = -1; - led->mode_idx = mode; - list_init(&led->link); - - /* /sys/devices/..../input1235/input1235::wacom-0.1/brightness, - * where 0 and 1 are group and mode index. */ - rc = snprintf(path, - sizeof(path), - "%s%d.%d/brightness", - prefix, - group, - mode); - if (rc == -1) - goto error; - - fd = open_restricted(libinput, path, O_RDONLY); - if (fd < 0) { - errno = -fd; - goto error; - } - - led->brightness_fd = fd; - - return led; - -error: - pad_led_destroy(libinput, led); - return NULL; -} - -static void -pad_led_group_destroy(struct libinput_tablet_pad_mode_group *g) -{ - struct pad_led_group *group = (struct pad_led_group *)g; - struct pad_mode_toggle_button *button, *tmp; - struct pad_mode_led *led, *tmpled; - - list_for_each_safe(button, tmp, &group->toggle_button_list, link) - pad_mode_toggle_button_destroy(button); - - list_for_each_safe(led, tmpled, &group->led_list, link) - pad_led_destroy(g->device->seat->libinput, led); - - free(group); -} - -static struct pad_led_group * -pad_group_new_basic(struct pad_dispatch *pad, - unsigned int group_index, - int nleds) -{ - struct pad_led_group *group; - - group = zalloc(sizeof *group); - group->base.device = &pad->device->base; - group->base.refcount = 1; - group->base.index = group_index; - group->base.current_mode = 0; - group->base.num_modes = nleds; - group->base.destroy = pad_led_group_destroy; - list_init(&group->toggle_button_list); - list_init(&group->led_list); - - return group; -} - -static inline bool -is_litest_device(struct evdev_device *device) -{ - return !!udev_device_get_property_value(device->udev_device, - "LIBINPUT_TEST_DEVICE"); -} - -static inline struct pad_led_group * -pad_group_new(struct pad_dispatch *pad, - unsigned int group_index, - int nleds, - const char *syspath) -{ - struct libinput *libinput = pad->device->base.seat->libinput; - struct pad_led_group *group; - int rc; - - group = pad_group_new_basic(pad, group_index, nleds); - if (!group) - return NULL; - - while (nleds--) { - struct pad_mode_led *led; - - led = pad_led_new(libinput, syspath, group_index, nleds); - if (!led) - goto error; - - list_insert(&group->led_list, &led->link); - } - - rc = pad_led_group_get_mode(group); - if (rc < 0) { - errno = -rc; - goto error; - } - - group->base.current_mode = rc; - - return group; - -error: - if (!is_litest_device(pad->device)) - evdev_log_error(pad->device, - "unable to init LED group: %s\n", - strerror(errno)); - pad_led_group_destroy(&group->base); - - return NULL; -} - -static inline bool -pad_led_get_sysfs_base_path(struct evdev_device *device, - char *path_out, - size_t path_out_sz) -{ - struct udev_device *parent, *udev_device; - const char *test_path; - int rc; - - udev_device = device->udev_device; - - /* For testing purposes only allow for a base path set through a - * udev rule. We still expect the normal directory hierarchy inside */ - test_path = udev_device_get_property_value(udev_device, - "LIBINPUT_TEST_TABLET_PAD_SYSFS_PATH"); - if (test_path) { - rc = snprintf(path_out, path_out_sz, "%s", test_path); - return rc != -1; - } - - parent = udev_device_get_parent_with_subsystem_devtype(udev_device, - "input", - NULL); - if (!parent) - return false; - - rc = snprintf(path_out, - path_out_sz, - "%s/%s::wacom-", - udev_device_get_syspath(parent), - udev_device_get_sysname(parent)); - - return rc != -1; -} - -#if HAVE_LIBWACOM -static int -pad_init_led_groups(struct pad_dispatch *pad, - struct evdev_device *device, - WacomDevice *wacom) -{ - const WacomStatusLEDs *leds; - int nleds, nmodes; - int i; - struct pad_led_group *group; - char syspath[PATH_MAX]; - - leds = libwacom_get_status_leds(wacom, &nleds); - if (nleds == 0) - return 1; - - /* syspath is /sys/class/leds/input1234/input12345::wacom-" and - only needs the group + mode appended */ - if (!pad_led_get_sysfs_base_path(device, syspath, sizeof(syspath))) - return 1; - - for (i = 0; i < nleds; i++) { - switch(leds[i]) { - case WACOM_STATUS_LED_UNAVAILABLE: - evdev_log_bug_libinput(device, - "Invalid led type %d\n", - leds[i]); - return 1; - case WACOM_STATUS_LED_RING: - nmodes = libwacom_get_ring_num_modes(wacom); - group = pad_group_new(pad, i, nmodes, syspath); - if (!group) - return 1; - list_insert(&pad->modes.mode_group_list, &group->base.link); - break; - case WACOM_STATUS_LED_RING2: - nmodes = libwacom_get_ring2_num_modes(wacom); - group = pad_group_new(pad, i, nmodes, syspath); - if (!group) - return 1; - list_insert(&pad->modes.mode_group_list, &group->base.link); - break; - case WACOM_STATUS_LED_TOUCHSTRIP: - nmodes = libwacom_get_strips_num_modes(wacom); - group = pad_group_new(pad, i, nmodes, syspath); - if (!group) - return 1; - list_insert(&pad->modes.mode_group_list, &group->base.link); - break; - case WACOM_STATUS_LED_TOUCHSTRIP2: - /* there is no get_strips2_... */ - nmodes = libwacom_get_strips_num_modes(wacom); - group = pad_group_new(pad, i, nmodes, syspath); - if (!group) - return 1; - list_insert(&pad->modes.mode_group_list, &group->base.link); - break; - } - } - - return 0; -} - -#endif - -static inline struct libinput_tablet_pad_mode_group * -pad_get_mode_group(struct pad_dispatch *pad, unsigned int index) -{ - struct libinput_tablet_pad_mode_group *group; - - list_for_each(group, &pad->modes.mode_group_list, link) { - if (group->index == index) - return group; - } - - return NULL; -} - -#if HAVE_LIBWACOM - -static inline int -pad_find_button_group(WacomDevice *wacom, - int button_index, - WacomButtonFlags button_flags) -{ - int i; - WacomButtonFlags flags; - - for (i = 0; i < libwacom_get_num_buttons(wacom); i++) { - if (i == button_index) - continue; - - flags = libwacom_get_button_flag(wacom, 'A' + i); - if ((flags & WACOM_BUTTON_MODESWITCH) == 0) - continue; - - if ((flags & WACOM_BUTTON_DIRECTION) == - (button_flags & WACOM_BUTTON_DIRECTION)) - return libwacom_get_button_led_group(wacom, 'A' + i); - } - - return -1; -} - -static int -pad_init_mode_buttons(struct pad_dispatch *pad, - WacomDevice *wacom) -{ - struct libinput_tablet_pad_mode_group *group; - unsigned int group_idx; - int i; - WacomButtonFlags flags; - - /* libwacom numbers buttons as 'A', 'B', etc. We number them with 0, - * 1, ... - */ - for (i = 0; i < libwacom_get_num_buttons(wacom); i++) { - group_idx = libwacom_get_button_led_group(wacom, 'A' + i); - flags = libwacom_get_button_flag(wacom, 'A' + i); - - /* If this button is not a mode toggle button, find the mode - * toggle button with the same position flags and take that - * button's group idx */ - if ((int)group_idx == -1) { - group_idx = pad_find_button_group(wacom, i, flags); - } - - if ((int)group_idx == -1) { - evdev_log_bug_libinput(pad->device, - "unhandled position for button %i\n", - i); - return 1; - } - - group = pad_get_mode_group(pad, group_idx); - if (!group) { - evdev_log_bug_libinput(pad->device, - "Failed to find group %d for button %i\n", - group_idx, - i); - return 1; - } - - group->button_mask |= 1 << i; - - if (flags & WACOM_BUTTON_MODESWITCH) { - struct pad_mode_toggle_button *b; - struct pad_led_group *g; - - b = pad_mode_toggle_button_new(pad, group, i); - if (!b) - return 1; - g = (struct pad_led_group*)group; - list_insert(&g->toggle_button_list, &b->link); - group->toggle_button_mask |= 1 << i; - } - } - - return 0; -} - -static void -pad_init_mode_rings(struct pad_dispatch *pad, WacomDevice *wacom) -{ - struct libinput_tablet_pad_mode_group *group; - const WacomStatusLEDs *leds; - int i, nleds; - - leds = libwacom_get_status_leds(wacom, &nleds); - if (nleds == 0) - return; - - for (i = 0; i < nleds; i++) { - switch(leds[i]) { - case WACOM_STATUS_LED_RING: - group = pad_get_mode_group(pad, i); - group->ring_mask |= 0x1; - break; - case WACOM_STATUS_LED_RING2: - group = pad_get_mode_group(pad, i); - group->ring_mask |= 0x2; - break; - default: - break; - } - } -} - -static void -pad_init_mode_strips(struct pad_dispatch *pad, WacomDevice *wacom) -{ - struct libinput_tablet_pad_mode_group *group; - const WacomStatusLEDs *leds; - int i, nleds; - - leds = libwacom_get_status_leds(wacom, &nleds); - if (nleds == 0) - return; - - for (i = 0; i < nleds; i++) { - switch(leds[i]) { - case WACOM_STATUS_LED_TOUCHSTRIP: - group = pad_get_mode_group(pad, i); - group->strip_mask |= 0x1; - break; - case WACOM_STATUS_LED_TOUCHSTRIP2: - group = pad_get_mode_group(pad, i); - group->strip_mask |= 0x2; - break; - default: - break; - } - } -} - -static int -pad_init_leds_from_libwacom(struct pad_dispatch *pad, - struct evdev_device *device) -{ - WacomDeviceDatabase *db = NULL; - WacomDevice *wacom = NULL; - int rc = 1; - - db = libwacom_database_new(); - if (!db) { - evdev_log_info(device, - "Failed to initialize libwacom context.\n"); - goto out; - } - - wacom = libwacom_new_from_path(db, - udev_device_get_devnode(device->udev_device), - WFALLBACK_NONE, - NULL); - if (!wacom) - goto out; - - rc = pad_init_led_groups(pad, device, wacom); - if (rc != 0) - goto out; - - if ((rc = pad_init_mode_buttons(pad, wacom)) != 0) - goto out; - - pad_init_mode_rings(pad, wacom); - pad_init_mode_strips(pad, wacom); - -out: - if (wacom) - libwacom_destroy(wacom); - if (db) - libwacom_database_destroy(db); - - if (rc != 0) - pad_destroy_leds(pad); - - return rc; -} -#endif /* HAVE_LIBWACOM */ - -static int -pad_init_fallback_group(struct pad_dispatch *pad) -{ - struct pad_led_group *group; - - group = pad_group_new_basic(pad, 0, 1); - if (!group) - return 1; - - /* If we only have one group, all buttons/strips/rings are part of - * that group. We rely on the other layers to filter out invalid - * indices */ - group->base.button_mask = -1; - group->base.strip_mask = -1; - group->base.ring_mask = -1; - group->base.toggle_button_mask = 0; - - list_insert(&pad->modes.mode_group_list, &group->base.link); - - return 0; -} - -int -pad_init_leds(struct pad_dispatch *pad, - struct evdev_device *device) -{ - int rc = 1; - - list_init(&pad->modes.mode_group_list); - - if (pad->nbuttons > 32) { - evdev_log_bug_libinput(pad->device, - "Too many pad buttons for modes %d\n", - pad->nbuttons); - return rc; - } - - /* If libwacom fails, we init one fallback group anyway */ -#if HAVE_LIBWACOM - rc = pad_init_leds_from_libwacom(pad, device); -#endif - if (rc != 0) - rc = pad_init_fallback_group(pad); - - return rc; -} - -void -pad_destroy_leds(struct pad_dispatch *pad) -{ - struct libinput_tablet_pad_mode_group *group, *tmpgrp; - - list_for_each_safe(group, tmpgrp, &pad->modes.mode_group_list, link) - libinput_tablet_pad_mode_group_unref(group); -} - -void -pad_button_update_mode(struct libinput_tablet_pad_mode_group *g, - unsigned int button_index, - enum libinput_button_state state) -{ - struct pad_led_group *group = (struct pad_led_group*)g; - int rc; - - if (state != LIBINPUT_BUTTON_STATE_PRESSED) - return; - - if (!libinput_tablet_pad_mode_group_button_is_toggle(g, button_index)) - return; - - rc = pad_led_group_get_mode(group); - if (rc >= 0) - group->base.current_mode = rc; -} - -int -evdev_device_tablet_pad_get_num_mode_groups(struct evdev_device *device) -{ - struct pad_dispatch *pad = (struct pad_dispatch*)device->dispatch; - struct libinput_tablet_pad_mode_group *group; - int num_groups = 0; - - if (!(device->seat_caps & EVDEV_DEVICE_TABLET_PAD)) - return -1; - - list_for_each(group, &pad->modes.mode_group_list, link) - num_groups++; - - return num_groups; -} - -struct libinput_tablet_pad_mode_group * -evdev_device_tablet_pad_get_mode_group(struct evdev_device *device, - unsigned int index) -{ - struct pad_dispatch *pad = (struct pad_dispatch*)device->dispatch; - - if (!(device->seat_caps & EVDEV_DEVICE_TABLET_PAD)) - return NULL; - - if (index >= - (unsigned int)evdev_device_tablet_pad_get_num_mode_groups(device)) - return NULL; - - return pad_get_mode_group(pad, index); -} diff -Nru libinput-1.10.3/src/filter.c libinput-0.21.0/src/filter.c --- libinput-1.10.3/src/filter.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/filter.c 2015-08-03 05:08:55.000000000 +0000 @@ -36,71 +36,25 @@ #include "libinput-util.h" #include "filter-private.h" -/* Once normalized, touchpads see the same acceleration as mice. that is - * technically correct but subjectively wrong, we expect a touchpad to be a - * lot slower than a mouse. Apply a magic factor to slow down all movements - */ -#define TP_MAGIC_SLOWDOWN 0.37 /* unitless factor */ - -/* Convert speed/velocity from units/us to units/ms */ -static inline double -v_us2ms(double units_per_us) -{ - return units_per_us * 1000.0; -} - -static inline double -v_us2s(double units_per_us) -{ - return units_per_us * 1000000.0; -} - -/* Convert speed/velocity from units/ms to units/us */ -static inline double -v_ms2us(double units_per_ms) -{ - return units_per_ms/1000.0; -} - -static inline struct normalized_coords -normalize_for_dpi(const struct device_float_coords *coords, int dpi) -{ - struct normalized_coords norm; - - norm.x = coords->x * DEFAULT_MOUSE_DPI/dpi; - norm.y = coords->y * DEFAULT_MOUSE_DPI/dpi; - - return norm; -} - struct normalized_coords filter_dispatch(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, + const struct normalized_coords *unaccelerated, void *data, uint64_t time) { return filter->interface->filter(filter, unaccelerated, data, time); } -struct normalized_coords -filter_dispatch_constant(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time) -{ - return filter->interface->filter_constant(filter, unaccelerated, data, time); -} - void filter_restart(struct motion_filter *filter, void *data, uint64_t time) { - if (filter->interface->restart) - filter->interface->restart(filter, data, time); + filter->interface->restart(filter, data, time); } void filter_destroy(struct motion_filter *filter) { - if (!filter || !filter->interface->destroy) + if (!filter) return; filter->interface->destroy(filter); @@ -108,120 +62,62 @@ bool filter_set_speed(struct motion_filter *filter, - double speed_adjustment) + double speed) { - return filter->interface->set_speed(filter, speed_adjustment); + return filter->interface->set_speed(filter, speed); } double filter_get_speed(struct motion_filter *filter) { - return filter->speed_adjustment; -} - -enum libinput_config_accel_profile -filter_get_type(struct motion_filter *filter) -{ - return filter->interface->type; + return filter->speed; } /* * Default parameters for pointer acceleration profiles. */ -#define DEFAULT_THRESHOLD v_ms2us(0.4) /* in units/us */ -#define MINIMUM_THRESHOLD v_ms2us(0.2) /* in units/us */ +#define DEFAULT_THRESHOLD 0.4 /* in units/ms */ #define DEFAULT_ACCELERATION 2.0 /* unitless factor */ #define DEFAULT_INCLINE 1.1 /* unitless factor */ -/* Touchpad acceleration */ -#define TOUCHPAD_DEFAULT_THRESHOLD 254 /* mm/s */ -#define TOUCHPAD_THRESHOLD_RANGE 184 /* mm/s */ -#define TOUCHPAD_ACCELERATION 9.0 /* unitless factor */ -#define TOUCHPAD_INCLINE 0.011 /* unitless factor */ - -/* for the Lenovo x230 custom accel. do not touch */ -#define X230_THRESHOLD v_ms2us(0.4) /* in units/us */ -#define X230_ACCELERATION 2.0 /* unitless factor */ -#define X230_INCLINE 1.1 /* unitless factor */ -#define X230_MAGIC_SLOWDOWN 0.4 /* unitless */ -#define X230_TP_MAGIC_LOW_RES_FACTOR 4.0 /* unitless */ - -/* Trackpoint acceleration */ -#define TRACKPOINT_DEFAULT_MAX_ACCEL 2.0 /* in units/us */ -#define TRACKPOINT_DEFAULT_MAX_DELTA 60 -/* As measured on a Lenovo T440 at kernel-default sensitivity 128 */ -#define TRACKPOINT_DEFAULT_RANGE 20 /* max value */ - /* * Pointer acceleration filter constants */ -#define MAX_VELOCITY_DIFF v_ms2us(1) /* units/us */ +#define MAX_VELOCITY_DIFF 1 /* units/ms */ #define MOTION_TIMEOUT ms2us(1000) #define NUM_POINTER_TRACKERS 16 struct pointer_tracker { - struct device_float_coords delta; /* delta to most recent event */ + struct normalized_coords delta; /* delta to most recent event */ uint64_t time; /* us */ - uint32_t dir; + int dir; }; +struct pointer_accelerator; struct pointer_accelerator { struct motion_filter base; accel_profile_func_t profile; - double velocity; /* units/us */ - double last_velocity; /* units/us */ + double velocity; /* units/ms */ + double last_velocity; /* units/ms */ + struct normalized_coords last; struct pointer_tracker *trackers; int cur_tracker; - double threshold; /* units/us */ + double threshold; /* units/ms */ double accel; /* unitless factor */ double incline; /* incline of the function */ - /* For smoothing timestamps from devices with unreliable timing */ - uint64_t event_delta_smooth_threshold; - uint64_t event_delta_smooth_value; - - int dpi; -}; - -struct pointer_accelerator_flat { - struct motion_filter base; - - double factor; - int dpi; -}; - -struct tablet_accelerator_flat { - struct motion_filter base; - - double factor; - int xres, yres; - double xres_scale, /* 1000dpi : tablet res */ - yres_scale; /* 1000dpi : tablet res */ -}; - -struct trackpoint_accelerator { - struct motion_filter base; - - struct device_float_coords history[4]; - size_t history_size; - - double scale_factor; - double max_accel; - double max_delta; - - double incline; /* incline of the function */ - double offset; /* offset of the function */ + double dpi_factor; }; static void feed_trackers(struct pointer_accelerator *accel, - const struct device_float_coords *delta, + const struct normalized_coords *delta, uint64_t time) { int i, current; @@ -238,7 +134,7 @@ trackers[current].delta.x = 0.0; trackers[current].delta.y = 0.0; trackers[current].time = time; - trackers[current].dir = device_float_get_direction(*delta); + trackers[current].dir = normalized_get_direction(*delta); } static struct pointer_tracker * @@ -251,21 +147,14 @@ } static double -calculate_tracker_velocity(struct pointer_accelerator *accel, - struct pointer_tracker *tracker, uint64_t time) +calculate_tracker_velocity(struct pointer_tracker *tracker, uint64_t time) { - uint64_t tdelta = time - tracker->time + 1; - - if (tdelta < accel->event_delta_smooth_threshold) - tdelta = accel->event_delta_smooth_value; - - return hypot(tracker->delta.x, tracker->delta.y) / - (double)tdelta; /* units/us */ + double tdelta = time - tracker->time + 1; + return normalized_length(tracker->delta) / tdelta * 1000.0; /* units/ms */ } static inline double -calculate_velocity_after_timeout(struct pointer_accelerator *accel, - struct pointer_tracker *tracker) +calculate_velocity_after_timeout(struct pointer_tracker *tracker) { /* First movement after timeout needs special handling. * @@ -278,17 +167,10 @@ * for really slow movements but provides much more useful initial * movement in normal use-cases (pause, move, pause, move) */ - return calculate_tracker_velocity(accel, tracker, + return calculate_tracker_velocity(tracker, tracker->time + MOTION_TIMEOUT); } -/** - * Calculate the velocity based on the tracker data. Velocity is averaged - * across multiple historical values, provided those values aren't "too - * different" to our current one. That includes either being too far in the - * past, moving into a different direction or having too much of a velocity - * change between events. - */ static double calculate_velocity(struct pointer_accelerator *accel, uint64_t time) { @@ -306,18 +188,15 @@ for (offset = 1; offset < NUM_POINTER_TRACKERS; offset++) { tracker = tracker_by_offset(accel, offset); - /* Bug: time running backwards */ - if (tracker->time > time) - break; - /* Stop if too far away in time */ - if (time - tracker->time > MOTION_TIMEOUT) { + if (time - tracker->time > MOTION_TIMEOUT || + tracker->time > time) { if (offset == 1) - result = calculate_velocity_after_timeout(accel, tracker); + result = calculate_velocity_after_timeout(tracker); break; } - velocity = calculate_tracker_velocity(accel, tracker, time); + velocity = calculate_tracker_velocity(tracker, time); /* Stop if direction changed */ dir &= tracker->dir; @@ -341,19 +220,9 @@ } } - return result; /* units/us */ + return result; /* units/ms */ } -/** - * Apply the acceleration profile to the given velocity. - * - * @param accel The acceleration filter - * @param data Caller-specific data - * @param velocity Velocity in device-units per µs - * @param time Current time in µs - * - * @return A unitless acceleration factor, to be applied to the delta - */ static double acceleration_profile(struct pointer_accelerator *accel, void *data, double velocity, uint64_t time) @@ -361,18 +230,6 @@ return accel->profile(&accel->base, data, velocity, time); } -/** - * Calculate the acceleration factor for our current velocity, averaging - * between our current and the most recent velocity to smoothen out changes. - * - * @param accel The acceleration filter - * @param data Caller-specific data - * @param velocity Velocity in device-units per µs - * @param last_velocity Previous velocity in device-units per µs - * @param time Current time in µs - * - * @return A unitless acceleration factor, to be applied to the delta - */ static double calculate_acceleration(struct pointer_accelerator *accel, void *data, @@ -396,248 +253,43 @@ return factor; /* unitless factor */ } -/** - * Calculate the acceleration factor for the given delta with the timestamp. - * - * @param accel The acceleration filter - * @param unaccelerated The raw delta in the device's dpi - * @param data Caller-specific data - * @param time Current time in µs - * - * @return A unitless acceleration factor, to be applied to the delta - */ -static inline double -calculate_acceleration_factor(struct pointer_accelerator *accel, - const struct device_float_coords *unaccelerated, - void *data, - uint64_t time) -{ - double velocity; /* units/us in device-native dpi*/ - double accel_factor; - - feed_trackers(accel, unaccelerated, time); - velocity = calculate_velocity(accel, time); - accel_factor = calculate_acceleration(accel, - data, - velocity, - accel->last_velocity, - time); - accel->last_velocity = velocity; - - return accel_factor; -} - -/** - * Generic filter that calculates the acceleration factor and applies it to - * the coordinates. - * - * @param filter The acceleration filter - * @param unaccelerated The raw delta in the device's dpi - * @param data Caller-specific data - * @param time Current time in µs - * - * @return An accelerated tuple of coordinates representing accelerated - * motion, still in device units. - */ -static struct device_float_coords -accelerator_filter_generic(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time) -{ - struct pointer_accelerator *accel = - (struct pointer_accelerator *) filter; - double accel_value; /* unitless factor */ - struct device_float_coords accelerated; - - accel_value = calculate_acceleration_factor(accel, - unaccelerated, - data, - time); - - accelerated.x = accel_value * unaccelerated->x; - accelerated.y = accel_value * unaccelerated->y; - - return accelerated; -} - -static struct normalized_coords -accelerator_filter_post_normalized(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time) -{ - struct pointer_accelerator *accel = - (struct pointer_accelerator *) filter; - struct device_float_coords accelerated; - - /* Accelerate for device units, normalize afterwards */ - accelerated = accelerator_filter_generic(filter, - unaccelerated, - data, - time); - return normalize_for_dpi(&accelerated, accel->dpi); -} - static struct normalized_coords -accelerator_filter_pre_normalized(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time) +accelerator_filter(struct motion_filter *filter, + const struct normalized_coords *unaccelerated, + void *data, uint64_t time /* in us */) { struct pointer_accelerator *accel = (struct pointer_accelerator *) filter; - struct normalized_coords normalized; - struct device_float_coords converted, accelerated; + double velocity; /* units/ms */ + double accel_value; /* unitless factor */ + struct normalized_coords accelerated; + struct normalized_coords unnormalized; + double dpi_factor = accel->dpi_factor; - /* Accelerate for normalized units and return normalized units. - API requires device_floats, so we just copy the bits around */ - normalized = normalize_for_dpi(unaccelerated, accel->dpi); - converted.x = normalized.x; - converted.y = normalized.y; - - accelerated = accelerator_filter_generic(filter, - &converted, - data, - time); - normalized.x = accelerated.x; - normalized.y = accelerated.y; - return normalized; -} + /* For low-dpi mice, use device units, everything else uses + 1000dpi normalized */ + dpi_factor = min(1.0, dpi_factor); + unnormalized.x = unaccelerated->x * dpi_factor; + unnormalized.y = unaccelerated->y * dpi_factor; -static struct normalized_coords -accelerator_filter_unnormalized(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time) -{ - struct device_float_coords accelerated; - struct normalized_coords normalized; - - /* Accelerate for device units and return device units */ - accelerated = accelerator_filter_generic(filter, - unaccelerated, - data, - time); - normalized.x = accelerated.x; - normalized.y = accelerated.y; - return normalized; -} - -/** - * Generic filter that does nothing beyond converting from the device's - * native dpi into normalized coordinates. - * - * @param filter The acceleration filter - * @param unaccelerated The raw delta in the device's dpi - * @param data Caller-specific data - * @param time Current time in µs - * - * @return An accelerated tuple of coordinates representing normalized - * motion - */ -static struct normalized_coords -accelerator_filter_noop(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time) -{ - struct pointer_accelerator *accel = - (struct pointer_accelerator *) filter; + feed_trackers(accel, &unnormalized, time); + velocity = calculate_velocity(accel, time); + accel_value = calculate_acceleration(accel, + data, + velocity, + accel->last_velocity, + time); - return normalize_for_dpi(unaccelerated, accel->dpi); -} + accelerated.x = accel_value * unnormalized.x; + accelerated.y = accel_value * unnormalized.y; -static struct normalized_coords -accelerator_filter_x230(struct motion_filter *filter, - const struct device_float_coords *raw, - void *data, uint64_t time) -{ - struct pointer_accelerator *accel = - (struct pointer_accelerator *) filter; - double accel_factor; /* unitless factor */ - struct normalized_coords accelerated; - struct device_float_coords delta_normalized; - struct normalized_coords unaccelerated; - double velocity; /* units/us */ - - /* This filter is a "do not touch me" filter. So the hack here is - * just to replicate the old behavior before filters switched to - * device-native dpi: - * 1) convert from device-native to 1000dpi normalized - * 2) run all calculation on 1000dpi-normalized data - * 3) apply accel factor no normalized data - */ - unaccelerated = normalize_for_dpi(raw, accel->dpi); - delta_normalized.x = unaccelerated.x; - delta_normalized.y = unaccelerated.y; + accel->last = unnormalized; - feed_trackers(accel, &delta_normalized, time); - velocity = calculate_velocity(accel, time); - accel_factor = calculate_acceleration(accel, - data, - velocity, - accel->last_velocity, - time); accel->last_velocity = velocity; - accelerated.x = accel_factor * delta_normalized.x; - accelerated.y = accel_factor * delta_normalized.y; - return accelerated; } -static struct normalized_coords -accelerator_filter_constant_x230(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time) -{ - struct pointer_accelerator *accel = - (struct pointer_accelerator *) filter; - struct normalized_coords normalized; - const double factor = - X230_MAGIC_SLOWDOWN/X230_TP_MAGIC_LOW_RES_FACTOR; - - normalized = normalize_for_dpi(unaccelerated, accel->dpi); - normalized.x = factor * normalized.x; - normalized.y = factor * normalized.y; - - return normalized; -} - -static bool -touchpad_accelerator_set_speed(struct motion_filter *filter, - double speed_adjustment) -{ - struct pointer_accelerator *accel_filter = - (struct pointer_accelerator *)filter; - - assert(speed_adjustment >= -1.0 && speed_adjustment <= 1.0); - - /* Note: the numbers below are nothing but trial-and-error magic, - don't read more into them other than "they mostly worked ok" */ - - /* adjust when accel kicks in */ - accel_filter->threshold = TOUCHPAD_DEFAULT_THRESHOLD - - TOUCHPAD_THRESHOLD_RANGE * speed_adjustment; - accel_filter->accel = TOUCHPAD_ACCELERATION; - accel_filter->incline = TOUCHPAD_INCLINE; - filter->speed_adjustment = speed_adjustment; - - return true; -} - -static struct normalized_coords -touchpad_constant_filter(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time) -{ - struct pointer_accelerator *accel = - (struct pointer_accelerator *)filter; - struct normalized_coords normalized; - - normalized = normalize_for_dpi(unaccelerated, accel->dpi); - normalized.x = TP_MAGIC_SLOWDOWN * normalized.x; - normalized.y = TP_MAGIC_SLOWDOWN * normalized.y; - - return normalized; -} - static void accelerator_restart(struct motion_filter *filter, void *data, @@ -673,32 +325,65 @@ static bool accelerator_set_speed(struct motion_filter *filter, - double speed_adjustment) + double speed) { struct pointer_accelerator *accel_filter = (struct pointer_accelerator *)filter; - assert(speed_adjustment >= -1.0 && speed_adjustment <= 1.0); - - /* Note: the numbers below are nothing but trial-and-error magic, - don't read more into them other than "they mostly worked ok" */ + assert(speed >= -1.0 && speed <= 1.0); /* delay when accel kicks in */ - accel_filter->threshold = DEFAULT_THRESHOLD - - v_ms2us(0.25) * speed_adjustment; - if (accel_filter->threshold < MINIMUM_THRESHOLD) - accel_filter->threshold = MINIMUM_THRESHOLD; + accel_filter->threshold = DEFAULT_THRESHOLD - speed / 4000.0; + if (accel_filter->threshold < 0.0002) + accel_filter->threshold = 0.0002; /* adjust max accel factor */ - accel_filter->accel = DEFAULT_ACCELERATION + speed_adjustment * 1.5; + accel_filter->accel = DEFAULT_ACCELERATION + speed * 1.5; /* higher speed -> faster to reach max */ - accel_filter->incline = DEFAULT_INCLINE + speed_adjustment * 0.75; + accel_filter->incline = DEFAULT_INCLINE + speed * 0.75; - filter->speed_adjustment = speed_adjustment; + filter->speed = speed; return true; } +struct motion_filter_interface accelerator_interface = { + accelerator_filter, + accelerator_restart, + accelerator_destroy, + accelerator_set_speed, +}; + +struct motion_filter * +create_pointer_accelerator_filter(accel_profile_func_t profile, + int dpi) +{ + struct pointer_accelerator *filter; + + filter = zalloc(sizeof *filter); + if (filter == NULL) + return NULL; + + filter->base.interface = &accelerator_interface; + + filter->profile = profile; + filter->last_velocity = 0.0; + filter->last.x = 0; + filter->last.y = 0; + + filter->trackers = + calloc(NUM_POINTER_TRACKERS, sizeof *filter->trackers); + filter->cur_tracker = 0; + + filter->threshold = DEFAULT_THRESHOLD; + filter->accel = DEFAULT_ACCELERATION; + filter->incline = DEFAULT_INCLINE; + + filter->dpi_factor = dpi/(double)DEFAULT_MOUSE_DPI; + + return &filter->base; +} + /** * Custom acceleration function for mice < 1000dpi. * At slow motion, a single device unit causes a one-pixel movement. @@ -712,32 +397,25 @@ double pointer_accel_profile_linear_low_dpi(struct motion_filter *filter, void *data, - double speed_in, /* in device units (units/us) */ - uint64_t time) + double speed_in, /* in device units (units/ms) */ + uint64_t time /* in us */) { struct pointer_accelerator *accel_filter = (struct pointer_accelerator *)filter; + double s1, s2; double max_accel = accel_filter->accel; /* unitless factor */ - double threshold = accel_filter->threshold; /* units/us */ + const double threshold = accel_filter->threshold; /* units/ms */ const double incline = accel_filter->incline; - double dpi_factor = accel_filter->dpi/(double)DEFAULT_MOUSE_DPI; - double factor; /* unitless */ + double factor; + double dpi_factor = accel_filter->dpi_factor; - /* dpi_factor is always < 1.0, increase max_accel, reduce - the threshold so it kicks in earlier */ max_accel /= dpi_factor; - threshold *= dpi_factor; - /* see pointer_accel_profile_linear for a long description */ - if (v_us2ms(speed_in) < 0.07) - factor = 10 * v_us2ms(speed_in) + 0.3; - else if (speed_in < threshold) - factor = 1; - else - factor = incline * v_us2ms(speed_in - threshold) + 1; + s1 = min(1, 0.3 + speed_in * 10.0); + s2 = 1 + (speed_in - threshold * dpi_factor) * incline; - factor = min(max_accel, factor); + factor = min(max_accel, s2 > 1 ? s2 : s1); return factor; } @@ -745,75 +423,22 @@ double pointer_accel_profile_linear(struct motion_filter *filter, void *data, - double speed_in, /* in device units (units/µs) */ - uint64_t time) + double speed_in, /* 1000-dpi normalized */ + uint64_t time /* in us */) { struct pointer_accelerator *accel_filter = (struct pointer_accelerator *)filter; + + double s1, s2; const double max_accel = accel_filter->accel; /* unitless factor */ - const double threshold = accel_filter->threshold; /* units/us */ + const double threshold = accel_filter->threshold; /* units/ms */ const double incline = accel_filter->incline; - double factor; /* unitless */ - - /* Normalize to 1000dpi, because the rest below relies on that */ - speed_in = speed_in * DEFAULT_MOUSE_DPI/accel_filter->dpi; + double factor; - /* - Our acceleration function calculates a factor to accelerate input - deltas with. The function is a double incline with a plateau, - with a rough shape like this: - - accel - factor - ^ - | / - | _____/ - | / - |/ - +-------------> speed in - - The two inclines are linear functions in the form - y = ax + b - where y is speed_out - x is speed_in - a is the incline of acceleration - b is minimum acceleration factor - - for speeds up to 0.07 u/ms, we decelerate, down to 30% of input - speed. - hence 1 = a * 0.07 + 0.3 - 0.7 = a * 0.07 => a := 10 - deceleration function is thus: - y = 10x + 0.3 - - Note: - * 0.07u/ms as threshold is a result of trial-and-error and - has no other intrinsic meaning. - * 0.3 is chosen simply because it is above the Nyquist frequency - for subpixel motion within a pixel. - */ - if (v_us2ms(speed_in) < 0.07) { - factor = 10 * v_us2ms(speed_in) + 0.3; - /* up to the threshold, we keep factor 1, i.e. 1:1 movement */ - } else if (speed_in < threshold) { - factor = 1; - - } else { - /* Acceleration function above the threshold: - y = ax' + b - where T is threshold - x is speed_in - x' is speed - and - y(T) == 1 - hence 1 = ax' + 1 - => x' := (x - T) - */ - factor = incline * v_us2ms(speed_in - threshold) + 1; - } + s1 = min(1, 0.3 + speed_in * 10); + s2 = 1 + (speed_in - threshold) * incline; - /* Cap at the maximum acceleration factor */ - factor = min(max_accel, factor); + factor = min(max_accel, s2 > 1 ? s2 : s1); return factor; } @@ -821,697 +446,57 @@ double touchpad_accel_profile_linear(struct motion_filter *filter, void *data, - double speed_in, /* in device units/µs */ - uint64_t time) + double speed_in, + uint64_t time /* in us */) { - struct pointer_accelerator *accel_filter = - (struct pointer_accelerator *)filter; - const double max_accel = accel_filter->accel; /* unitless factor */ - const double threshold = accel_filter->threshold; /* units/us */ - const double incline = accel_filter->incline; - double factor; /* unitless */ + /* Once normalized, touchpads see the same + acceleration as mice. that is technically correct but + subjectively wrong, we expect a touchpad to be a lot + slower than a mouse. Apply a magic factor here and proceed + as normal. */ + const double TP_MAGIC_SLOWDOWN = 0.4; + double speed_out; - /* Convert to mm/s because that's something one can understand */ - speed_in = v_us2s(speed_in) * 25.4/accel_filter->dpi; + speed_in *= TP_MAGIC_SLOWDOWN; - /* - Our acceleration function calculates a factor to accelerate input - deltas with. The function is a double incline with a plateau, - with a rough shape like this: - - accel - factor - ^ - | / - | _____/ - | / - |/ - +-------------> speed in - - The two inclines are linear functions in the form - y = ax + b - where y is speed_out - x is speed_in - a is the incline of acceleration - b is minimum acceleration factor - - for speeds up to the lower threshold, we decelerate, down to 30% - of input speed. - hence 1 = a * 7 + 0.3 - 0.7 = a * 7 => a := 0.1 - deceleration function is thus: - y = 0.1x + 0.3 - - Note: - * The minimum threshold is a result of trial-and-error and - has no other intrinsic meaning. - * 0.3 is chosen simply because it is above the Nyquist frequency - for subpixel motion within a pixel. - */ - if (speed_in < 7.0) { - factor = 0.1 * speed_in + 0.3; - /* up to the threshold, we keep factor 1, i.e. 1:1 movement */ - } else if (speed_in < threshold) { - factor = 1; - } else { - /* Acceleration function above the threshold: - y = ax' + b - where T is threshold - x is speed_in - x' is speed - and - y(T) == 1 - hence 1 = ax' + 1 - => x' := (x - T) - */ - factor = incline * (speed_in - threshold) + 1; - } - - /* Cap at the maximum acceleration factor */ - factor = min(max_accel, factor); + speed_out = pointer_accel_profile_linear(filter, data, speed_in, time); - /* Scale everything depending on the acceleration set */ - factor *= 1 + 0.5 * filter->speed_adjustment; - - return factor * TP_MAGIC_SLOWDOWN; + return speed_out * TP_MAGIC_SLOWDOWN; } double touchpad_lenovo_x230_accel_profile(struct motion_filter *filter, void *data, - double speed_in, /* 1000dpi-units/µs */ - uint64_t time) + double speed_in, + uint64_t time /* in us */) { + /* Keep the magic factor from touchpad_accel_profile_linear. */ + const double TP_MAGIC_SLOWDOWN = 0.4; + /* Those touchpads presents an actual lower resolution that what is * advertised. We see some jumps from the cursor due to the big steps * in X and Y when we are receiving data. * Apply a factor to minimize those jumps at low speed, and try * keeping the same feeling as regular touchpads at high speed. * It still feels slower but it is usable at least */ - double factor; /* unitless */ + const double TP_MAGIC_LOW_RES_FACTOR = 4.0; + double speed_out; struct pointer_accelerator *accel_filter = (struct pointer_accelerator *)filter; - double f1, f2; /* unitless */ + double s1, s2; const double max_accel = accel_filter->accel * - X230_TP_MAGIC_LOW_RES_FACTOR; /* unitless factor */ + TP_MAGIC_LOW_RES_FACTOR; /* unitless factor */ const double threshold = accel_filter->threshold / - X230_TP_MAGIC_LOW_RES_FACTOR; /* units/us */ - const double incline = accel_filter->incline * X230_TP_MAGIC_LOW_RES_FACTOR; - - /* Note: the magic values in this function are obtained by - * trial-and-error. No other meaning should be interpreted. - * The calculation is a compressed form of - * pointer_accel_profile_linear(), look at the git history of that - * function for an explanation of what the min/max/etc. does. - */ - speed_in *= X230_MAGIC_SLOWDOWN / X230_TP_MAGIC_LOW_RES_FACTOR; - - f1 = min(1, v_us2ms(speed_in) * 5); - f2 = 1 + (v_us2ms(speed_in) - v_us2ms(threshold)) * incline; - - factor = min(max_accel, f2 > 1 ? f2 : f1); - - return factor * X230_MAGIC_SLOWDOWN / X230_TP_MAGIC_LOW_RES_FACTOR; -} - -struct motion_filter_interface accelerator_interface = { - .type = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE, - .filter = accelerator_filter_pre_normalized, - .filter_constant = accelerator_filter_noop, - .restart = accelerator_restart, - .destroy = accelerator_destroy, - .set_speed = accelerator_set_speed, -}; - -static struct pointer_accelerator * -create_default_filter(int dpi) -{ - struct pointer_accelerator *filter; - - filter = zalloc(sizeof *filter); - filter->last_velocity = 0.0; - - filter->trackers = - zalloc(NUM_POINTER_TRACKERS * sizeof *filter->trackers); - filter->cur_tracker = 0; - - filter->threshold = DEFAULT_THRESHOLD; - filter->accel = DEFAULT_ACCELERATION; - filter->incline = DEFAULT_INCLINE; - filter->dpi = dpi; - - return filter; -} - -struct motion_filter * -create_pointer_accelerator_filter_linear(int dpi) -{ - struct pointer_accelerator *filter; - - filter = create_default_filter(dpi); - if (!filter) - return NULL; - - filter->base.interface = &accelerator_interface; - filter->profile = pointer_accel_profile_linear; - - return &filter->base; -} - -struct motion_filter_interface accelerator_interface_low_dpi = { - .type = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE, - .filter = accelerator_filter_unnormalized, - .filter_constant = accelerator_filter_noop, - .restart = accelerator_restart, - .destroy = accelerator_destroy, - .set_speed = accelerator_set_speed, -}; - -struct motion_filter * -create_pointer_accelerator_filter_linear_low_dpi(int dpi) -{ - struct pointer_accelerator *filter; - - filter = create_default_filter(dpi); - if (!filter) - return NULL; - - filter->base.interface = &accelerator_interface_low_dpi; - filter->profile = pointer_accel_profile_linear_low_dpi; - - return &filter->base; -} - -struct motion_filter_interface accelerator_interface_touchpad = { - .type = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE, - .filter = accelerator_filter_post_normalized, - .filter_constant = touchpad_constant_filter, - .restart = accelerator_restart, - .destroy = accelerator_destroy, - .set_speed = touchpad_accelerator_set_speed, -}; - -struct motion_filter * -create_pointer_accelerator_filter_touchpad(int dpi, - uint64_t event_delta_smooth_threshold, - uint64_t event_delta_smooth_value) -{ - struct pointer_accelerator *filter; - - filter = create_default_filter(dpi); - if (!filter) - return NULL; - - filter->base.interface = &accelerator_interface_touchpad; - filter->profile = touchpad_accel_profile_linear; - filter->event_delta_smooth_threshold = event_delta_smooth_threshold; - filter->event_delta_smooth_value = event_delta_smooth_value; - - return &filter->base; -} - -struct motion_filter_interface accelerator_interface_x230 = { - .type = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE, - .filter = accelerator_filter_x230, - .filter_constant = accelerator_filter_constant_x230, - .restart = accelerator_restart, - .destroy = accelerator_destroy, - .set_speed = accelerator_set_speed, -}; - -/* The Lenovo x230 has a bad touchpad. This accel method has been - * trial-and-error'd, any changes to it will require re-testing everything. - * Don't touch this. - */ -struct motion_filter * -create_pointer_accelerator_filter_lenovo_x230(int dpi) -{ - struct pointer_accelerator *filter; - - filter = zalloc(sizeof *filter); - filter->base.interface = &accelerator_interface_x230; - filter->profile = touchpad_lenovo_x230_accel_profile; - filter->last_velocity = 0.0; - - filter->trackers = - zalloc(NUM_POINTER_TRACKERS * sizeof *filter->trackers); - filter->cur_tracker = 0; - - filter->threshold = X230_THRESHOLD; - filter->accel = X230_ACCELERATION; /* unitless factor */ - filter->incline = X230_INCLINE; /* incline of the acceleration function */ - filter->dpi = dpi; - - return &filter->base; -} - -double -trackpoint_accel_profile(struct motion_filter *filter, - void *data, - double delta) -{ - struct trackpoint_accelerator *accel_filter = - (struct trackpoint_accelerator *)filter; - const double max_accel = accel_filter->max_accel; - double factor; - - delta = fabs(delta); - - /* This is almost the equivalent of the xserver acceleration - at sensitivity 128 and speed 0.0 */ - factor = delta * accel_filter->incline + accel_filter->offset; - factor = min(factor, max_accel); - - return factor; -} + TP_MAGIC_LOW_RES_FACTOR; /* units/ms */ + const double incline = accel_filter->incline * TP_MAGIC_LOW_RES_FACTOR; -/** - * Average the deltas, they are messy and can provide sequences like 7, 7, - * 9, 8, 14, 7, 9, 8 ... The outliers cause unpredictable jumps, so average - * them out. - */ -static inline struct device_float_coords -trackpoint_average_delta(struct trackpoint_accelerator *filter, - const struct device_float_coords *unaccelerated) -{ - size_t i; - struct device_float_coords avg = {0}; - - memmove(&filter->history[1], - &filter->history[0], - sizeof(*filter->history) * (filter->history_size - 1)); - filter->history[0] = *unaccelerated; - - for (i = 0; i < filter->history_size; i++) { - avg.x += filter->history[i].x; - avg.y += filter->history[i].y; - } - avg.x /= filter->history_size; - avg.y /= filter->history_size; - - return avg; -} - -/** - * Undo any system-wide magic scaling, so we're behaving the same regardless - * of the trackpoint hardware. This way we can apply our profile independent - * of any other configuration that messes with things. - */ -static inline struct device_float_coords -trackpoint_normalize_deltas(const struct trackpoint_accelerator *accel_filter, - const struct device_float_coords *delta) -{ - struct device_float_coords scaled = *delta; - - scaled.x *= accel_filter->scale_factor; - scaled.y *= accel_filter->scale_factor; - - return scaled; -} - -/** - * We set a max delta per event, to avoid extreme jumps once we exceed the - * expected pressure. Trackpoint hardware is inconsistent once the pressure - * gets high, so we can expect sequences like 30, 40, 35, 55, etc. This may - * be caused by difficulty keeping up high consistent pressures or just - * measuring errors in the hardware. Either way, we cap to a max delta so - * once we hit the high pressures, movement is capped and consistent. - */ -static inline struct normalized_coords -trackpoint_clip_to_max_delta(const struct trackpoint_accelerator *accel_filter, - struct normalized_coords coords) -{ - const double max_delta = accel_filter->max_delta; - - if (abs(coords.x) > max_delta) - coords.x = copysign(max_delta, coords.x); - if (abs(coords.y) > max_delta) - coords.y = copysign(max_delta, coords.y); - - return coords; -} - -static struct normalized_coords -trackpoint_accelerator_filter(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time) -{ - struct trackpoint_accelerator *accel_filter = - (struct trackpoint_accelerator *)filter; - struct device_float_coords scaled; - struct device_float_coords avg; - struct normalized_coords coords; - double f; - double delta; + speed_in *= TP_MAGIC_SLOWDOWN / TP_MAGIC_LOW_RES_FACTOR; - scaled = trackpoint_normalize_deltas(accel_filter, unaccelerated); - avg = trackpoint_average_delta(accel_filter, &scaled); + s1 = min(1, speed_in * 5); + s2 = 1 + (speed_in - threshold) * incline; - delta = hypot(avg.x, avg.y); + speed_out = min(max_accel, s2 > 1 ? s2 : s1); - f = trackpoint_accel_profile(filter, data, delta); - - coords.x = avg.x * f; - coords.y = avg.y * f; - - coords = trackpoint_clip_to_max_delta(accel_filter, coords); - - return coords; -} - -static struct normalized_coords -trackpoint_accelerator_filter_noop(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time) -{ - - struct trackpoint_accelerator *accel_filter = - (struct trackpoint_accelerator *)filter; - struct device_float_coords scaled; - struct device_float_coords avg; - struct normalized_coords coords; - - scaled = trackpoint_normalize_deltas(accel_filter, unaccelerated); - avg = trackpoint_average_delta(accel_filter, &scaled); - - coords.x = avg.x; - coords.y = avg.y; - - coords = trackpoint_clip_to_max_delta(accel_filter, coords); - - return coords; -} - -static bool -trackpoint_accelerator_set_speed(struct motion_filter *filter, - double speed_adjustment) -{ - struct trackpoint_accelerator *accel_filter = - (struct trackpoint_accelerator*)filter; - double incline, offset, max; - - assert(speed_adjustment >= -1.0 && speed_adjustment <= 1.0); - - /* Helloooo, magic numbers. - - These numbers were obtained by finding an acceleration curve that - provides precision at slow speeds but still provides a good - acceleration at higher pressure - and a quick ramp-up to that - acceleration. - - Trackpoints have built-in acceleration curves already, so we - don't put a new function on top, we merely scale the output from - those curves (re-calculating the pressure values from the - firmware-defined curve and applying a new curve is unreliable). - - For that basic scaling, we assume a constant factor f based on - the speed setting together with a maximum factor m (for this - speed setting). Delta acceleration is thus: - factor = max(m, f) - accelerated_delta = delta * factor; - - Trial and error showed a couple of pairs that work well for the - various speed settings (Lenovo T440, sensitivity 128): - - -1.0: f = 0.3, m = 1 - -0.5: f = 0.6, m = 2 - 0.0: f = 1.0, m = 6 - 0.5: f = 1.4, m = 8 - 1.0: f = 1.9, m = 15 - - Note: if f >= 2.0, some pixels are unaddressable - - Those pairs were fed into the linear/exponential regression tool - at http://www.xuru.org/rt/LR.asp and show two functions that map - speed settings to the respective f and m. - Given a speed setting s in [-1.0, 1.0] - f(s) = 0.8 * s + 1.04 - m(s) = 4.6 * e**(1.2 * s) - These are close enough to the tested pairs. - */ - - max = 4.6 * pow(M_E, 1.2 * speed_adjustment); - incline = 0.8 * speed_adjustment + 1.04; - offset = 0; - - accel_filter->max_accel = max; - accel_filter->incline = incline; - accel_filter->offset = offset; - filter->speed_adjustment = speed_adjustment; - - return true; -} - -static void -trackpoint_accelerator_destroy(struct motion_filter *filter) -{ - struct trackpoint_accelerator *accel_filter = - (struct trackpoint_accelerator *)filter; - - free(accel_filter); -} - -struct motion_filter_interface accelerator_interface_trackpoint = { - .type = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE, - .filter = trackpoint_accelerator_filter, - .filter_constant = trackpoint_accelerator_filter_noop, - .restart = NULL, - .destroy = trackpoint_accelerator_destroy, - .set_speed = trackpoint_accelerator_set_speed, -}; - -struct motion_filter * -create_pointer_accelerator_filter_trackpoint(int max_hw_delta) -{ - struct trackpoint_accelerator *filter; - - /* Trackpoints are special. They don't have a movement speed like a - * mouse or a finger, instead they send a constant stream of events - * based on the pressure applied. - * - * Physical ranges on a trackpoint are the max values for relative - * deltas, but these are highly device-specific. - * - */ - - filter = zalloc(sizeof *filter); - if (!filter) - return NULL; - - filter->history_size = ARRAY_LENGTH(filter->history); - filter->scale_factor = 1.0 * TRACKPOINT_DEFAULT_RANGE / max_hw_delta; - filter->max_accel = TRACKPOINT_DEFAULT_MAX_ACCEL; - filter->max_delta = TRACKPOINT_DEFAULT_MAX_DELTA; - - filter->base.interface = &accelerator_interface_trackpoint; - - return &filter->base; -} - -static struct normalized_coords -accelerator_filter_flat(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time) -{ - struct pointer_accelerator_flat *accel_filter = - (struct pointer_accelerator_flat *)filter; - double factor; /* unitless factor */ - struct normalized_coords accelerated; - - /* You want flat acceleration, you get flat acceleration for the - * device */ - factor = accel_filter->factor; - accelerated.x = factor * unaccelerated->x; - accelerated.y = factor * unaccelerated->y; - - return accelerated; -} - -static bool -accelerator_set_speed_flat(struct motion_filter *filter, - double speed_adjustment) -{ - struct pointer_accelerator_flat *accel_filter = - (struct pointer_accelerator_flat *)filter; - - assert(speed_adjustment >= -1.0 && speed_adjustment <= 1.0); - - /* Speed rage is 0-200% of the nominal speed, with 0 mapping to the - * nominal speed. Anything above 200 is pointless, we're already - * skipping over ever second pixel at 200% speed. - */ - - accel_filter->factor = max(0.005, 1 + speed_adjustment); - filter->speed_adjustment = speed_adjustment; - - return true; -} - -static void -accelerator_destroy_flat(struct motion_filter *filter) -{ - struct pointer_accelerator_flat *accel = - (struct pointer_accelerator_flat *) filter; - - free(accel); -} - -struct motion_filter_interface accelerator_interface_flat = { - .type = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT, - .filter = accelerator_filter_flat, - .filter_constant = accelerator_filter_noop, - .restart = NULL, - .destroy = accelerator_destroy_flat, - .set_speed = accelerator_set_speed_flat, -}; - -struct motion_filter * -create_pointer_accelerator_filter_flat(int dpi) -{ - struct pointer_accelerator_flat *filter; - - filter = zalloc(sizeof *filter); - filter->base.interface = &accelerator_interface_flat; - filter->dpi = dpi; - - return &filter->base; -} - -static inline struct normalized_coords -tablet_accelerator_filter_flat_mouse(struct tablet_accelerator_flat *filter, - const struct device_float_coords *units) -{ - struct normalized_coords accelerated; - - /* - Tablets are high res (Intuos 4 is 5080 dpi) and unmodified deltas - are way too high. Slow it down to the equivalent of a 1000dpi - mouse. The ratio of that is: - ratio = 1000/(resolution_per_mm * 25.4) - - i.e. on the Intuos4 it's a ratio of ~1/5. - */ - - accelerated.x = units->x * filter->xres_scale; - accelerated.y = units->y * filter->yres_scale; - - accelerated.x *= filter->factor; - accelerated.y *= filter->factor; - - return accelerated; -} - -static struct normalized_coords -tablet_accelerator_filter_flat_pen(struct tablet_accelerator_flat *filter, - const struct device_float_coords *units) -{ - struct normalized_coords accelerated; - - /* Tablet input is in device units, output is supposed to be in - * logical pixels roughly equivalent to a mouse/touchpad. - * - * This is a magical constant found by trial and error. On a 96dpi - * screen 0.4mm of movement correspond to 1px logical pixel which - * is almost identical to the tablet mapped to screen in absolute - * mode. Tested on a Intuos5, other tablets may vary. - */ - const double DPI_CONVERSION = 96.0/25.4 * 2.5; /* unitless factor */ - struct normalized_coords mm; - - mm.x = 1.0 * units->x/filter->xres; - mm.y = 1.0 * units->y/filter->yres; - accelerated.x = mm.x * filter->factor * DPI_CONVERSION; - accelerated.y = mm.y * filter->factor * DPI_CONVERSION; - - return accelerated; -} - -static struct normalized_coords -tablet_accelerator_filter_flat(struct motion_filter *filter, - const struct device_float_coords *units, - void *data, uint64_t time) -{ - struct tablet_accelerator_flat *accel_filter = - (struct tablet_accelerator_flat *)filter; - struct libinput_tablet_tool *tool = (struct libinput_tablet_tool*)data; - enum libinput_tablet_tool_type type; - struct normalized_coords accel; - - type = libinput_tablet_tool_get_type(tool); - - switch (type) { - case LIBINPUT_TABLET_TOOL_TYPE_MOUSE: - case LIBINPUT_TABLET_TOOL_TYPE_LENS: - accel = tablet_accelerator_filter_flat_mouse(accel_filter, - units); - break; - default: - accel = tablet_accelerator_filter_flat_pen(accel_filter, - units); - break; - } - - return accel; -} - -static bool -tablet_accelerator_set_speed(struct motion_filter *filter, - double speed_adjustment) -{ - struct tablet_accelerator_flat *accel_filter = - (struct tablet_accelerator_flat *)filter; - - assert(speed_adjustment >= -1.0 && speed_adjustment <= 1.0); - - accel_filter->factor = speed_adjustment + 1.0; - - return true; -} - -static void -tablet_accelerator_destroy(struct motion_filter *filter) -{ - struct tablet_accelerator_flat *accel_filter = - (struct tablet_accelerator_flat *)filter; - - free(accel_filter); -} - -struct motion_filter_interface accelerator_interface_tablet = { - .type = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT, - .filter = tablet_accelerator_filter_flat, - .filter_constant = NULL, - .restart = NULL, - .destroy = tablet_accelerator_destroy, - .set_speed = tablet_accelerator_set_speed, -}; - -static struct tablet_accelerator_flat * -create_tablet_filter_flat(int xres, int yres) -{ - struct tablet_accelerator_flat *filter; - - filter = zalloc(sizeof *filter); - filter->factor = 1.0; - filter->xres = xres; - filter->yres = yres; - filter->xres_scale = DEFAULT_MOUSE_DPI/(25.4 * xres); - filter->yres_scale = DEFAULT_MOUSE_DPI/(25.4 * yres); - - return filter; -} - -struct motion_filter * -create_pointer_accelerator_filter_tablet(int xres, int yres) -{ - struct tablet_accelerator_flat *filter; - - filter = create_tablet_filter_flat(xres, yres); - if (!filter) - return NULL; - - filter->base.interface = &accelerator_interface_tablet; - - return &filter->base; + return speed_out * TP_MAGIC_SLOWDOWN / TP_MAGIC_LOW_RES_FACTOR; } diff -Nru libinput-1.10.3/src/filter.h libinput-0.21.0/src/filter.h --- libinput-1.10.3/src/filter.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/filter.h 2015-08-03 05:08:55.000000000 +0000 @@ -34,54 +34,11 @@ struct motion_filter; -/** - * Accelerate the given coordinates. - * Takes a set of unaccelerated deltas and accelerates them based on the - * current and previous motion. - * - * This is a superset of filter_dispatch_constant() - * - * @param filter The device's motion filter - * @param unaccelerated The unaccelerated delta in the device's dpi - * resolution as specified during filter creation. If a device has uneven - * resolution for x and y, one axis needs to be scaled to match the - * originally provided resolution. - * @param data Custom data - * @param time The time of the delta - * - * @return A set of normalized coordinates that can be used for pixel - * movement. The normalized coordiantes are scaled to the default dpi range, - * i.e. regardless of the resolution of the underlying device, the returned - * values always reflect a 1000dpi mouse. - * - * @see filter_dispatch_constant - */ struct normalized_coords filter_dispatch(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, + const struct normalized_coords *unaccelerated, void *data, uint64_t time); -/** - * Apply constant motion filters, but no acceleration. - * - * Takes a set of unaccelerated deltas and applies any constant filters to - * it but does not accelerate the delta in the conventional sense. - * - * @param filter The device's motion filter - * @param unaccelerated The unaccelerated delta in the device's dpi - * resolution as specified during filter creation. If a device has uneven - * resolution for x and y, one axis needs to be scaled to match the - * originally provided resolution. - * @param data Custom data - * @param time The time of the delta - * - * @see filter_dispatch - */ -struct normalized_coords -filter_dispatch_constant(struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time); - void filter_restart(struct motion_filter *filter, void *data, uint64_t time); @@ -95,37 +52,14 @@ double filter_get_speed(struct motion_filter *filter); -enum libinput_config_accel_profile -filter_get_type(struct motion_filter *filter); - typedef double (*accel_profile_func_t)(struct motion_filter *filter, void *data, double velocity, uint64_t time); -/* Pointer acceleration types */ -struct motion_filter * -create_pointer_accelerator_filter_flat(int dpi); - -struct motion_filter * -create_pointer_accelerator_filter_linear(int dpi); - struct motion_filter * -create_pointer_accelerator_filter_linear_low_dpi(int dpi); - -struct motion_filter * -create_pointer_accelerator_filter_touchpad(int dpi, - uint64_t event_delta_smooth_threshold, - uint64_t event_delta_smooth_value); - -struct motion_filter * -create_pointer_accelerator_filter_lenovo_x230(int dpi); - -struct motion_filter * -create_pointer_accelerator_filter_trackpoint(int max_delta); - -struct motion_filter * -create_pointer_accelerator_filter_tablet(int xres, int yres); +create_pointer_accelerator_filter(accel_profile_func_t filter, + int dpi); /* * Pointer acceleration profiles. @@ -151,8 +85,4 @@ void *data, double speed_in, uint64_t time); -double -trackpoint_accel_profile(struct motion_filter *filter, - void *data, - double delta); #endif /* FILTER_H */ diff -Nru libinput-1.10.3/src/filter-private.h libinput-0.21.0/src/filter-private.h --- libinput-1.10.3/src/filter-private.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/filter-private.h 2015-08-03 04:55:20.000000000 +0000 @@ -29,25 +29,20 @@ #include "filter.h" struct motion_filter_interface { - enum libinput_config_accel_profile type; struct normalized_coords (*filter)( struct motion_filter *filter, - const struct device_float_coords *unaccelerated, - void *data, uint64_t time); - struct normalized_coords (*filter_constant)( - struct motion_filter *filter, - const struct device_float_coords *unaccelerated, + const struct normalized_coords *unaccelerated, void *data, uint64_t time); void (*restart)(struct motion_filter *filter, void *data, uint64_t time); void (*destroy)(struct motion_filter *filter); bool (*set_speed)(struct motion_filter *filter, - double speed_adjustment); + double speed); }; struct motion_filter { - double speed_adjustment; /* normalized [-1, 1] */ + double speed; /* normalized [-1, 1] */ struct motion_filter_interface *interface; }; diff -Nru libinput-1.10.3/src/libinput.c libinput-0.21.0/src/libinput.c --- libinput-1.10.3/src/libinput.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/libinput.c 2015-08-03 04:55:20.000000000 +0000 @@ -25,10 +25,8 @@ #include "config.h" #include -#include #include #include -#include #include #include #include @@ -44,41 +42,10 @@ if (!check_event_type(li_, __func__, type_, __VA_ARGS__, -1)) \ return retval_; \ -#define ASSERT_INT_SIZE(type_) \ - static_assert(sizeof(type_) == sizeof(unsigned int), \ - "sizeof(" #type_ ") must be sizeof(uint)") - -ASSERT_INT_SIZE(enum libinput_log_priority); -ASSERT_INT_SIZE(enum libinput_device_capability); -ASSERT_INT_SIZE(enum libinput_key_state); -ASSERT_INT_SIZE(enum libinput_led); -ASSERT_INT_SIZE(enum libinput_button_state); -ASSERT_INT_SIZE(enum libinput_pointer_axis); -ASSERT_INT_SIZE(enum libinput_pointer_axis_source); -ASSERT_INT_SIZE(enum libinput_tablet_pad_ring_axis_source); -ASSERT_INT_SIZE(enum libinput_tablet_pad_strip_axis_source); -ASSERT_INT_SIZE(enum libinput_tablet_tool_type); -ASSERT_INT_SIZE(enum libinput_tablet_tool_proximity_state); -ASSERT_INT_SIZE(enum libinput_tablet_tool_tip_state); -ASSERT_INT_SIZE(enum libinput_switch_state); -ASSERT_INT_SIZE(enum libinput_switch); -ASSERT_INT_SIZE(enum libinput_event_type); -ASSERT_INT_SIZE(enum libinput_config_status); -ASSERT_INT_SIZE(enum libinput_config_tap_state); -ASSERT_INT_SIZE(enum libinput_config_tap_button_map); -ASSERT_INT_SIZE(enum libinput_config_drag_state); -ASSERT_INT_SIZE(enum libinput_config_drag_lock_state); -ASSERT_INT_SIZE(enum libinput_config_send_events_mode); -ASSERT_INT_SIZE(enum libinput_config_accel_profile); -ASSERT_INT_SIZE(enum libinput_config_click_method); -ASSERT_INT_SIZE(enum libinput_config_middle_emulation_state); -ASSERT_INT_SIZE(enum libinput_config_scroll_method); -ASSERT_INT_SIZE(enum libinput_config_dwt_state); - static inline bool check_event_type(struct libinput *libinput, const char *function_name, - unsigned int type_in, + enum libinput_event_type type_in, ...) { bool rc = false; @@ -106,43 +73,6 @@ return rc; } -static inline const char * -event_type_to_str(enum libinput_event_type type) -{ - switch(type) { - CASE_RETURN_STRING(LIBINPUT_EVENT_DEVICE_ADDED); - CASE_RETURN_STRING(LIBINPUT_EVENT_DEVICE_REMOVED); - CASE_RETURN_STRING(LIBINPUT_EVENT_KEYBOARD_KEY); - CASE_RETURN_STRING(LIBINPUT_EVENT_POINTER_MOTION); - CASE_RETURN_STRING(LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE); - CASE_RETURN_STRING(LIBINPUT_EVENT_POINTER_BUTTON); - CASE_RETURN_STRING(LIBINPUT_EVENT_POINTER_AXIS); - CASE_RETURN_STRING(LIBINPUT_EVENT_TOUCH_DOWN); - CASE_RETURN_STRING(LIBINPUT_EVENT_TOUCH_UP); - CASE_RETURN_STRING(LIBINPUT_EVENT_TOUCH_MOTION); - CASE_RETURN_STRING(LIBINPUT_EVENT_TOUCH_CANCEL); - CASE_RETURN_STRING(LIBINPUT_EVENT_TOUCH_FRAME); - CASE_RETURN_STRING(LIBINPUT_EVENT_TABLET_TOOL_AXIS); - CASE_RETURN_STRING(LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - CASE_RETURN_STRING(LIBINPUT_EVENT_TABLET_TOOL_TIP); - CASE_RETURN_STRING(LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - CASE_RETURN_STRING(LIBINPUT_EVENT_TABLET_PAD_BUTTON); - CASE_RETURN_STRING(LIBINPUT_EVENT_TABLET_PAD_RING); - CASE_RETURN_STRING(LIBINPUT_EVENT_TABLET_PAD_STRIP); - CASE_RETURN_STRING(LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN); - CASE_RETURN_STRING(LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE); - CASE_RETURN_STRING(LIBINPUT_EVENT_GESTURE_SWIPE_END); - CASE_RETURN_STRING(LIBINPUT_EVENT_GESTURE_PINCH_BEGIN); - CASE_RETURN_STRING(LIBINPUT_EVENT_GESTURE_PINCH_UPDATE); - CASE_RETURN_STRING(LIBINPUT_EVENT_GESTURE_PINCH_END); - CASE_RETURN_STRING(LIBINPUT_EVENT_SWITCH_TOGGLE); - case LIBINPUT_EVENT_NONE: - abort(); - } - - return NULL; -} - struct libinput_source { libinput_source_dispatch_t dispatch; void *user_data; @@ -195,48 +125,6 @@ double angle; }; -struct libinput_event_tablet_tool { - struct libinput_event base; - uint32_t button; - enum libinput_button_state state; - uint32_t seat_button_count; - uint64_t time; - struct tablet_axes axes; - unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)]; - struct libinput_tablet_tool *tool; - enum libinput_tablet_tool_proximity_state proximity_state; - enum libinput_tablet_tool_tip_state tip_state; -}; - -struct libinput_event_tablet_pad { - struct libinput_event base; - unsigned int mode; - struct libinput_tablet_pad_mode_group *mode_group; - uint64_t time; - struct { - uint32_t number; - enum libinput_button_state state; - } button; - struct { - enum libinput_tablet_pad_ring_axis_source source; - double position; - int number; - } ring; - struct { - enum libinput_tablet_pad_strip_axis_source source; - double position; - int number; - } strip; -}; - -struct libinput_event_switch { - struct libinput_event base; - uint64_t time; - enum libinput_switch sw; - enum libinput_switch_state state; -}; - -LIBINPUT_ATTRIBUTE_PRINTF(3, 0) static void libinput_default_log_func(struct libinput *libinput, enum libinput_log_priority priority, @@ -278,31 +166,6 @@ va_end(args); } -void -log_msg_ratelimit(struct libinput *libinput, - struct ratelimit *ratelimit, - enum libinput_log_priority priority, - const char *format, ...) -{ - va_list args; - enum ratelimit_state state; - - state = ratelimit_test(ratelimit); - if (state == RATELIMIT_EXCEEDED) - return; - - va_start(args, format); - log_msg_va(libinput, priority, format, args); - va_end(args); - - if (state == RATELIMIT_THRESHOLD) - log_msg(libinput, - priority, - "WARNING: log rate limit exceeded (%d msgs per %dms). Discarding future messages.\n", - ratelimit->burst, - us2ms(ratelimit->interval)); -} - LIBINPUT_EXPORT void libinput_log_set_priority(struct libinput *libinput, enum libinput_log_priority priority) @@ -324,9 +187,6 @@ } static void -libinput_device_group_destroy(struct libinput_device_group *group); - -static void libinput_post_event(struct libinput *libinput, struct libinput_event *event); @@ -384,6 +244,7 @@ LIBINPUT_EVENT_TOUCH_MOTION, LIBINPUT_EVENT_TOUCH_CANCEL, LIBINPUT_EVENT_TOUCH_FRAME); + return (struct libinput_event_touch *) event; } @@ -403,33 +264,6 @@ return (struct libinput_event_gesture *) event; } -LIBINPUT_EXPORT struct libinput_event_tablet_tool * -libinput_event_get_tablet_tool_event(struct libinput_event *event) -{ - require_event_type(libinput_event_get_context(event), - event->type, - NULL, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - - return (struct libinput_event_tablet_tool *) event; -} - -LIBINPUT_EXPORT struct libinput_event_tablet_pad * -libinput_event_get_tablet_pad_event(struct libinput_event *event) -{ - require_event_type(libinput_event_get_context(event), - event->type, - NULL, - LIBINPUT_EVENT_TABLET_PAD_RING, - LIBINPUT_EVENT_TABLET_PAD_STRIP, - LIBINPUT_EVENT_TABLET_PAD_BUTTON); - - return (struct libinput_event_tablet_pad *) event; -} - LIBINPUT_EXPORT struct libinput_event_device_notify * libinput_event_get_device_notify_event(struct libinput_event *event) { @@ -442,17 +276,6 @@ return (struct libinput_event_device_notify *) event; } -LIBINPUT_EXPORT struct libinput_event_switch * -libinput_event_get_switch_event(struct libinput_event *event) -{ - require_event_type(libinput_event_get_context(event), - event->type, - NULL, - LIBINPUT_EVENT_SWITCH_TOGGLE); - - return (struct libinput_event_switch *) event; -} - LIBINPUT_EXPORT uint32_t libinput_event_keyboard_get_time(struct libinput_event_keyboard *event) { @@ -586,7 +409,8 @@ LIBINPUT_EXPORT double libinput_event_pointer_get_absolute_x(struct libinput_event_pointer *event) { - struct evdev_device *device = evdev_device(event->base.device); + struct evdev_device *device = + (struct evdev_device *) event->base.device; require_event_type(libinput_event_get_context(&event->base), event->base.type, @@ -599,7 +423,8 @@ LIBINPUT_EXPORT double libinput_event_pointer_get_absolute_y(struct libinput_event_pointer *event) { - struct evdev_device *device = evdev_device(event->base.device); + struct evdev_device *device = + (struct evdev_device *) event->base.device; require_event_type(libinput_event_get_context(&event->base), event->base.type, @@ -614,7 +439,8 @@ struct libinput_event_pointer *event, uint32_t width) { - struct evdev_device *device = evdev_device(event->base.device); + struct evdev_device *device = + (struct evdev_device *) event->base.device; require_event_type(libinput_event_get_context(&event->base), event->base.type, @@ -629,7 +455,8 @@ struct libinput_event_pointer *event, uint32_t height) { - struct evdev_device *device = evdev_device(event->base.device); + struct evdev_device *device = + (struct evdev_device *) event->base.device; require_event_type(libinput_event_get_context(&event->base), event->base.type, @@ -818,7 +645,8 @@ LIBINPUT_EXPORT double libinput_event_touch_get_x(struct libinput_event_touch *event) { - struct evdev_device *device = evdev_device(event->base.device); + struct evdev_device *device = + (struct evdev_device *) event->base.device; require_event_type(libinput_event_get_context(&event->base), event->base.type, @@ -833,7 +661,8 @@ libinput_event_touch_get_x_transformed(struct libinput_event_touch *event, uint32_t width) { - struct evdev_device *device = evdev_device(event->base.device); + struct evdev_device *device = + (struct evdev_device *) event->base.device; require_event_type(libinput_event_get_context(&event->base), event->base.type, @@ -848,7 +677,8 @@ libinput_event_touch_get_y_transformed(struct libinput_event_touch *event, uint32_t height) { - struct evdev_device *device = evdev_device(event->base.device); + struct evdev_device *device = + (struct evdev_device *) event->base.device; require_event_type(libinput_event_get_context(&event->base), event->base.type, @@ -862,7 +692,8 @@ LIBINPUT_EXPORT double libinput_event_touch_get_y(struct libinput_event_touch *event) { - struct evdev_device *device = evdev_device(event->base.device); + struct evdev_device *device = + (struct evdev_device *) event->base.device; require_event_type(libinput_event_get_context(&event->base), event->base.type, @@ -1025,826 +856,172 @@ return event->angle; } -LIBINPUT_EXPORT int -libinput_event_tablet_tool_x_has_changed( - struct libinput_event_tablet_tool *event) +struct libinput_source * +libinput_add_fd(struct libinput *libinput, + int fd, + libinput_source_dispatch_t dispatch, + void *user_data) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + struct libinput_source *source; + struct epoll_event ep; - return bit_is_set(event->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_X); -} + source = zalloc(sizeof *source); + if (!source) + return NULL; -LIBINPUT_EXPORT int -libinput_event_tablet_tool_y_has_changed( - struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + source->dispatch = dispatch; + source->user_data = user_data; + source->fd = fd; - return bit_is_set(event->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_Y); -} + memset(&ep, 0, sizeof ep); + ep.events = EPOLLIN; + ep.data.ptr = source; -LIBINPUT_EXPORT int -libinput_event_tablet_tool_pressure_has_changed( - struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + if (epoll_ctl(libinput->epoll_fd, EPOLL_CTL_ADD, fd, &ep) < 0) { + free(source); + return NULL; + } - return bit_is_set(event->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_PRESSURE); + return source; } -LIBINPUT_EXPORT int -libinput_event_tablet_tool_distance_has_changed( - struct libinput_event_tablet_tool *event) +void +libinput_remove_source(struct libinput *libinput, + struct libinput_source *source) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return bit_is_set(event->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_DISTANCE); + epoll_ctl(libinput->epoll_fd, EPOLL_CTL_DEL, source->fd, NULL); + source->fd = -1; + list_insert(&libinput->source_destroy_list, &source->link); } -LIBINPUT_EXPORT int -libinput_event_tablet_tool_tilt_x_has_changed( - struct libinput_event_tablet_tool *event) +int +libinput_init(struct libinput *libinput, + const struct libinput_interface *interface, + const struct libinput_interface_backend *interface_backend, + void *user_data) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + libinput->epoll_fd = epoll_create1(EPOLL_CLOEXEC);; + if (libinput->epoll_fd < 0) + return -1; - return bit_is_set(event->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_TILT_X); -} + libinput->events_len = 4; + libinput->events = zalloc(libinput->events_len * sizeof(*libinput->events)); + if (!libinput->events) { + close(libinput->epoll_fd); + return -1; + } -LIBINPUT_EXPORT int -libinput_event_tablet_tool_tilt_y_has_changed( - struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + libinput->log_handler = libinput_default_log_func; + libinput->log_priority = LIBINPUT_LOG_PRIORITY_ERROR; + libinput->interface = interface; + libinput->interface_backend = interface_backend; + libinput->user_data = user_data; + libinput->refcount = 1; + list_init(&libinput->source_destroy_list); + list_init(&libinput->seat_list); + + if (libinput_timer_subsys_init(libinput) != 0) { + free(libinput->events); + close(libinput->epoll_fd); + return -1; + } - return bit_is_set(event->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_TILT_Y); + return 0; } -LIBINPUT_EXPORT int -libinput_event_tablet_tool_rotation_has_changed( - struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); +static void +libinput_device_destroy(struct libinput_device *device); - return bit_is_set(event->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z); -} +static void +libinput_seat_destroy(struct libinput_seat *seat); -LIBINPUT_EXPORT int -libinput_event_tablet_tool_slider_has_changed( - struct libinput_event_tablet_tool *event) +static void +libinput_drop_destroyed_sources(struct libinput *libinput) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + struct libinput_source *source, *next; - return bit_is_set(event->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_SLIDER); + list_for_each_safe(source, next, &libinput->source_destroy_list, link) + free(source); + list_init(&libinput->source_destroy_list); } -LIBINPUT_EXPORT int -libinput_event_tablet_tool_wheel_has_changed( - struct libinput_event_tablet_tool *event) +LIBINPUT_EXPORT struct libinput * +libinput_ref(struct libinput *libinput) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return bit_is_set(event->changed_axes, - LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL); + libinput->refcount++; + return libinput; } -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_x(struct libinput_event_tablet_tool *event) +LIBINPUT_EXPORT struct libinput * +libinput_unref(struct libinput *libinput) { - struct evdev_device *device = evdev_device(event->base.device); + struct libinput_event *event; + struct libinput_device *device, *next_device; + struct libinput_seat *seat, *next_seat; - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + if (libinput == NULL) + return NULL; - return evdev_convert_to_mm(device->abs.absinfo_x, - event->axes.point.x); -} + assert(libinput->refcount > 0); + libinput->refcount--; + if (libinput->refcount > 0) + return libinput; -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_y(struct libinput_event_tablet_tool *event) -{ - struct evdev_device *device = evdev_device(event->base.device); + libinput_suspend(libinput); - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + libinput->interface_backend->destroy(libinput); - return evdev_convert_to_mm(device->abs.absinfo_y, - event->axes.point.y); -} + while ((event = libinput_get_event(libinput))) + libinput_event_destroy(event); -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_dx(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + free(libinput->events); - return event->axes.delta.x; -} + list_for_each_safe(seat, next_seat, &libinput->seat_list, link) { + list_for_each_safe(device, next_device, + &seat->devices_list, + link) + libinput_device_destroy(device); -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_dy(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + libinput_seat_destroy(seat); + } - return event->axes.delta.y; + libinput_timer_subsys_destroy(libinput); + libinput_drop_destroyed_sources(libinput); + close(libinput->epoll_fd); + free(libinput); + + return NULL; } -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_pressure(struct libinput_event_tablet_tool *event) +LIBINPUT_EXPORT void +libinput_event_destroy(struct libinput_event *event) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); + if (event == NULL) + return; + + if (event->device) + libinput_device_unref(event->device); - return event->axes.pressure; + free(event); } -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_distance(struct libinput_event_tablet_tool *event) +int +open_restricted(struct libinput *libinput, + const char *path, int flags) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return event->axes.distance; + return libinput->interface->open_restricted(path, + flags, + libinput->user_data); } -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_tilt_x(struct libinput_event_tablet_tool *event) +void +close_restricted(struct libinput *libinput, int fd) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return event->axes.tilt.x; + return libinput->interface->close_restricted(fd, libinput->user_data); } -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_tilt_y(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return event->axes.tilt.y; -} - -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_rotation(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return event->axes.rotation; -} - -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_slider_position(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return event->axes.slider; -} - -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_wheel_delta(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return event->axes.wheel; -} - -LIBINPUT_EXPORT int -libinput_event_tablet_tool_get_wheel_delta_discrete( - struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return event->axes.wheel_discrete; -} - -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_x_transformed(struct libinput_event_tablet_tool *event, - uint32_t width) -{ - struct evdev_device *device = evdev_device(event->base.device); - - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return evdev_device_transform_x(device, - event->axes.point.x, - width); -} - -LIBINPUT_EXPORT double -libinput_event_tablet_tool_get_y_transformed(struct libinput_event_tablet_tool *event, - uint32_t height) -{ - struct evdev_device *device = evdev_device(event->base.device); - - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return evdev_device_transform_y(device, - event->axes.point.y, - height); -} - -LIBINPUT_EXPORT struct libinput_tablet_tool * -libinput_event_tablet_tool_get_tool(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return event->tool; -} - -LIBINPUT_EXPORT enum libinput_tablet_tool_proximity_state -libinput_event_tablet_tool_get_proximity_state(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return event->proximity_state; -} - -LIBINPUT_EXPORT enum libinput_tablet_tool_tip_state -libinput_event_tablet_tool_get_tip_state(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return event->tip_state; -} - -LIBINPUT_EXPORT uint32_t -libinput_event_tablet_tool_get_time(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return us2ms(event->time); -} - -LIBINPUT_EXPORT uint64_t -libinput_event_tablet_tool_get_time_usec(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - return event->time; -} - -LIBINPUT_EXPORT uint32_t -libinput_event_tablet_tool_get_button(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - - return event->button; -} - -LIBINPUT_EXPORT enum libinput_button_state -libinput_event_tablet_tool_get_button_state(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - - return event->state; -} - -LIBINPUT_EXPORT uint32_t -libinput_event_tablet_tool_get_seat_button_count(struct libinput_event_tablet_tool *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - - return event->seat_button_count; -} - -LIBINPUT_EXPORT enum libinput_tablet_tool_type -libinput_tablet_tool_get_type(struct libinput_tablet_tool *tool) -{ - return tool->type; -} - -LIBINPUT_EXPORT uint64_t -libinput_tablet_tool_get_tool_id(struct libinput_tablet_tool *tool) -{ - return tool->tool_id; -} - -LIBINPUT_EXPORT int -libinput_tablet_tool_is_unique(struct libinput_tablet_tool *tool) -{ - return tool->serial != 0; -} - -LIBINPUT_EXPORT uint64_t -libinput_tablet_tool_get_serial(struct libinput_tablet_tool *tool) -{ - return tool->serial; -} - -LIBINPUT_EXPORT int -libinput_tablet_tool_has_pressure(struct libinput_tablet_tool *tool) -{ - return bit_is_set(tool->axis_caps, - LIBINPUT_TABLET_TOOL_AXIS_PRESSURE); -} - -LIBINPUT_EXPORT int -libinput_tablet_tool_has_distance(struct libinput_tablet_tool *tool) -{ - return bit_is_set(tool->axis_caps, - LIBINPUT_TABLET_TOOL_AXIS_DISTANCE); -} - -LIBINPUT_EXPORT int -libinput_tablet_tool_has_tilt(struct libinput_tablet_tool *tool) -{ - return bit_is_set(tool->axis_caps, - LIBINPUT_TABLET_TOOL_AXIS_TILT_X); -} - -LIBINPUT_EXPORT int -libinput_tablet_tool_has_rotation(struct libinput_tablet_tool *tool) -{ - return bit_is_set(tool->axis_caps, - LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z); -} - -LIBINPUT_EXPORT int -libinput_tablet_tool_has_slider(struct libinput_tablet_tool *tool) -{ - return bit_is_set(tool->axis_caps, - LIBINPUT_TABLET_TOOL_AXIS_SLIDER); -} - -LIBINPUT_EXPORT int -libinput_tablet_tool_has_wheel(struct libinput_tablet_tool *tool) -{ - return bit_is_set(tool->axis_caps, - LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL); -} - -LIBINPUT_EXPORT int -libinput_tablet_tool_has_button(struct libinput_tablet_tool *tool, - uint32_t code) -{ - if (NCHARS(code) > sizeof(tool->buttons)) - return 0; - - return bit_is_set(tool->buttons, code); -} - -LIBINPUT_EXPORT void -libinput_tablet_tool_set_user_data(struct libinput_tablet_tool *tool, - void *user_data) -{ - tool->user_data = user_data; -} - -LIBINPUT_EXPORT void * -libinput_tablet_tool_get_user_data(struct libinput_tablet_tool *tool) -{ - return tool->user_data; -} - -LIBINPUT_EXPORT struct libinput_tablet_tool * -libinput_tablet_tool_ref(struct libinput_tablet_tool *tool) -{ - tool->refcount++; - return tool; -} - -LIBINPUT_EXPORT struct libinput_tablet_tool * -libinput_tablet_tool_unref(struct libinput_tablet_tool *tool) -{ - assert(tool->refcount > 0); - - tool->refcount--; - if (tool->refcount > 0) - return tool; - - list_remove(&tool->link); - free(tool); - return NULL; -} - -LIBINPUT_EXPORT struct libinput_event * -libinput_event_switch_get_base_event(struct libinput_event_switch *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - NULL, - LIBINPUT_EVENT_SWITCH_TOGGLE); - - return &event->base; -} - -LIBINPUT_EXPORT enum libinput_switch -libinput_event_switch_get_switch(struct libinput_event_switch *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_SWITCH_TOGGLE); - - return event->sw; -} - -LIBINPUT_EXPORT enum libinput_switch_state -libinput_event_switch_get_switch_state(struct libinput_event_switch *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_SWITCH_TOGGLE); - - return event->state; -} - -LIBINPUT_EXPORT uint32_t -libinput_event_switch_get_time(struct libinput_event_switch *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_SWITCH_TOGGLE); - - return us2ms(event->time); -} - -LIBINPUT_EXPORT uint64_t -libinput_event_switch_get_time_usec(struct libinput_event_switch *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_SWITCH_TOGGLE); - - return event->time; -} - -struct libinput_source * -libinput_add_fd(struct libinput *libinput, - int fd, - libinput_source_dispatch_t dispatch, - void *user_data) -{ - struct libinput_source *source; - struct epoll_event ep; - - source = zalloc(sizeof *source); - source->dispatch = dispatch; - source->user_data = user_data; - source->fd = fd; - - memset(&ep, 0, sizeof ep); - ep.events = EPOLLIN; - ep.data.ptr = source; - - if (epoll_ctl(libinput->epoll_fd, EPOLL_CTL_ADD, fd, &ep) < 0) { - free(source); - return NULL; - } - - return source; -} - -void -libinput_remove_source(struct libinput *libinput, - struct libinput_source *source) -{ - epoll_ctl(libinput->epoll_fd, EPOLL_CTL_DEL, source->fd, NULL); - source->fd = -1; - list_insert(&libinput->source_destroy_list, &source->link); -} - -int -libinput_init(struct libinput *libinput, - const struct libinput_interface *interface, - const struct libinput_interface_backend *interface_backend, - void *user_data) -{ - assert(interface->open_restricted != NULL); - assert(interface->close_restricted != NULL); - - libinput->epoll_fd = epoll_create1(EPOLL_CLOEXEC); - if (libinput->epoll_fd < 0) - return -1; - - libinput->events_len = 4; - libinput->events = zalloc(libinput->events_len * sizeof(*libinput->events)); - libinput->log_handler = libinput_default_log_func; - libinput->log_priority = LIBINPUT_LOG_PRIORITY_ERROR; - libinput->interface = interface; - libinput->interface_backend = interface_backend; - libinput->user_data = user_data; - libinput->refcount = 1; - list_init(&libinput->source_destroy_list); - list_init(&libinput->seat_list); - list_init(&libinput->device_group_list); - list_init(&libinput->tool_list); - - if (libinput_timer_subsys_init(libinput) != 0) { - free(libinput->events); - close(libinput->epoll_fd); - return -1; - } - - return 0; -} - -static void -libinput_device_destroy(struct libinput_device *device); - -static void -libinput_seat_destroy(struct libinput_seat *seat); - -static void -libinput_drop_destroyed_sources(struct libinput *libinput) -{ - struct libinput_source *source, *next; - - list_for_each_safe(source, next, &libinput->source_destroy_list, link) - free(source); - list_init(&libinput->source_destroy_list); -} - -LIBINPUT_EXPORT struct libinput * -libinput_ref(struct libinput *libinput) -{ - libinput->refcount++; - return libinput; -} - -LIBINPUT_EXPORT struct libinput * -libinput_unref(struct libinput *libinput) -{ - struct libinput_event *event; - struct libinput_device *device, *next_device; - struct libinput_seat *seat, *next_seat; - struct libinput_tablet_tool *tool, *next_tool; - struct libinput_device_group *group, *next_group; - - if (libinput == NULL) - return NULL; - - assert(libinput->refcount > 0); - libinput->refcount--; - if (libinput->refcount > 0) - return libinput; - - libinput_suspend(libinput); - - libinput->interface_backend->destroy(libinput); - - while ((event = libinput_get_event(libinput))) - libinput_event_destroy(event); - - free(libinput->events); - - list_for_each_safe(seat, next_seat, &libinput->seat_list, link) { - list_for_each_safe(device, next_device, - &seat->devices_list, - link) - libinput_device_destroy(device); - - libinput_seat_destroy(seat); - } - - list_for_each_safe(group, - next_group, - &libinput->device_group_list, - link) { - libinput_device_group_destroy(group); - } - - list_for_each_safe(tool, next_tool, &libinput->tool_list, link) { - libinput_tablet_tool_unref(tool); - } - - libinput_timer_subsys_destroy(libinput); - libinput_drop_destroyed_sources(libinput); - close(libinput->epoll_fd); - free(libinput); - - return NULL; -} - -static void -libinput_event_tablet_tool_destroy(struct libinput_event_tablet_tool *event) -{ - libinput_tablet_tool_unref(event->tool); -} - -static void -libinput_event_tablet_pad_destroy(struct libinput_event_tablet_pad *event) -{ - libinput_tablet_pad_mode_group_unref(event->mode_group); -} - -LIBINPUT_EXPORT void -libinput_event_destroy(struct libinput_event *event) -{ - if (event == NULL) - return; - - switch(event->type) { - case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: - case LIBINPUT_EVENT_TABLET_TOOL_AXIS: - case LIBINPUT_EVENT_TABLET_TOOL_TIP: - case LIBINPUT_EVENT_TABLET_TOOL_BUTTON: - libinput_event_tablet_tool_destroy( - libinput_event_get_tablet_tool_event(event)); - break; - case LIBINPUT_EVENT_TABLET_PAD_RING: - case LIBINPUT_EVENT_TABLET_PAD_STRIP: - case LIBINPUT_EVENT_TABLET_PAD_BUTTON: - libinput_event_tablet_pad_destroy( - libinput_event_get_tablet_pad_event(event)); - break; - default: - break; - } - - if (event->device) - libinput_device_unref(event->device); - - free(event); -} - -int -open_restricted(struct libinput *libinput, - const char *path, int flags) -{ - return libinput->interface->open_restricted(path, - flags, - libinput->user_data); -} - -void -close_restricted(struct libinput *libinput, int fd) -{ - return libinput->interface->close_restricted(fd, libinput->user_data); -} - -bool -ignore_litest_test_suite_device(struct udev_device *device) +bool +ignore_litest_test_suite_device(struct udev_device *device) { if (!getenv("LIBINPUT_RUNNING_TEST_SUITE") && udev_device_get_property_value(device, "LIBINPUT_TEST_DEVICE")) @@ -1862,8 +1039,8 @@ { seat->refcount = 1; seat->libinput = libinput; - seat->physical_name = safe_strdup(physical_name); - seat->logical_name = safe_strdup(logical_name); + seat->physical_name = strdup(physical_name); + seat->logical_name = strdup(logical_name); seat->destroy = destroy; list_init(&seat->devices_list); list_insert(&libinput->seat_list, &seat->link); @@ -1948,7 +1125,7 @@ libinput_device_destroy(struct libinput_device *device) { assert(list_empty(&device->event_listeners)); - evdev_device_destroy(evdev_device(device)); + evdev_device_destroy((struct evdev_device *) device); } LIBINPUT_EXPORT struct libinput_device * @@ -1995,12 +1172,6 @@ } void -libinput_device_init_event_listener(struct libinput_event_listener *listener) -{ - list_init(&listener->link); -} - -void libinput_device_add_event_listener(struct libinput_device *device, struct libinput_event_listener *listener, void (*notify_func)( @@ -2088,17 +1259,6 @@ struct libinput_event *event) { struct libinput_event_listener *listener, *tmp; -#if 0 - struct libinput *libinput = device->seat->libinput; - - if (libinput->last_event_time > time) { - log_bug_libinput(device->seat->libinput, - "out-of-order timestamps for %s time %" PRIu64 "\n", - event_type_to_str(type), - time); - } - libinput->last_event_time = time; -#endif init_event_base(event, device, type); @@ -2114,6 +1274,8 @@ struct libinput_event_device_notify *added_device_event; added_device_event = zalloc(sizeof *added_device_event); + if (!added_device_event) + return; post_base_event(device, LIBINPUT_EVENT_DEVICE_ADDED, @@ -2126,6 +1288,8 @@ struct libinput_event_device_notify *removed_device_event; removed_device_event = zalloc(sizeof *removed_device_event); + if (!removed_device_event) + return; post_base_event(device, LIBINPUT_EVENT_DEVICE_REMOVED, @@ -2154,15 +1318,6 @@ case LIBINPUT_DEVICE_CAP_GESTURE: capability = "CAP_GESTURE"; break; - case LIBINPUT_DEVICE_CAP_TABLET_TOOL: - capability = "CAP_TABLET_TOOL"; - break; - case LIBINPUT_DEVICE_CAP_TABLET_PAD: - capability = "CAP_TABLET_PAD"; - break; - case LIBINPUT_DEVICE_CAP_SWITCH: - capability = "CAP_SWITCH"; - break; } log_bug_libinput(device->seat->libinput, @@ -2186,6 +1341,8 @@ return; key_event = zalloc(sizeof *key_event); + if (!key_event) + return; seat_key_count = update_seat_key_count(device->seat, key, state); @@ -2213,6 +1370,8 @@ return; motion_event = zalloc(sizeof *motion_event); + if (!motion_event) + return; *motion_event = (struct libinput_event_pointer) { .time = time, @@ -2236,6 +1395,8 @@ return; motion_absolute_event = zalloc(sizeof *motion_absolute_event); + if (!motion_absolute_event) + return; *motion_absolute_event = (struct libinput_event_pointer) { .time = time, @@ -2260,6 +1421,8 @@ return; button_event = zalloc(sizeof *button_event); + if (!button_event) + return; seat_button_count = update_seat_button_count(device->seat, button, @@ -2291,6 +1454,8 @@ return; axis_event = zalloc(sizeof *axis_event); + if (!axis_event) + return; *axis_event = (struct libinput_event_pointer) { .time = time, @@ -2318,6 +1483,8 @@ return; touch_event = zalloc(sizeof *touch_event); + if (!touch_event) + return; *touch_event = (struct libinput_event_touch) { .time = time, @@ -2344,6 +1511,8 @@ return; touch_event = zalloc(sizeof *touch_event); + if (!touch_event) + return; *touch_event = (struct libinput_event_touch) { .time = time, @@ -2369,6 +1538,8 @@ return; touch_event = zalloc(sizeof *touch_event); + if (!touch_event) + return; *touch_event = (struct libinput_event_touch) { .time = time, @@ -2391,6 +1562,8 @@ return; touch_event = zalloc(sizeof *touch_event); + if (!touch_event) + return; *touch_event = (struct libinput_event_touch) { .time = time, @@ -2401,217 +1574,6 @@ &touch_event->base); } -void -tablet_notify_axis(struct libinput_device *device, - uint64_t time, - struct libinput_tablet_tool *tool, - enum libinput_tablet_tool_tip_state tip_state, - unsigned char *changed_axes, - const struct tablet_axes *axes) -{ - struct libinput_event_tablet_tool *axis_event; - - axis_event = zalloc(sizeof *axis_event); - - *axis_event = (struct libinput_event_tablet_tool) { - .time = time, - .tool = libinput_tablet_tool_ref(tool), - .proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN, - .tip_state = tip_state, - .axes = *axes, - }; - - memcpy(axis_event->changed_axes, - changed_axes, - sizeof(axis_event->changed_axes)); - - post_device_event(device, - time, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - &axis_event->base); -} - -void -tablet_notify_proximity(struct libinput_device *device, - uint64_t time, - struct libinput_tablet_tool *tool, - enum libinput_tablet_tool_proximity_state proximity_state, - unsigned char *changed_axes, - const struct tablet_axes *axes) -{ - struct libinput_event_tablet_tool *proximity_event; - - proximity_event = zalloc(sizeof *proximity_event); - - *proximity_event = (struct libinput_event_tablet_tool) { - .time = time, - .tool = libinput_tablet_tool_ref(tool), - .tip_state = LIBINPUT_TABLET_TOOL_TIP_UP, - .proximity_state = proximity_state, - .axes = *axes, - }; - memcpy(proximity_event->changed_axes, - changed_axes, - sizeof(proximity_event->changed_axes)); - - post_device_event(device, - time, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, - &proximity_event->base); -} - -void -tablet_notify_tip(struct libinput_device *device, - uint64_t time, - struct libinput_tablet_tool *tool, - enum libinput_tablet_tool_tip_state tip_state, - unsigned char *changed_axes, - const struct tablet_axes *axes) -{ - struct libinput_event_tablet_tool *tip_event; - - tip_event = zalloc(sizeof *tip_event); - - *tip_event = (struct libinput_event_tablet_tool) { - .time = time, - .tool = libinput_tablet_tool_ref(tool), - .tip_state = tip_state, - .proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN, - .axes = *axes, - }; - memcpy(tip_event->changed_axes, - changed_axes, - sizeof(tip_event->changed_axes)); - - post_device_event(device, - time, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - &tip_event->base); -} - -void -tablet_notify_button(struct libinput_device *device, - uint64_t time, - struct libinput_tablet_tool *tool, - enum libinput_tablet_tool_tip_state tip_state, - const struct tablet_axes *axes, - int32_t button, - enum libinput_button_state state) -{ - struct libinput_event_tablet_tool *button_event; - int32_t seat_button_count; - - button_event = zalloc(sizeof *button_event); - - seat_button_count = update_seat_button_count(device->seat, - button, - state); - - *button_event = (struct libinput_event_tablet_tool) { - .time = time, - .tool = libinput_tablet_tool_ref(tool), - .button = button, - .state = state, - .seat_button_count = seat_button_count, - .proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN, - .tip_state = tip_state, - .axes = *axes, - }; - - post_device_event(device, - time, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - &button_event->base); -} - -void -tablet_pad_notify_button(struct libinput_device *device, - uint64_t time, - int32_t button, - enum libinput_button_state state, - struct libinput_tablet_pad_mode_group *group) -{ - struct libinput_event_tablet_pad *button_event; - unsigned int mode; - - button_event = zalloc(sizeof *button_event); - - mode = libinput_tablet_pad_mode_group_get_mode(group); - - *button_event = (struct libinput_event_tablet_pad) { - .time = time, - .button.number = button, - .button.state = state, - .mode_group = libinput_tablet_pad_mode_group_ref(group), - .mode = mode, - }; - - post_device_event(device, - time, - LIBINPUT_EVENT_TABLET_PAD_BUTTON, - &button_event->base); -} - -void -tablet_pad_notify_ring(struct libinput_device *device, - uint64_t time, - unsigned int number, - double value, - enum libinput_tablet_pad_ring_axis_source source, - struct libinput_tablet_pad_mode_group *group) -{ - struct libinput_event_tablet_pad *ring_event; - unsigned int mode; - - ring_event = zalloc(sizeof *ring_event); - - mode = libinput_tablet_pad_mode_group_get_mode(group); - - *ring_event = (struct libinput_event_tablet_pad) { - .time = time, - .ring.number = number, - .ring.position = value, - .ring.source = source, - .mode_group = libinput_tablet_pad_mode_group_ref(group), - .mode = mode, - }; - - post_device_event(device, - time, - LIBINPUT_EVENT_TABLET_PAD_RING, - &ring_event->base); -} - -void -tablet_pad_notify_strip(struct libinput_device *device, - uint64_t time, - unsigned int number, - double value, - enum libinput_tablet_pad_strip_axis_source source, - struct libinput_tablet_pad_mode_group *group) -{ - struct libinput_event_tablet_pad *strip_event; - unsigned int mode; - - strip_event = zalloc(sizeof *strip_event); - - mode = libinput_tablet_pad_mode_group_get_mode(group); - - *strip_event = (struct libinput_event_tablet_pad) { - .time = time, - .strip.number = number, - .strip.position = value, - .strip.source = source, - .mode_group = libinput_tablet_pad_mode_group_ref(group), - .mode = mode, - }; - - post_device_event(device, - time, - LIBINPUT_EVENT_TABLET_PAD_STRIP, - &strip_event->base); -} - static void gesture_notify(struct libinput_device *device, uint64_t time, @@ -2629,6 +1591,8 @@ return; gesture_event = zalloc(sizeof *gesture_event); + if (!gesture_event) + return; *gesture_event = (struct libinput_event_gesture) { .time = time, @@ -2672,51 +1636,25 @@ gesture_notify_pinch(struct libinput_device *device, uint64_t time, enum libinput_event_type type, - int finger_count, const struct normalized_coords *delta, const struct normalized_coords *unaccel, double scale, double angle) { - gesture_notify(device, time, type, finger_count, 0, - delta, unaccel, scale, angle); + gesture_notify(device, time, type, 2, 0, delta, unaccel, + scale, angle); } void gesture_notify_pinch_end(struct libinput_device *device, uint64_t time, - int finger_count, double scale, int cancelled) { const struct normalized_coords zero = { 0.0, 0.0 }; gesture_notify(device, time, LIBINPUT_EVENT_GESTURE_PINCH_END, - finger_count, cancelled, &zero, &zero, scale, 0.0); -} - -void -switch_notify_toggle(struct libinput_device *device, - uint64_t time, - enum libinput_switch sw, - enum libinput_switch_state state) -{ - struct libinput_event_switch *switch_event; - - if (!device_has_cap(device, LIBINPUT_DEVICE_CAP_SWITCH)) - return; - - switch_event = zalloc(sizeof *switch_event); - - *switch_event = (struct libinput_event_switch) { - .time = time, - .sw = sw, - .state = state, - }; - - post_device_event(device, time, - LIBINPUT_EVENT_SWITCH_TOGGLE, - &switch_event->base); + 2, cancelled, &zero, &zero, scale, 0.0); } static void @@ -2729,18 +1667,13 @@ size_t move_len; size_t new_out; -#if 0 - log_debug(libinput, "Queuing %s\n", event_type_to_str(event->type)); -#endif - events_count++; if (events_count > events_len) { events_len *= 2; events = realloc(events, events_len * sizeof *events); if (!events) { - log_error(libinput, - "Failed to reallocate event ring buffer. " - "Events may be discarded\n"); + fprintf(stderr, "Failed to reallocate event ring " + "buffer"); return; } @@ -2833,485 +1766,168 @@ return device->user_data; } -LIBINPUT_EXPORT struct libinput * -libinput_device_get_context(struct libinput_device *device) -{ - return libinput_seat_get_context(device->seat); -} - -LIBINPUT_EXPORT struct libinput_device_group * -libinput_device_get_device_group(struct libinput_device *device) -{ - return device->group; -} - -LIBINPUT_EXPORT const char * -libinput_device_get_sysname(struct libinput_device *device) -{ - return evdev_device_get_sysname((struct evdev_device *) device); -} - -LIBINPUT_EXPORT const char * -libinput_device_get_name(struct libinput_device *device) -{ - return evdev_device_get_name((struct evdev_device *) device); -} - -LIBINPUT_EXPORT unsigned int -libinput_device_get_id_product(struct libinput_device *device) -{ - return evdev_device_get_id_product((struct evdev_device *) device); -} - -LIBINPUT_EXPORT unsigned int -libinput_device_get_id_vendor(struct libinput_device *device) -{ - return evdev_device_get_id_vendor((struct evdev_device *) device); -} - -LIBINPUT_EXPORT const char * -libinput_device_get_output_name(struct libinput_device *device) -{ - return evdev_device_get_output((struct evdev_device *) device); -} - -LIBINPUT_EXPORT struct libinput_seat * -libinput_device_get_seat(struct libinput_device *device) -{ - return device->seat; -} - -LIBINPUT_EXPORT int -libinput_device_set_seat_logical_name(struct libinput_device *device, - const char *name) -{ - struct libinput *libinput = device->seat->libinput; - - if (name == NULL) - return -1; - - return libinput->interface_backend->device_change_seat(device, - name); -} - -LIBINPUT_EXPORT struct udev_device * -libinput_device_get_udev_device(struct libinput_device *device) -{ - return evdev_device_get_udev_device((struct evdev_device *)device); -} - -LIBINPUT_EXPORT void -libinput_device_led_update(struct libinput_device *device, - enum libinput_led leds) -{ - evdev_device_led_update((struct evdev_device *) device, leds); -} - -LIBINPUT_EXPORT int -libinput_device_has_capability(struct libinput_device *device, - enum libinput_device_capability capability) -{ - return evdev_device_has_capability((struct evdev_device *) device, - capability); -} - -LIBINPUT_EXPORT int -libinput_device_get_size(struct libinput_device *device, - double *width, - double *height) -{ - return evdev_device_get_size((struct evdev_device *)device, - width, - height); -} - -LIBINPUT_EXPORT int -libinput_device_pointer_has_button(struct libinput_device *device, uint32_t code) -{ - return evdev_device_has_button((struct evdev_device *)device, code); -} - -LIBINPUT_EXPORT int -libinput_device_keyboard_has_key(struct libinput_device *device, uint32_t code) -{ - return evdev_device_has_key((struct evdev_device *)device, code); -} - -LIBINPUT_EXPORT int -libinput_device_switch_has_switch(struct libinput_device *device, - enum libinput_switch sw) -{ - return evdev_device_has_switch((struct evdev_device *)device, sw); -} - -LIBINPUT_EXPORT int -libinput_device_tablet_pad_get_num_buttons(struct libinput_device *device) -{ - return evdev_device_tablet_pad_get_num_buttons((struct evdev_device *)device); -} - -LIBINPUT_EXPORT int -libinput_device_tablet_pad_get_num_rings(struct libinput_device *device) -{ - return evdev_device_tablet_pad_get_num_rings((struct evdev_device *)device); -} - -LIBINPUT_EXPORT int -libinput_device_tablet_pad_get_num_strips(struct libinput_device *device) -{ - return evdev_device_tablet_pad_get_num_strips((struct evdev_device *)device); -} - -LIBINPUT_EXPORT int -libinput_device_tablet_pad_get_num_mode_groups(struct libinput_device *device) -{ - return evdev_device_tablet_pad_get_num_mode_groups((struct evdev_device *)device); -} - -LIBINPUT_EXPORT struct libinput_tablet_pad_mode_group* -libinput_device_tablet_pad_get_mode_group(struct libinput_device *device, - unsigned int index) -{ - return evdev_device_tablet_pad_get_mode_group((struct evdev_device *)device, - index); -} - -LIBINPUT_EXPORT unsigned int -libinput_tablet_pad_mode_group_get_num_modes( - struct libinput_tablet_pad_mode_group *group) -{ - return group->num_modes; -} - -LIBINPUT_EXPORT unsigned int -libinput_tablet_pad_mode_group_get_mode(struct libinput_tablet_pad_mode_group *group) -{ - return group->current_mode; -} - -LIBINPUT_EXPORT unsigned int -libinput_tablet_pad_mode_group_get_index(struct libinput_tablet_pad_mode_group *group) -{ - return group->index; -} - -LIBINPUT_EXPORT int -libinput_tablet_pad_mode_group_has_button(struct libinput_tablet_pad_mode_group *group, - unsigned int button) -{ - if ((int)button >= - libinput_device_tablet_pad_get_num_buttons(group->device)) - return 0; - - return !!(group->button_mask & (1 << button)); -} - -LIBINPUT_EXPORT int -libinput_tablet_pad_mode_group_has_ring(struct libinput_tablet_pad_mode_group *group, - unsigned int ring) -{ - if ((int)ring >= - libinput_device_tablet_pad_get_num_rings(group->device)) - return 0; - - return !!(group->ring_mask & (1 << ring)); -} - -LIBINPUT_EXPORT int -libinput_tablet_pad_mode_group_has_strip(struct libinput_tablet_pad_mode_group *group, - unsigned int strip) -{ - if ((int)strip >= - libinput_device_tablet_pad_get_num_strips(group->device)) - return 0; - - return !!(group->strip_mask & (1 << strip)); -} - -LIBINPUT_EXPORT int -libinput_tablet_pad_mode_group_button_is_toggle(struct libinput_tablet_pad_mode_group *group, - unsigned int button) -{ - if ((int)button >= - libinput_device_tablet_pad_get_num_buttons(group->device)) - return 0; - - return !!(group->toggle_button_mask & (1 << button)); -} - -LIBINPUT_EXPORT struct libinput_tablet_pad_mode_group * -libinput_tablet_pad_mode_group_ref( - struct libinput_tablet_pad_mode_group *group) -{ - group->refcount++; - return group; -} - -LIBINPUT_EXPORT struct libinput_tablet_pad_mode_group * -libinput_tablet_pad_mode_group_unref( - struct libinput_tablet_pad_mode_group *group) -{ - assert(group->refcount > 0); - - group->refcount--; - if (group->refcount > 0) - return group; - - list_remove(&group->link); - group->destroy(group); - return NULL; -} - -LIBINPUT_EXPORT void -libinput_tablet_pad_mode_group_set_user_data( - struct libinput_tablet_pad_mode_group *group, - void *user_data) -{ - group->user_data = user_data; -} - -LIBINPUT_EXPORT void * -libinput_tablet_pad_mode_group_get_user_data( - struct libinput_tablet_pad_mode_group *group) -{ - return group->user_data; -} - -LIBINPUT_EXPORT struct libinput_event * -libinput_event_device_notify_get_base_event(struct libinput_event_device_notify *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - NULL, - LIBINPUT_EVENT_DEVICE_ADDED, - LIBINPUT_EVENT_DEVICE_REMOVED); - - return &event->base; -} - -LIBINPUT_EXPORT struct libinput_event * -libinput_event_keyboard_get_base_event(struct libinput_event_keyboard *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - NULL, - LIBINPUT_EVENT_KEYBOARD_KEY); - - return &event->base; -} - -LIBINPUT_EXPORT struct libinput_event * -libinput_event_pointer_get_base_event(struct libinput_event_pointer *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - NULL, - LIBINPUT_EVENT_POINTER_MOTION, - LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, - LIBINPUT_EVENT_POINTER_BUTTON, - LIBINPUT_EVENT_POINTER_AXIS); - - return &event->base; -} - -LIBINPUT_EXPORT struct libinput_event * -libinput_event_touch_get_base_event(struct libinput_event_touch *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - NULL, - LIBINPUT_EVENT_TOUCH_DOWN, - LIBINPUT_EVENT_TOUCH_UP, - LIBINPUT_EVENT_TOUCH_MOTION, - LIBINPUT_EVENT_TOUCH_CANCEL, - LIBINPUT_EVENT_TOUCH_FRAME); - - return &event->base; -} - -LIBINPUT_EXPORT struct libinput_event * -libinput_event_gesture_get_base_event(struct libinput_event_gesture *event) -{ - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - NULL, - LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN, - LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, - LIBINPUT_EVENT_GESTURE_SWIPE_END, - LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, - LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, - LIBINPUT_EVENT_GESTURE_PINCH_END); - - return &event->base; -} - -LIBINPUT_EXPORT struct libinput_event * -libinput_event_tablet_tool_get_base_event(struct libinput_event_tablet_tool *event) +LIBINPUT_EXPORT struct libinput * +libinput_device_get_context(struct libinput_device *device) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - NULL, - LIBINPUT_EVENT_TABLET_TOOL_AXIS, - LIBINPUT_EVENT_TABLET_TOOL_TIP, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); + return libinput_seat_get_context(device->seat); +} - return &event->base; +LIBINPUT_EXPORT struct libinput_device_group * +libinput_device_get_device_group(struct libinput_device *device) +{ + return device->group; } -LIBINPUT_EXPORT double -libinput_event_tablet_pad_get_ring_position(struct libinput_event_tablet_pad *event) +LIBINPUT_EXPORT const char * +libinput_device_get_sysname(struct libinput_device *device) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0.0, - LIBINPUT_EVENT_TABLET_PAD_RING); + return evdev_device_get_sysname((struct evdev_device *) device); +} - return event->ring.position; +LIBINPUT_EXPORT const char * +libinput_device_get_name(struct libinput_device *device) +{ + return evdev_device_get_name((struct evdev_device *) device); } LIBINPUT_EXPORT unsigned int -libinput_event_tablet_pad_get_ring_number(struct libinput_event_tablet_pad *event) +libinput_device_get_id_product(struct libinput_device *device) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_PAD_RING); - - return event->ring.number; + return evdev_device_get_id_product((struct evdev_device *) device); } -LIBINPUT_EXPORT enum libinput_tablet_pad_ring_axis_source -libinput_event_tablet_pad_get_ring_source(struct libinput_event_tablet_pad *event) +LIBINPUT_EXPORT unsigned int +libinput_device_get_id_vendor(struct libinput_device *device) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - LIBINPUT_TABLET_PAD_RING_SOURCE_UNKNOWN, - LIBINPUT_EVENT_TABLET_PAD_RING); - - return event->ring.source; + return evdev_device_get_id_vendor((struct evdev_device *) device); } -LIBINPUT_EXPORT double -libinput_event_tablet_pad_get_strip_position(struct libinput_event_tablet_pad *event) +LIBINPUT_EXPORT const char * +libinput_device_get_output_name(struct libinput_device *device) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0.0, - LIBINPUT_EVENT_TABLET_PAD_STRIP); - - return event->strip.position; + return evdev_device_get_output((struct evdev_device *) device); } -LIBINPUT_EXPORT unsigned int -libinput_event_tablet_pad_get_strip_number(struct libinput_event_tablet_pad *event) +LIBINPUT_EXPORT struct libinput_seat * +libinput_device_get_seat(struct libinput_device *device) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_PAD_STRIP); - - return event->strip.number; + return device->seat; } -LIBINPUT_EXPORT enum libinput_tablet_pad_strip_axis_source -libinput_event_tablet_pad_get_strip_source(struct libinput_event_tablet_pad *event) +LIBINPUT_EXPORT int +libinput_device_set_seat_logical_name(struct libinput_device *device, + const char *name) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - LIBINPUT_TABLET_PAD_STRIP_SOURCE_UNKNOWN, - LIBINPUT_EVENT_TABLET_PAD_STRIP); + struct libinput *libinput = device->seat->libinput; + + if (name == NULL) + return -1; - return event->strip.source; + return libinput->interface_backend->device_change_seat(device, + name); } -LIBINPUT_EXPORT uint32_t -libinput_event_tablet_pad_get_button_number(struct libinput_event_tablet_pad *event) +LIBINPUT_EXPORT struct udev_device * +libinput_device_get_udev_device(struct libinput_device *device) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_PAD_BUTTON); + return evdev_device_get_udev_device((struct evdev_device *)device); +} - return event->button.number; +LIBINPUT_EXPORT void +libinput_device_led_update(struct libinput_device *device, + enum libinput_led leds) +{ + evdev_device_led_update((struct evdev_device *) device, leds); } -LIBINPUT_EXPORT enum libinput_button_state -libinput_event_tablet_pad_get_button_state(struct libinput_event_tablet_pad *event) +LIBINPUT_EXPORT int +libinput_device_has_capability(struct libinput_device *device, + enum libinput_device_capability capability) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - LIBINPUT_BUTTON_STATE_RELEASED, - LIBINPUT_EVENT_TABLET_PAD_BUTTON); + return evdev_device_has_capability((struct evdev_device *) device, + capability); +} - return event->button.state; +LIBINPUT_EXPORT int +libinput_device_get_size(struct libinput_device *device, + double *width, + double *height) +{ + return evdev_device_get_size((struct evdev_device *)device, + width, + height); } -LIBINPUT_EXPORT unsigned int -libinput_event_tablet_pad_get_mode(struct libinput_event_tablet_pad *event) +LIBINPUT_EXPORT int +libinput_device_pointer_has_button(struct libinput_device *device, uint32_t code) { - require_event_type(libinput_event_get_context(&event->base), - event->base.type, - 0, - LIBINPUT_EVENT_TABLET_PAD_RING, - LIBINPUT_EVENT_TABLET_PAD_STRIP, - LIBINPUT_EVENT_TABLET_PAD_BUTTON); + return evdev_device_has_button((struct evdev_device *)device, code); +} - return event->mode; +LIBINPUT_EXPORT int +libinput_device_keyboard_has_key(struct libinput_device *device, uint32_t code) +{ + return evdev_device_has_key((struct evdev_device *)device, code); } -LIBINPUT_EXPORT struct libinput_tablet_pad_mode_group * -libinput_event_tablet_pad_get_mode_group(struct libinput_event_tablet_pad *event) +LIBINPUT_EXPORT struct libinput_event * +libinput_event_device_notify_get_base_event(struct libinput_event_device_notify *event) { require_event_type(libinput_event_get_context(&event->base), event->base.type, NULL, - LIBINPUT_EVENT_TABLET_PAD_RING, - LIBINPUT_EVENT_TABLET_PAD_STRIP, - LIBINPUT_EVENT_TABLET_PAD_BUTTON); + LIBINPUT_EVENT_DEVICE_ADDED, + LIBINPUT_EVENT_DEVICE_REMOVED); - return event->mode_group; + return &event->base; } -LIBINPUT_EXPORT uint32_t -libinput_event_tablet_pad_get_time(struct libinput_event_tablet_pad *event) +LIBINPUT_EXPORT struct libinput_event * +libinput_event_keyboard_get_base_event(struct libinput_event_keyboard *event) { require_event_type(libinput_event_get_context(&event->base), event->base.type, - 0, - LIBINPUT_EVENT_TABLET_PAD_RING, - LIBINPUT_EVENT_TABLET_PAD_STRIP, - LIBINPUT_EVENT_TABLET_PAD_BUTTON); + NULL, + LIBINPUT_EVENT_KEYBOARD_KEY); - return us2ms(event->time); + return &event->base; } -LIBINPUT_EXPORT uint64_t -libinput_event_tablet_pad_get_time_usec(struct libinput_event_tablet_pad *event) +LIBINPUT_EXPORT struct libinput_event * +libinput_event_pointer_get_base_event(struct libinput_event_pointer *event) { require_event_type(libinput_event_get_context(&event->base), event->base.type, - 0, - LIBINPUT_EVENT_TABLET_PAD_RING, - LIBINPUT_EVENT_TABLET_PAD_STRIP, - LIBINPUT_EVENT_TABLET_PAD_BUTTON); + NULL, + LIBINPUT_EVENT_POINTER_MOTION, + LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, + LIBINPUT_EVENT_POINTER_BUTTON, + LIBINPUT_EVENT_POINTER_AXIS); - return event->time; + return &event->base; } LIBINPUT_EXPORT struct libinput_event * -libinput_event_tablet_pad_get_base_event(struct libinput_event_tablet_pad *event) +libinput_event_touch_get_base_event(struct libinput_event_touch *event) { require_event_type(libinput_event_get_context(&event->base), event->base.type, NULL, - LIBINPUT_EVENT_TABLET_PAD_RING, - LIBINPUT_EVENT_TABLET_PAD_STRIP, - LIBINPUT_EVENT_TABLET_PAD_BUTTON); + LIBINPUT_EVENT_TOUCH_DOWN, + LIBINPUT_EVENT_TOUCH_UP, + LIBINPUT_EVENT_TOUCH_MOTION, + LIBINPUT_EVENT_TOUCH_CANCEL, + LIBINPUT_EVENT_TOUCH_FRAME); return &event->base; } +LIBINPUT_EXPORT struct libinput_event * +libinput_event_gesture_get_base_event(struct libinput_event_gesture *event) +{ + return &event->base; +} + LIBINPUT_EXPORT struct libinput_device_group * libinput_device_group_ref(struct libinput_device_group *group) { @@ -3320,35 +1936,24 @@ } struct libinput_device_group * -libinput_device_group_create(struct libinput *libinput, - const char *identifier) +libinput_device_group_create(const char *identifier) { struct libinput_device_group *group; group = zalloc(sizeof *group); - group->refcount = 1; - group->identifier = safe_strdup(identifier); - - list_init(&group->link); - list_insert(&libinput->device_group_list, &group->link); - - return group; -} - -struct libinput_device_group * -libinput_device_group_find_group(struct libinput *libinput, - const char *identifier) -{ - struct libinput_device_group *g = NULL; + if (!group) + return NULL; - list_for_each(g, &libinput->device_group_list, link) { - if (identifier && g->identifier && - streq(g->identifier, identifier)) { - return g; + group->refcount = 1; + if (identifier) { + group->identifier = strdup(identifier); + if (!group->identifier) { + free(group); + group = NULL; } } - return NULL; + return group; } void @@ -3362,7 +1967,6 @@ static void libinput_device_group_destroy(struct libinput_device_group *group) { - list_remove(&group->link); free(group->identifier); free(group); } @@ -3454,75 +2058,6 @@ } LIBINPUT_EXPORT enum libinput_config_status -libinput_device_config_tap_set_button_map(struct libinput_device *device, - enum libinput_config_tap_button_map map) -{ - switch (map) { - case LIBINPUT_CONFIG_TAP_MAP_LRM: - case LIBINPUT_CONFIG_TAP_MAP_LMR: - break; - default: - return LIBINPUT_CONFIG_STATUS_INVALID; - } - - if (libinput_device_config_tap_get_finger_count(device) == 0) - return LIBINPUT_CONFIG_STATUS_UNSUPPORTED; - - return device->config.tap->set_map(device, map); -} - -LIBINPUT_EXPORT enum libinput_config_tap_button_map -libinput_device_config_tap_get_button_map(struct libinput_device *device) -{ - if (libinput_device_config_tap_get_finger_count(device) == 0) - return LIBINPUT_CONFIG_TAP_MAP_LRM; - - return device->config.tap->get_map(device); -} - -LIBINPUT_EXPORT enum libinput_config_tap_button_map -libinput_device_config_tap_get_default_button_map(struct libinput_device *device) -{ - if (libinput_device_config_tap_get_finger_count(device) == 0) - return LIBINPUT_CONFIG_TAP_MAP_LRM; - - return device->config.tap->get_default_map(device); -} - -LIBINPUT_EXPORT enum libinput_config_status -libinput_device_config_tap_set_drag_enabled(struct libinput_device *device, - enum libinput_config_drag_state enable) -{ - if (enable != LIBINPUT_CONFIG_DRAG_ENABLED && - enable != LIBINPUT_CONFIG_DRAG_DISABLED) - return LIBINPUT_CONFIG_STATUS_INVALID; - - if (libinput_device_config_tap_get_finger_count(device) == 0) - return enable ? LIBINPUT_CONFIG_STATUS_UNSUPPORTED : - LIBINPUT_CONFIG_STATUS_SUCCESS; - - return device->config.tap->set_drag_enabled(device, enable); -} - -LIBINPUT_EXPORT enum libinput_config_drag_state -libinput_device_config_tap_get_drag_enabled(struct libinput_device *device) -{ - if (libinput_device_config_tap_get_finger_count(device) == 0) - return LIBINPUT_CONFIG_DRAG_DISABLED; - - return device->config.tap->get_drag_enabled(device); -} - -LIBINPUT_EXPORT enum libinput_config_drag_state -libinput_device_config_tap_get_default_drag_enabled(struct libinput_device *device) -{ - if (libinput_device_config_tap_get_finger_count(device) == 0) - return LIBINPUT_CONFIG_DRAG_DISABLED; - - return device->config.tap->get_default_drag_enabled(device); -} - -LIBINPUT_EXPORT enum libinput_config_status libinput_device_config_tap_set_drag_lock_enabled(struct libinput_device *device, enum libinput_config_drag_lock_state enable) { @@ -3651,6 +2186,7 @@ return device->config.accel->set_speed(device, speed); } + LIBINPUT_EXPORT double libinput_device_config_accel_get_speed(struct libinput_device *device) { @@ -3669,52 +2205,6 @@ return device->config.accel->get_default_speed(device); } -LIBINPUT_EXPORT uint32_t -libinput_device_config_accel_get_profiles(struct libinput_device *device) -{ - if (!libinput_device_config_accel_is_available(device)) - return 0; - - return device->config.accel->get_profiles(device); -} - -LIBINPUT_EXPORT enum libinput_config_accel_profile -libinput_device_config_accel_get_profile(struct libinput_device *device) -{ - if (!libinput_device_config_accel_is_available(device)) - return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE; - - return device->config.accel->get_profile(device); -} - -LIBINPUT_EXPORT enum libinput_config_accel_profile -libinput_device_config_accel_get_default_profile(struct libinput_device *device) -{ - if (!libinput_device_config_accel_is_available(device)) - return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE; - - return device->config.accel->get_default_profile(device); -} - -LIBINPUT_EXPORT enum libinput_config_status -libinput_device_config_accel_set_profile(struct libinput_device *device, - enum libinput_config_accel_profile profile) -{ - switch (profile) { - case LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT: - case LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE: - break; - default: - return LIBINPUT_CONFIG_STATUS_INVALID; - } - - if (!libinput_device_config_accel_is_available(device) || - (libinput_device_config_accel_get_profiles(device) & profile) == 0) - return LIBINPUT_CONFIG_STATUS_UNSUPPORTED; - - return device->config.accel->set_profile(device, profile); -} - LIBINPUT_EXPORT int libinput_device_config_scroll_has_natural_scroll(struct libinput_device *device) { @@ -3948,13 +2438,13 @@ libinput_device_config_scroll_set_button(struct libinput_device *device, uint32_t button) { + if (button && !libinput_device_pointer_has_button(device, button)) + return LIBINPUT_CONFIG_STATUS_INVALID; + if ((libinput_device_config_scroll_get_methods(device) & LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) == 0) return LIBINPUT_CONFIG_STATUS_UNSUPPORTED; - if (button && !libinput_device_pointer_has_button(device, button)) - return LIBINPUT_CONFIG_STATUS_INVALID; - return device->config.scroll_method->set_button(device, button); } @@ -4019,44 +2509,3 @@ return device->config.dwt->get_default_enabled(device); } - -LIBINPUT_EXPORT int -libinput_device_config_rotation_is_available(struct libinput_device *device) -{ - if (!device->config.rotation) - return 0; - - return device->config.rotation->is_available(device); -} - -LIBINPUT_EXPORT enum libinput_config_status -libinput_device_config_rotation_set_angle(struct libinput_device *device, - unsigned int degrees_cw) -{ - if (!libinput_device_config_rotation_is_available(device)) - return degrees_cw ? LIBINPUT_CONFIG_STATUS_UNSUPPORTED : - LIBINPUT_CONFIG_STATUS_SUCCESS; - - if (degrees_cw >= 360 || degrees_cw % 90) - return LIBINPUT_CONFIG_STATUS_INVALID; - - return device->config.rotation->set_angle(device, degrees_cw); -} - -LIBINPUT_EXPORT unsigned int -libinput_device_config_rotation_get_angle(struct libinput_device *device) -{ - if (!libinput_device_config_rotation_is_available(device)) - return 0; - - return device->config.rotation->get_angle(device); -} - -LIBINPUT_EXPORT unsigned int -libinput_device_config_rotation_get_default_angle(struct libinput_device *device) -{ - if (!libinput_device_config_rotation_is_available(device)) - return 0; - - return device->config.rotation->get_default_angle(device); -} diff -Nru libinput-1.10.3/src/libinput.h libinput-0.21.0/src/libinput.h --- libinput-1.10.3/src/libinput.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/libinput.h 2015-08-03 03:44:47.000000000 +0000 @@ -31,7 +31,6 @@ #include #include -#include #include #define LIBINPUT_ATTRIBUTE_PRINTF(_format, _args) \ @@ -40,132 +39,6 @@ /** * @ingroup base - * @struct libinput - * - * A handle for accessing libinput. This struct is refcounted, use - * libinput_ref() and libinput_unref(). - */ -struct libinput; - -/** - * @ingroup device - * @struct libinput_device - * - * A base handle for accessing libinput devices. This struct is - * refcounted, use libinput_device_ref() and libinput_device_unref(). - */ -struct libinput_device; - -/** - * @ingroup device - * @struct libinput_device_group - * - * A base handle for accessing libinput device groups. This struct is - * refcounted, use libinput_device_group_ref() and - * libinput_device_group_unref(). - */ -struct libinput_device_group; - -/** - * @ingroup seat - * @struct libinput_seat - * - * The base handle for accessing libinput seats. This struct is - * refcounted, use libinput_seat_ref() and libinput_seat_unref(). - */ -struct libinput_seat; - -/** - * @ingroup device - * @struct libinput_tablet_tool - * - * An object representing a tool being used by a device with the @ref - * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. - * - * Tablet events generated by such a device are bound to a specific tool - * rather than coming from the device directly. Depending on the hardware it - * is possible to track the same physical tool across multiple - * struct libinput_device devices, see @ref tablet-serial-numbers. - * - * This struct is refcounted, use libinput_tablet_tool_ref() and - * libinput_tablet_tool_unref(). - */ -struct libinput_tablet_tool; - -/** - * @ingroup event - * @struct libinput_event - * - * The base event type. Use libinput_event_get_pointer_event() or similar to - * get the actual event type. - * - * @warning Unlike other structs events are considered transient and - * not refcounted. - */ -struct libinput_event; - -/** - * @ingroup event - * @struct libinput_event_device_notify - * - * An event notifying the caller of a device being added or removed. - */ -struct libinput_event_device_notify; - -/** - * @ingroup event_keyboard - * @struct libinput_event_keyboard - * - * A keyboard event representing a key press/release. - */ -struct libinput_event_keyboard; - -/** - * @ingroup event_pointer - * @struct libinput_event_pointer - * - * A pointer event representing relative or absolute pointer movement, - * a button press/release or scroll axis events. - */ -struct libinput_event_pointer; - -/** - * @ingroup event_touch - * @struct libinput_event_touch - * - * Touch event representing a touch down, move or up, as well as a touch - * cancel and touch frame events. Valid event types for this event are @ref - * LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_MOTION, @ref - * LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_CANCEL and @ref - * LIBINPUT_EVENT_TOUCH_FRAME. - */ -struct libinput_event_touch; - -/** - * @ingroup event_tablet - * @struct libinput_event_tablet_tool - * - * Tablet tool event representing an axis update, button press, or tool - * update. Valid event types for this event are @ref - * LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY and @ref - * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - */ -struct libinput_event_tablet_tool; - -/** - * @ingroup event_tablet_pad - * @struct libinput_event_tablet_pad - * - * Tablet pad event representing a button press, or ring/strip update on - * the tablet pad itself. Valid event types for this event are @ref - * LIBINPUT_EVENT_TABLET_PAD_BUTTON, @ref LIBINPUT_EVENT_TABLET_PAD_RING and - * @ref LIBINPUT_EVENT_TABLET_PAD_STRIP. - */ -struct libinput_event_tablet_pad; - -/** - * @ingroup base * * Log priority for internal logging messages. */ @@ -185,10 +58,7 @@ LIBINPUT_DEVICE_CAP_KEYBOARD = 0, LIBINPUT_DEVICE_CAP_POINTER = 1, LIBINPUT_DEVICE_CAP_TOUCH = 2, - LIBINPUT_DEVICE_CAP_TABLET_TOOL = 3, - LIBINPUT_DEVICE_CAP_TABLET_PAD = 4, LIBINPUT_DEVICE_CAP_GESTURE = 5, - LIBINPUT_DEVICE_CAP_SWITCH = 6, }; /** @@ -261,597 +131,190 @@ * The event is caused by the motion of some device. */ LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS, - /** - * The event is caused by the tilting of a mouse wheel rather than - * its rotation. This method is commonly used on mice without - * separate horizontal scroll wheels. - */ - LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT, }; /** - * @ingroup event_tablet_pad + * @ingroup base * - * The source for a @ref LIBINPUT_EVENT_TABLET_PAD_RING event. See - * libinput_event_tablet_pad_get_ring_source() for details. + * Event type for events returned by libinput_get_event(). */ -enum libinput_tablet_pad_ring_axis_source { - LIBINPUT_TABLET_PAD_RING_SOURCE_UNKNOWN = 1, +enum libinput_event_type { /** - * The event is caused by the movement of one or more fingers on - * the ring. + * This is not a real event type, and is only used to tell the user that + * no new event is available in the queue. See + * libinput_next_event_type(). */ - LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER, -}; + LIBINPUT_EVENT_NONE = 0, -/** - * @ingroup event_tablet_pad - * - * The source for a @ref LIBINPUT_EVENT_TABLET_PAD_STRIP event. See - * libinput_event_tablet_pad_get_strip_source() for details. - */ -enum libinput_tablet_pad_strip_axis_source { - LIBINPUT_TABLET_PAD_STRIP_SOURCE_UNKNOWN = 1, /** - * The event is caused by the movement of one or more fingers on - * the strip. + * Signals that a device has been added to the context. The device will + * not be read until the next time the user calls libinput_dispatch() + * and data is available. + * + * This allows setting up initial device configuration before any events + * are created. */ - LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER, -}; + LIBINPUT_EVENT_DEVICE_ADDED, -/** - * @ingroup device - * - * Available tool types for a device with the @ref - * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. The tool type defines the default - * usage of the tool as advertised by the manufacturer. Multiple different - * physical tools may share the same tool type, e.g. a Wacom Classic Pen, - * Wacom Pro Pen and a Wacom Grip Pen are all of type @ref - * LIBINPUT_TABLET_TOOL_TYPE_PEN. - * Use libinput_tablet_tool_get_tool_id() to get a specific model where applicable. - * - * Note that on some device, the eraser tool is on the tail end of a pen - * device. On other devices, e.g. MS Surface 3, the eraser is the pen tip - * while a button is held down. - * - * @note The @ref libinput_tablet_tool_type can only describe the default physical - * type of the device. For devices with adjustable physical properties - * the tool type remains the same, i.e. putting a Wacom stroke nib into a - * classic pen leaves the tool type as @ref LIBINPUT_TABLET_TOOL_TYPE_PEN. - */ -enum libinput_tablet_tool_type { - LIBINPUT_TABLET_TOOL_TYPE_PEN = 1, /**< A generic pen */ - LIBINPUT_TABLET_TOOL_TYPE_ERASER, /**< Eraser */ - LIBINPUT_TABLET_TOOL_TYPE_BRUSH, /**< A paintbrush-like tool */ - LIBINPUT_TABLET_TOOL_TYPE_PENCIL, /**< Physical drawing tool, e.g. - Wacom Inking Pen */ - LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH, /**< An airbrush-like tool */ - LIBINPUT_TABLET_TOOL_TYPE_MOUSE, /**< A mouse bound to the tablet */ - LIBINPUT_TABLET_TOOL_TYPE_LENS, /**< A mouse tool with a lens */ -}; + /** + * Signals that a device has been removed. No more events from the + * associated device will be in the queue or be queued after this event. + */ + LIBINPUT_EVENT_DEVICE_REMOVED, -/** - * @ingroup device - * - * The state of proximity for a tool on a device. The device must have the @ref - * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. - * - * The proximity of a tool is a binary state signalling whether the tool is - * within a detectable distance of the tablet device. A tool that is out of - * proximity cannot generate events. - * - * On some hardware a tool goes out of proximity when it ceases to touch the - * surface. On other hardware, the tool is still detectable within a short - * distance (a few cm) off the surface. - */ -enum libinput_tablet_tool_proximity_state { - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT = 0, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN = 1, -}; + LIBINPUT_EVENT_KEYBOARD_KEY = 300, -/** - * @ingroup device - * - * The tip contact state for a tool on a device. The device must have - * the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. - * - * The tip contact state of a tool is a binary state signalling whether the tool is - * touching the surface of the tablet device. - */ -enum libinput_tablet_tool_tip_state { - LIBINPUT_TABLET_TOOL_TIP_UP = 0, - LIBINPUT_TABLET_TOOL_TIP_DOWN = 1, + LIBINPUT_EVENT_POINTER_MOTION = 400, + LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, + LIBINPUT_EVENT_POINTER_BUTTON, + LIBINPUT_EVENT_POINTER_AXIS, + + LIBINPUT_EVENT_TOUCH_DOWN = 500, + LIBINPUT_EVENT_TOUCH_UP, + LIBINPUT_EVENT_TOUCH_MOTION, + LIBINPUT_EVENT_TOUCH_CANCEL, + /** + * Signals the end of a set of touchpoints at one device sample + * time. This event has no coordinate information attached. + */ + LIBINPUT_EVENT_TOUCH_FRAME, + + LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN = 800, + LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, + LIBINPUT_EVENT_GESTURE_SWIPE_END, + LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, + LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, + LIBINPUT_EVENT_GESTURE_PINCH_END, }; /** - * @defgroup tablet_pad_modes Tablet pad modes + * @ingroup base + * @struct libinput * - * Handling the virtual mode groups of buttons, strips and rings on tablet - * pad devices. See @ref tablet-pad-modes for details. + * A handle for accessing libinput. This struct is refcounted, use + * libinput_ref() and libinput_unref(). */ +struct libinput; /** - * @ingroup tablet_pad_modes - * @struct libinput_tablet_pad_mode_group - * - * A mode on a tablet pad is a virtual grouping of functionality, usually - * based on some visual feedback like LEDs on the pad. The set of buttons, - * rings and strips that share the same mode are a "mode group". Whenever - * the mode changes, all buttons, rings and strips within this mode group - * are affected. See @ref tablet-pad-modes for detail. - * - * Most tablets only have a single mode group, some tablets provide multiple - * mode groups through independent banks of LEDs (e.g. the Wacom Cintiq - * 24HD). libinput guarantees that at least one mode group is always - * available. + * @ingroup device + * @struct libinput_device * - * This struct is refcounted, use libinput_tablet_pad_mode_group_ref() and - * libinput_tablet_pad_mode_group_unref(). + * A base handle for accessing libinput devices. This struct is + * refcounted, use libinput_device_ref() and libinput_device_unref(). */ -struct libinput_tablet_pad_mode_group; +struct libinput_device; /** - * @ingroup tablet_pad_modes - * - * Most devices only provide a single mode group, however devices such as - * the Wacom Cintiq 22HD provide two mode groups. If multiple mode groups - * are available, a caller should use - * libinput_tablet_pad_mode_group_has_button(), - * libinput_tablet_pad_mode_group_has_ring() and - * libinput_tablet_pad_mode_group_has_strip() to associate each button, - * ring and strip with the correct mode group. + * @ingroup device + * @struct libinput_device_group * - * @return the number of mode groups available on this device + * A base handle for accessing libinput device groups. This struct is + * refcounted, use libinput_device_group_ref() and + * libinput_device_group_unref(). */ -int -libinput_device_tablet_pad_get_num_mode_groups(struct libinput_device *device); +struct libinput_device_group; /** - * @ingroup tablet_pad_modes - * - * The returned mode group is not refcounted and may become invalid after - * the next call to libinput. Use libinput_tablet_pad_mode_group_ref() and - * libinput_tablet_pad_mode_group_unref() to continue using the handle - * outside of the immediate scope. - * - * While at least one reference is kept by the caller, the returned mode - * group will be identical for each subsequent call of this function with - * the same index and that same struct is returned from - * libinput_event_tablet_pad_get_mode_group(), provided the event was - * generated by this mode group. + * @ingroup seat + * @struct libinput_seat * - * @param device A device with the @ref LIBINPUT_DEVICE_CAP_TABLET_PAD - * capability - * @param index A mode group index - * @return the mode group with the given index or NULL if an invalid index - * is given. + * The base handle for accessing libinput seats. This struct is + * refcounted, use libinput_seat_ref() and libinput_seat_unref(). */ -struct libinput_tablet_pad_mode_group* -libinput_device_tablet_pad_get_mode_group(struct libinput_device *device, - unsigned int index); +struct libinput_seat; /** - * @ingroup tablet_pad_modes + * @ingroup event + * @struct libinput_event * - * The returned number is the same index as passed to - * libinput_device_tablet_pad_get_mode_group(). For tablets with only one - * mode this number is always 0. + * The base event type. Use libinput_event_get_pointer_event() or similar to + * get the actual event type. * - * @param group A previously obtained mode group - * @return the numeric index this mode group represents, starting at 0 + * @warning Unlike other structs events are considered transient and + * not refcounted. */ -unsigned int -libinput_tablet_pad_mode_group_get_index(struct libinput_tablet_pad_mode_group *group); +struct libinput_event; /** - * @ingroup tablet_pad_modes - * - * Query the mode group for the number of available modes. The number of - * modes is usually decided by the number of physical LEDs available on the - * device. Different mode groups may have a different number of modes. Use - * libinput_tablet_pad_mode_group_get_mode() to get the currently active - * mode. - * - * libinput guarantees that at least one mode is available. A device without - * mode switching capability has a single mode group and a single mode. + * @ingroup event + * @struct libinput_event_device_notify * - * @param group A previously obtained mode group - * @return the number of modes available in this mode group + * An event notifying the caller of a device being added or removed. */ -unsigned int -libinput_tablet_pad_mode_group_get_num_modes(struct libinput_tablet_pad_mode_group *group); +struct libinput_event_device_notify; /** - * @ingroup tablet_pad_modes - * - * Return the current mode this mode group is in. Note that the returned - * mode is the mode valid as of completing the last libinput_dispatch(). - * The returned mode may thus be different than the mode returned by - * libinput_event_tablet_pad_get_mode(). - * - * For example, if the mode was toggled three times between the call to - * libinput_dispatch(), this function returns the third mode but the events - * in the event queue will return the modes 1, 2 and 3, respectively. - * - * @param group A previously obtained mode group - * @return the numeric index of the current mode in this group, starting at 0 + * @ingroup event_keyboard + * @struct libinput_event_keyboard * - * @see libinput_event_tablet_pad_get_mode + * A keyboard event representing a key press/release. */ -unsigned int -libinput_tablet_pad_mode_group_get_mode(struct libinput_tablet_pad_mode_group *group); +struct libinput_event_keyboard; /** - * @ingroup tablet_pad_modes - * - * Devices without mode switching capabilities return true for every button. + * @ingroup event_pointer + * @struct libinput_event_pointer * - * @param group A previously obtained mode group - * @param button A button index, starting at 0 - * @return true if the given button index is part of this mode group or - * false otherwise + * A pointer event representing relative or absolute pointer movement, + * a button press/release or scroll axis events. */ -int -libinput_tablet_pad_mode_group_has_button(struct libinput_tablet_pad_mode_group *group, - unsigned int button); +struct libinput_event_pointer; /** - * @ingroup tablet_pad_modes - * - * Devices without mode switching capabilities return true for every ring. + * @ingroup event_touch + * @struct libinput_event_touch * - * @param group A previously obtained mode group - * @param ring A ring index, starting at 0 - * @return true if the given ring index is part of this mode group or - * false otherwise + * Touch event representing a touch down, move or up, as well as a touch + * cancel and touch frame events. Valid event types for this event are @ref + * LIBINPUT_EVENT_TOUCH_DOWN, @ref LIBINPUT_EVENT_TOUCH_MOTION, @ref + * LIBINPUT_EVENT_TOUCH_UP, @ref LIBINPUT_EVENT_TOUCH_CANCEL and @ref + * LIBINPUT_EVENT_TOUCH_FRAME. */ -int -libinput_tablet_pad_mode_group_has_ring(struct libinput_tablet_pad_mode_group *group, - unsigned int ring); +struct libinput_event_touch; /** - * @ingroup tablet_pad_modes - * - * Devices without mode switching capabilities return true for every strip. - * - * @param group A previously obtained mode group - * @param strip A strip index, starting at 0 - * @return true if the given strip index is part of this mode group or - * false otherwise + * @defgroup event Accessing and destruction of events */ -int -libinput_tablet_pad_mode_group_has_strip(struct libinput_tablet_pad_mode_group *group, - unsigned int strip); /** - * @ingroup tablet_pad_modes + * @ingroup event * - * The toggle button in a mode group is the button assigned to cycle to or - * directly assign a new mode when pressed. Not all devices have a toggle - * button and some devices may have more than one toggle button. For - * example, the Wacom Cintiq 24HD has six toggle buttons in two groups, each - * directly selecting one of the three modes per group. + * Destroy the event, freeing all associated resources. Resources obtained + * from this event must be considered invalid after this call. * - * Devices without mode switching capabilities return false for every button. + * @warning Unlike other structs events are considered transient and + * not refcounted. Calling libinput_event_destroy() will + * destroy the event. * - * @param group A previously obtained mode group - * @param button A button index, starting at 0 - * @retval non-zero if the button is a mode toggle button for this group, or - * zero otherwise + * @param event An event retrieved by libinput_get_event(). */ -int -libinput_tablet_pad_mode_group_button_is_toggle(struct libinput_tablet_pad_mode_group *group, - unsigned int button); +void +libinput_event_destroy(struct libinput_event *event); /** - * @ingroup tablet_pad_modes + * @ingroup event * - * Increase the refcount of the mode group. A mode group will be - * freed whenever the refcount reaches 0. + * Get the type of the event. * - * @param group A previously obtained mode group - * @return The passed mode group + * @param event An event retrieved by libinput_get_event(). */ -struct libinput_tablet_pad_mode_group * -libinput_tablet_pad_mode_group_ref( - struct libinput_tablet_pad_mode_group *group); +enum libinput_event_type +libinput_event_get_type(struct libinput_event *event); /** - * @ingroup tablet_pad_modes + * @ingroup event * - * Decrease the refcount of the mode group. A mode group will be - * freed whenever the refcount reaches 0. + * Get the libinput context from the event. * - * @param group A previously obtained mode group - * @return NULL if the group was destroyed, otherwise the passed mode group + * @param event The libinput event + * @return The libinput context for this event. */ -struct libinput_tablet_pad_mode_group * -libinput_tablet_pad_mode_group_unref( - struct libinput_tablet_pad_mode_group *group); +struct libinput * +libinput_event_get_context(struct libinput_event *event); /** - * @ingroup tablet_pad_modes - * - * Set caller-specific data associated with this mode group. libinput does - * not manage, look at, or modify this data. The caller must ensure the - * data is valid. - * - * @param group A previously obtained mode group - * @param user_data Caller-specific data pointer - * @see libinput_tablet_pad_mode_group_get_user_data - * - */ -void -libinput_tablet_pad_mode_group_set_user_data( - struct libinput_tablet_pad_mode_group *group, - void *user_data); - -/** - * @ingroup tablet_pad_modes - * - * Get the caller-specific data associated with this mode group, if any. - * - * @param group A previously obtained mode group - * @return Caller-specific data pointer or NULL if none was set - * @see libinput_tablet_pad_mode_group_set_user_data - */ -void * -libinput_tablet_pad_mode_group_get_user_data( - struct libinput_tablet_pad_mode_group *group); - -/** - * @ingroup device - * - * The state of a switch. The default state of a switch is @ref - * LIBINPUT_SWITCH_STATE_OFF and no event is sent to confirm a switch in the - * off position. If a switch is logically on during initialization, libinput - * sends an event of type @ref LIBINPUT_EVENT_SWITCH_TOGGLE with a state - * @ref LIBINPUT_SWITCH_STATE_ON. - */ -enum libinput_switch_state { - LIBINPUT_SWITCH_STATE_OFF = 0, - LIBINPUT_SWITCH_STATE_ON = 1, -}; - -/** - * @ingroup device - * - * The type of a switch. - */ -enum libinput_switch { - /** - * The laptop lid was closed when the switch state is @ref - * LIBINPUT_SWITCH_STATE_ON, or was opened when it is @ref - * LIBINPUT_SWITCH_STATE_OFF. - */ - LIBINPUT_SWITCH_LID = 1, - - /** - * This switch indicates whether the device is in normal laptop mode - * or behaves like a tablet-like device where the primary - * interaction is usually a touch screen. When in tablet mode, the - * keyboard and touchpad are usually inaccessible. - * - * If the switch is in state @ref LIBINPUT_SWITCH_STATE_OFF, the - * device is in laptop mode. If the switch is in state @ref - * LIBINPUT_SWITCH_STATE_ON, the device is in tablet mode and the - * keyboard or touchpad may not be accessible. - * - * It is up to the caller to identify which devices are inaccessible - * in tablet mode. - */ - LIBINPUT_SWITCH_TABLET_MODE, -}; - -/** - * @ingroup event_switch - * @struct libinput_event_switch - * - * A switch event representing a changed state in a switch. - */ -struct libinput_event_switch; - -/** - * @ingroup base - * - * Event type for events returned by libinput_get_event(). - */ -enum libinput_event_type { - /** - * This is not a real event type, and is only used to tell the user that - * no new event is available in the queue. See - * libinput_next_event_type(). - */ - LIBINPUT_EVENT_NONE = 0, - - /** - * Signals that a device has been added to the context. The device will - * not be read until the next time the user calls libinput_dispatch() - * and data is available. - * - * This allows setting up initial device configuration before any events - * are created. - */ - LIBINPUT_EVENT_DEVICE_ADDED, - - /** - * Signals that a device has been removed. No more events from the - * associated device will be in the queue or be queued after this event. - */ - LIBINPUT_EVENT_DEVICE_REMOVED, - - LIBINPUT_EVENT_KEYBOARD_KEY = 300, - - LIBINPUT_EVENT_POINTER_MOTION = 400, - LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, - LIBINPUT_EVENT_POINTER_BUTTON, - LIBINPUT_EVENT_POINTER_AXIS, - - LIBINPUT_EVENT_TOUCH_DOWN = 500, - LIBINPUT_EVENT_TOUCH_UP, - LIBINPUT_EVENT_TOUCH_MOTION, - LIBINPUT_EVENT_TOUCH_CANCEL, - /** - * Signals the end of a set of touchpoints at one device sample - * time. This event has no coordinate information attached. - */ - LIBINPUT_EVENT_TOUCH_FRAME, - - /** - * One or more axes have changed state on a device with the @ref - * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. This event is only sent - * when the tool is in proximity, see @ref - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY for details. - * - * The proximity event contains the initial state of the axis as the - * tool comes into proximity. An event of type @ref - * LIBINPUT_EVENT_TABLET_TOOL_AXIS is only sent when an axis value - * changes from this initial state. It is possible for a tool to - * enter and leave proximity without sending an event of type @ref - * LIBINPUT_EVENT_TABLET_TOOL_AXIS. - * - * An event of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS is sent - * when the tip state does not change. See the documentation for - * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP for more details. - */ - LIBINPUT_EVENT_TABLET_TOOL_AXIS = 600, - /** - * Signals that a tool has come in or out of proximity of a device with - * the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. - * - * Proximity events contain each of the current values for each axis, - * and these values may be extracted from them in the same way they are - * with @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS events. - * - * Some tools may always be in proximity. For these tools, events of - * type @ref LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN are sent only once after @ref - * LIBINPUT_EVENT_DEVICE_ADDED, and events of type @ref - * LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT are sent only once before @ref - * LIBINPUT_EVENT_DEVICE_REMOVED. - * - * If the tool that comes into proximity supports x/y coordinates, - * libinput guarantees that both x and y are set in the proximity - * event. - * - * When a tool goes out of proximity, the value of every axis should be - * assumed to have an undefined state and any buttons that are currently held - * down on the stylus are marked as released. Button release events for - * each button that was held down on the stylus are sent before the - * proximity out event. - */ - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, - /** - * Signals that a tool has come in contact with the surface of a - * device with the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. - * - * On devices without distance proximity detection, the @ref - * LIBINPUT_EVENT_TABLET_TOOL_TIP is sent immediately after @ref - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY for the tip down event, and - * immediately before for the tip up event. - * - * The decision when a tip touches the surface is device-dependent - * and may be derived from pressure data or other means. If the tip - * state is changed by axes changing state, the - * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP event includes the changed - * axes and no additional axis event is sent for this state change. - * In other words, a caller must look at both @ref - * LIBINPUT_EVENT_TABLET_TOOL_AXIS and @ref - * LIBINPUT_EVENT_TABLET_TOOL_TIP events to know the current state - * of the axes. - * - * If a button state change occurs at the same time as a tip state - * change, the order of events is device-dependent. - */ - LIBINPUT_EVENT_TABLET_TOOL_TIP, - /** - * Signals that a tool has changed a logical button state on a - * device with the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. - * - * Button state changes occur on their own and do not include axis - * state changes. If button and axis state changes occur within the - * same logical hardware event, the order of the @ref - * LIBINPUT_EVENT_TABLET_TOOL_BUTTON and @ref - * LIBINPUT_EVENT_TABLET_TOOL_AXIS event is device-specific. - * - * This event is not to be confused with the button events emitted - * by the tablet pad. See @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON. - * - * @see LIBINPUT_EVENT_TABLET_BUTTON - */ - LIBINPUT_EVENT_TABLET_TOOL_BUTTON, - - /** - * A button pressed on a device with the @ref - * LIBINPUT_DEVICE_CAP_TABLET_PAD capability. - * - * This event is not to be confused with the button events emitted - * by tools on a tablet. See @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - */ - LIBINPUT_EVENT_TABLET_PAD_BUTTON = 700, - /** - * A status change on a tablet ring with the - * LIBINPUT_DEVICE_CAP_TABLET_PAD capability. - */ - LIBINPUT_EVENT_TABLET_PAD_RING, - - /** - * A status change on a strip on a device with the @ref - * LIBINPUT_DEVICE_CAP_TABLET_PAD capability. - */ - LIBINPUT_EVENT_TABLET_PAD_STRIP, - - LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN = 800, - LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, - LIBINPUT_EVENT_GESTURE_SWIPE_END, - LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, - LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, - LIBINPUT_EVENT_GESTURE_PINCH_END, - - LIBINPUT_EVENT_SWITCH_TOGGLE = 900, -}; - -/** - * @defgroup event Accessing and destruction of events - */ - -/** - * @ingroup event - * - * Destroy the event, freeing all associated resources. Resources obtained - * from this event must be considered invalid after this call. - * - * @warning Unlike other structs events are considered transient and - * not refcounted. Calling libinput_event_destroy() will - * destroy the event. - * - * @param event An event retrieved by libinput_get_event(). - */ -void -libinput_event_destroy(struct libinput_event *event); - -/** - * @ingroup event - * - * Get the type of the event. - * - * @param event An event retrieved by libinput_get_event(). - */ -enum libinput_event_type -libinput_event_get_type(struct libinput_event *event); - -/** - * @ingroup event - * - * Get the libinput context from the event. - * - * @param event The libinput event - * @return The libinput context for this event. - */ -struct libinput * -libinput_event_get_context(struct libinput_event *event); - -/** - * @ingroup event + * @ingroup event * * Return the device associated with this event. For device added/removed * events this is the device added or removed. For all other device events, @@ -921,45 +384,6 @@ /** * @ingroup event * - * Return the tablet tool event that is this input event. If the event type - * does not match the tablet tool event types, this function returns NULL. - * - * The inverse of this function is libinput_event_tablet_tool_get_base_event(). - * - * @return A tablet tool event, or NULL for other events - */ -struct libinput_event_tablet_tool * -libinput_event_get_tablet_tool_event(struct libinput_event *event); - -/** - * @ingroup event - * - * Return the tablet pad event that is this input event. If the event type does not - * match the tablet pad event types, this function returns NULL. - * - * The inverse of this function is libinput_event_tablet_pad_get_base_event(). - * - * @return A tablet pad event, or NULL for other events - */ -struct libinput_event_tablet_pad * -libinput_event_get_tablet_pad_event(struct libinput_event *event); - -/** - * @ingroup event - * - * Return the switch event that is this input event. If the event type does - * not match the switch event types, this function returns NULL. - * - * The inverse of this function is libinput_event_switch_get_base_event(). - * - * @return A switch event, or NULL for other events - */ -struct libinput_event_switch * -libinput_event_get_switch_event(struct libinput_event *event); - -/** - * @ingroup event - * * Return the device event that is this input event. If the event type does * not match the device event types, this function returns NULL. * @@ -989,9 +413,6 @@ /** * @ingroup event_keyboard * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. - * * @return The event time for this event */ uint32_t @@ -1000,9 +421,6 @@ /** * @ingroup event_keyboard * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. - * * @return The event time for this event in microseconds */ uint64_t @@ -1058,9 +476,6 @@ /** * @ingroup event_pointer * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. - * * @return The event time for this event */ uint32_t @@ -1069,9 +484,6 @@ /** * @ingroup event_pointer * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. - * * @return The event time for this event in microseconds */ uint64_t @@ -1132,9 +544,6 @@ * X resolution of the touchpad. See @ref motion_normalization for more * details. * - * Any rotation applied to the device also applies to unaccelerated motion - * (see libinput_device_config_rotation_set_angle()). - * * @note It is an application bug to call this function for events other than * @ref LIBINPUT_EVENT_POINTER_MOTION. * @@ -1157,9 +566,6 @@ * X resolution of the touchpad. See @ref motion_normalization for more * details. * - * Any rotation applied to the device also applies to unaccelerated motion - * (see libinput_device_config_rotation_set_angle()). - * * @note It is an application bug to call this function for events other than * @ref LIBINPUT_EVENT_POINTER_MOTION. * @@ -1372,15 +778,6 @@ * The coordinate system is identical to the cursor movement, i.e. a * scroll value of 1 represents the equivalent relative motion of 1. * - * If the source is @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT, no - * terminating event is guaranteed (though it may happen). - * Scrolling is in discrete steps and there is no physical equivalent for - * the value returned here. For backwards compatibility, the value returned - * by this function is identical to a single mouse wheel rotation by this - * device (see the documentation for @ref LIBINPUT_POINTER_AXIS_SOURCE_WHEEL - * above). Callers should not use this value but instead exclusively refer - * to the value returned by libinput_event_pointer_get_axis_value_discrete(). - * * For pointer events that are not of type @ref LIBINPUT_EVENT_POINTER_AXIS, * this function returns 0. * @@ -1393,7 +790,7 @@ libinput_event_pointer_get_axis_source(struct libinput_event_pointer *event); /** - * @ingroup event_pointer + * @ingroup pointer * * Return the axis value in discrete steps for a given axis event. How a * value translates into a discrete step depends on the source. @@ -1429,9 +826,6 @@ /** * @ingroup event_touch * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. - * * @return The event time for this event */ uint32_t @@ -1440,9 +834,6 @@ /** * @ingroup event_touch * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. - * * @return The event time for this event in microseconds */ uint64_t @@ -1503,8 +894,7 @@ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. * * @note It is an application bug to call this function for events of type - * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref - * LIBINPUT_EVENT_TOUCH_MOTION. + * @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref LIBINPUT_EVENT_TOUCH_MOTION. * * @param event The libinput touch event * @return The current absolute x coordinate @@ -1523,8 +913,7 @@ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. * * @note It is an application bug to call this function for events of type - * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref - * LIBINPUT_EVENT_TOUCH_MOTION. + * @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref LIBINPUT_EVENT_TOUCH_MOTION. * * @param event The libinput touch event * @return The current absolute y coordinate @@ -1542,8 +931,7 @@ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. * * @note It is an application bug to call this function for events of type - * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref - * LIBINPUT_EVENT_TOUCH_MOTION. + * @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref LIBINPUT_EVENT_TOUCH_MOTION. * * @param event The libinput touch event * @param width The current output screen width @@ -1563,8 +951,7 @@ * LIBINPUT_EVENT_TOUCH_MOTION, this function returns 0. * * @note It is an application bug to call this function for events of type - * other than @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref - * LIBINPUT_EVENT_TOUCH_MOTION. + * @ref LIBINPUT_EVENT_TOUCH_DOWN or @ref LIBINPUT_EVENT_TOUCH_MOTION. * * @param event The libinput touch event * @param height The current output screen height @@ -1599,9 +986,6 @@ /** * @ingroup event_gesture * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. - * * @return The event time for this event */ uint32_t @@ -1610,9 +994,6 @@ /** * @ingroup event_gesture * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. - * * @return The event time for this event in microseconds */ uint64_t @@ -1706,9 +1087,6 @@ * details. Note that unaccelerated events are not equivalent to 'raw' events * as read from the device. * - * Any rotation applied to the device also applies to gesture motion - * (see libinput_device_config_rotation_set_angle()). - * * @return the unaccelerated relative x movement since the last event */ double @@ -1728,9 +1106,6 @@ * details. Note that unaccelerated events are not equivalent to 'raw' events * as read from the device. * - * Any rotation applied to the device also applies to gesture motion - * (see libinput_device_config_rotation_set_angle()). - * * @return the unaccelerated relative y movement since the last event */ double @@ -1757,1121 +1132,38 @@ * For all other events this function returns 0. * * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, @ref - * LIBINPUT_EVENT_GESTURE_PINCH_END or - * @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE. - * - * @return the absolute scale of a pinch gesture - */ -double -libinput_event_gesture_get_scale(struct libinput_event_gesture *event); - -/** - * @ingroup event_gesture - * - * Return the angle delta in degrees between the last and the current @ref - * LIBINPUT_EVENT_GESTURE_PINCH_UPDATE event. For gesture events that - * are not of type @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this - * function returns 0. - * - * The angle delta is defined as the change in angle of the line formed by - * the 2 fingers of a pinch gesture. Clockwise rotation is represented - * by a positive delta, counter-clockwise by a negative delta. If e.g. the - * fingers are on the 12 and 6 location of a clock face plate and they move - * to the 1 resp. 7 location in a single event then the angle delta is - * 30 degrees. - * - * If more than two fingers are present, the angle represents the rotation - * around the center of gravity. The calculation of the center of gravity is - * implementation-dependent. - * - * @return the angle delta since the last event - */ -double -libinput_event_gesture_get_angle_delta(struct libinput_event_gesture *event); - -/** - * @defgroup event_tablet Tablet events - * - * Events that come from tools on tablet devices. For events from the pad, - * see @ref event_tablet_pad. - * - * Events from tablet devices are exposed by two interfaces, tools and pads. - * Tool events originate (usually) from a stylus-like device, pad events - * reflect any events originating from the physical tablet itself. - * - * Note that many tablets support touch events. These are exposed through - * the @ref LIBINPUT_DEVICE_CAP_POINTER interface (for external touchpad-like - * devices such as the Wacom Intuos series) or @ref - * LIBINPUT_DEVICE_CAP_TOUCH interface (for built-in touchscreen-like - * devices such as the Wacom Cintiq series). - */ - -/** - * @ingroup event_tablet - * - * @return The generic libinput_event of this event - */ -struct libinput_event * -libinput_event_tablet_tool_get_base_event(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Check if the x axis was updated in this event. - * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, - * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or - * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. - * - * @note It is an application bug to call this function for events other - * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref - * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - * - * @param event The libinput tablet tool event - * @return 1 if the axis was updated or 0 otherwise - */ -int -libinput_event_tablet_tool_x_has_changed( - struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Check if the y axis was updated in this event. - * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, - * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or - * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. - * - * @note It is an application bug to call this function for events other - * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref - * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - * - * @param event The libinput tablet tool event - * @return 1 if the axis was updated or 0 otherwise - */ -int -libinput_event_tablet_tool_y_has_changed( - struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Check if the pressure axis was updated in this event. - * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, - * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or - * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. - * - * @note It is an application bug to call this function for events other - * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref - * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - * - * @param event The libinput tablet tool event - * @return 1 if the axis was updated or 0 otherwise - */ -int -libinput_event_tablet_tool_pressure_has_changed( - struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Check if the distance axis was updated in this event. - * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, - * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or - * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. - * For tablet tool events of type @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, - * this function always returns 1. - * - * @note It is an application bug to call this function for events other - * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref - * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - * - * @param event The libinput tablet tool event - * @return 1 if the axis was updated or 0 otherwise - */ -int -libinput_event_tablet_tool_distance_has_changed( - struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Check if the tilt x axis was updated in this event. - * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, - * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or - * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. - * - * @note It is an application bug to call this function for events other - * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref - * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - * - * @param event The libinput tablet tool event - * @return 1 if the axis was updated or 0 otherwise - */ -int -libinput_event_tablet_tool_tilt_x_has_changed( - struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Check if the tilt y axis was updated in this event. - * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, - * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or - * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. - * - * @note It is an application bug to call this function for events other - * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref - * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - * - * @param event The libinput tablet tool event - * @return 1 if the axis was updated or 0 otherwise - */ -int -libinput_event_tablet_tool_tilt_y_has_changed( - struct libinput_event_tablet_tool *event); -/** - * @ingroup event_tablet - * - * Check if the z-rotation axis was updated in this event. - * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, - * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or - * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. - * - * @note It is an application bug to call this function for events other - * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref - * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - * - * @param event The libinput tablet tool event - * @return 1 if the axis was updated or 0 otherwise - */ -int -libinput_event_tablet_tool_rotation_has_changed( - struct libinput_event_tablet_tool *event); -/** - * @ingroup event_tablet - * - * Check if the slider axis was updated in this event. - * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, - * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or - * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. - * - * @note It is an application bug to call this function for events other - * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref - * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - * - * @param event The libinput tablet tool event - * @return 1 if the axis was updated or 0 otherwise - */ -int -libinput_event_tablet_tool_slider_has_changed( - struct libinput_event_tablet_tool *event); -/** - * @ingroup event_tablet - * - * Check if the wheel axis was updated in this event. - * For events that are not of type @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, - * @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, or - * @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, this function returns 0. - * - * @note It is an application bug to call this function for events other - * than @ref LIBINPUT_EVENT_TABLET_TOOL_AXIS, @ref - * LIBINPUT_EVENT_TABLET_TOOL_TIP, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, or @ref - * LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - * - * @param event The libinput tablet tool event - * @return 1 if the axis was updated or 0 otherwise - */ -int -libinput_event_tablet_tool_wheel_has_changed( - struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Returns the X coordinate of the tablet tool, in mm from the top left - * corner of the tablet in its current logical orientation. Use - * libinput_event_tablet_tool_get_x_transformed() for transforming the axis - * value into a different coordinate space. - * - * @note On some devices, returned value may be negative or larger than the - * width of the device. See @ref tablet-bounds for more details. - * - * @param event The libinput tablet tool event - * @return The current value of the the axis - */ -double -libinput_event_tablet_tool_get_x(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Returns the Y coordinate of the tablet tool, in mm from the top left - * corner of the tablet in its current logical orientation. Use - * libinput_event_tablet_tool_get_y_transformed() for transforming the axis - * value into a different coordinate space. - * - * @note On some devices, returned value may be negative or larger than the - * width of the device. See @ref tablet-bounds for more details. - * - * @param event The libinput tablet tool event - * @return The current value of the the axis - */ -double -libinput_event_tablet_tool_get_y(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Return the delta between the last event and the current event. - * If the tool employs pointer acceleration, the delta returned by this - * function is the accelerated delta. - * - * This value is in screen coordinate space, the delta is to be interpreted - * like the return value of libinput_event_pointer_get_dx(). - * See @ref tablet-relative-motion for more details. - * - * @param event The libinput tablet event - * @return The relative x movement since the last event - */ -double -libinput_event_tablet_tool_get_dx(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Return the delta between the last event and the current event. - * If the tool employs pointer acceleration, the delta returned by this - * function is the accelerated delta. - * - * This value is in screen coordinate space, the delta is to be interpreted - * like the return value of libinput_event_pointer_get_dx(). - * See @ref tablet-relative-motion for more details. - * - * @param event The libinput tablet event - * @return The relative y movement since the last event - */ -double -libinput_event_tablet_tool_get_dy(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Returns the current pressure being applied on the tool in use, normalized - * to the range [0, 1]. - * - * If this axis does not exist on the current tool, this function returns 0. - * - * @param event The libinput tablet tool event - * @return The current value of the the axis - */ -double -libinput_event_tablet_tool_get_pressure(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Returns the current distance from the tablet's sensor, normalized to the - * range [0, 1]. - * - * If this axis does not exist on the current tool, this function returns 0. - * - * @param event The libinput tablet tool event - * @return The current value of the the axis - */ -double -libinput_event_tablet_tool_get_distance(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Returns the current tilt along the X axis of the tablet's current logical - * orientation, in degrees off the tablet's z axis. That is, if the tool is - * perfectly orthogonal to the tablet, the tilt angle is 0. When the top - * tilts towards the logical top/left of the tablet, the x/y tilt angles are - * negative, if the top tilts towards the logical bottom/right of the - * tablet, the x/y tilt angles are positive. - * - * If this axis does not exist on the current tool, this function returns 0. - * - * @param event The libinput tablet tool event - * @return The current value of the axis in degrees - */ -double -libinput_event_tablet_tool_get_tilt_x(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Returns the current tilt along the Y axis of the tablet's current logical - * orientation, in degrees off the tablet's z axis. That is, if the tool is - * perfectly orthogonal to the tablet, the tilt angle is 0. When the top - * tilts towards the logical top/left of the tablet, the x/y tilt angles are - * negative, if the top tilts towards the logical bottom/right of the - * tablet, the x/y tilt angles are positive. - * - * If this axis does not exist on the current tool, this function returns 0. - * - * @param event The libinput tablet tool event - * @return The current value of the the axis in degrees - */ -double -libinput_event_tablet_tool_get_tilt_y(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Returns the current z rotation of the tool in degrees, clockwise from the - * tool's logical neutral position. - * - * For tools of type @ref LIBINPUT_TABLET_TOOL_TYPE_MOUSE and @ref - * LIBINPUT_TABLET_TOOL_TYPE_LENS the logical neutral position is - * pointing to the current logical north of the tablet. For tools of type @ref - * LIBINPUT_TABLET_TOOL_TYPE_BRUSH, the logical neutral position is with the - * buttons pointing up. - * - * If this axis does not exist on the current tool, this function returns 0. - * - * @param event The libinput tablet tool event - * @return The current value of the the axis - */ -double -libinput_event_tablet_tool_get_rotation(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Returns the current position of the slider on the tool, normalized to the - * range [-1, 1]. The logical zero is the neutral position of the slider, or - * the logical center of the axis. This axis is available on e.g. the Wacom - * Airbrush. - * - * If this axis does not exist on the current tool, this function returns 0. - * - * @param event The libinput tablet tool event - * @return The current value of the the axis - */ -double -libinput_event_tablet_tool_get_slider_position(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Return the delta for the wheel in degrees. - * - * @param event The libinput tablet tool event - * @return The delta of the wheel, in degrees, compared to the last event - * - * @see libinput_event_tablet_tool_get_wheel_delta_discrete - */ -double -libinput_event_tablet_tool_get_wheel_delta( - struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Return the delta for the wheel in discrete steps (e.g. wheel clicks). - - * @param event The libinput tablet tool event - * @return The delta of the wheel, in discrete steps, compared to the last event - * - * @see libinput_event_tablet_tool_get_wheel_delta_discrete - */ -int -libinput_event_tablet_tool_get_wheel_delta_discrete( - struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Return the current absolute x coordinate of the tablet tool event, - * transformed to screen coordinates. - * - * @note This function may be called for a specific axis even if - * libinput_event_tablet_tool_*_has_changed() returns 0 for that axis. - * libinput always includes all device axes in the event. - * - * @note On some devices, returned value may be negative or larger than the - * width of the device. See @ref tablet-bounds for more details. - * - * @param event The libinput tablet tool event - * @param width The current output screen width - * @return the current absolute x coordinate transformed to a screen coordinate - */ -double -libinput_event_tablet_tool_get_x_transformed(struct libinput_event_tablet_tool *event, - uint32_t width); - -/** - * @ingroup event_tablet - * - * Return the current absolute y coordinate of the tablet tool event, - * transformed to screen coordinates. - * - * @note This function may be called for a specific axis even if - * libinput_event_tablet_tool_*_has_changed() returns 0 for that axis. - * libinput always includes all device axes in the event. - * - * @note On some devices, returned value may be negative or larger than the - * width of the device. See @ref tablet-bounds for more details. - * - * @param event The libinput tablet tool event - * @param height The current output screen height - * @return the current absolute y coordinate transformed to a screen coordinate - */ -double -libinput_event_tablet_tool_get_y_transformed(struct libinput_event_tablet_tool *event, - uint32_t height); - -/** - * @ingroup event_tablet - * - * Returns the tool that was in use during this event. - * - * The returned tablet tool is not refcounted and may become invalid after - * the next call to libinput. Use libinput_tablet_tool_ref() and - * libinput_tablet_tool_unref() to continue using the handle outside of the - * immediate scope. - * - * If the caller holds at least one reference, this struct is used - * whenever the tools enters proximity again. - * - * @note Physical tool tracking requires hardware support. If unavailable, - * libinput creates one tool per type per tablet. See @ref - * tablet-serial-numbers for more details. - * - * @param event The libinput tablet tool event - * @return The new tool triggering this event - */ -struct libinput_tablet_tool * -libinput_event_tablet_tool_get_tool(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Returns the new proximity state of a tool from a proximity event. - * Used to check whether or not a tool came in or out of proximity during an - * event of type @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY. - * - * See @ref tablet-fake-proximity for recommendations on proximity handling. - * - * @param event The libinput tablet tool event - * @return The new proximity state of the tool from the event. - */ -enum libinput_tablet_tool_proximity_state -libinput_event_tablet_tool_get_proximity_state(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Returns the new tip state of a tool from a tip event. - * Used to check whether or not a tool came in contact with the tablet - * surface or left contact with the tablet surface during an - * event of type @ref LIBINPUT_EVENT_TABLET_TOOL_TIP. - * - * @param event The libinput tablet tool event - * @return The new tip state of the tool from the event. - */ -enum libinput_tablet_tool_tip_state -libinput_event_tablet_tool_get_tip_state(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Return the button that triggered this event. For events that are not of - * type @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON, this function returns 0. - * - * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - * - * @param event The libinput tablet tool event - * @return the button triggering this event - */ -uint32_t -libinput_event_tablet_tool_get_button(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Return the button state of the event. - * - * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON. - * - * @param event The libinput tablet tool event - * @return the button state triggering this event - */ -enum libinput_button_state -libinput_event_tablet_tool_get_button_state(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * For the button of a @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON event, return the total - * number of buttons pressed on all devices on the associated seat after the - * the event was triggered. - * - " @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_TABLET_TOOL_BUTTON. For other events, this function returns 0. - * - * @param event The libinput tablet tool event - * @return the seat wide pressed button count for the key of this event - */ -uint32_t -libinput_event_tablet_tool_get_seat_button_count(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. - * - * @param event The libinput tablet tool event - * @return The event time for this event - */ -uint32_t -libinput_event_tablet_tool_get_time(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. - * - * @param event The libinput tablet tool event - * @return The event time for this event in microseconds - */ -uint64_t -libinput_event_tablet_tool_get_time_usec(struct libinput_event_tablet_tool *event); - -/** - * @ingroup event_tablet - * - * Return the tool type for a tool object, see @ref - * tablet-tool-types for details. - * - * @param tool The libinput tool - * @return The tool type for this tool object - * - * @see libinput_tablet_tool_get_tool_id - */ -enum libinput_tablet_tool_type -libinput_tablet_tool_get_type(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Return the tool ID for a tool object. If nonzero, this number identifies - * the specific type of the tool with more precision than the type returned in - * libinput_tablet_tool_get_type(), see @ref tablet-tool-types. Not all - * tablets support a tool ID. - * - * Tablets known to support tool IDs include the Wacom Intuos 3, 4, 5, Wacom - * Cintiq and Wacom Intuos Pro series. - * - * @param tool The libinput tool - * @return The tool ID for this tool object or 0 if none is provided - * - * @see libinput_tablet_tool_get_type - */ -uint64_t -libinput_tablet_tool_get_tool_id(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Increment the reference count of the tool by one. A tool is destroyed - * whenever the reference count reaches 0. See libinput_tablet_tool_unref(). - * - * @param tool The tool to increment the ref count of - * @return The passed tool - * - * @see libinput_tablet_tool_unref - */ -struct libinput_tablet_tool * -libinput_tablet_tool_ref(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Decrement the reference count of the tool by one. When the reference - * count of the tool reaches 0, the memory allocated for the tool will be - * freed. - * - * @param tool The tool to decrement the ref count of - * @return NULL if the tool was destroyed otherwise the passed tool - * - * @see libinput_tablet_tool_ref - */ -struct libinput_tablet_tool * -libinput_tablet_tool_unref(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Return whether the tablet tool supports pressure. - * - * @param tool The tool to check the axis capabilities of - * @return Nonzero if the axis is available, zero otherwise. - */ -int -libinput_tablet_tool_has_pressure(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Return whether the tablet tool supports distance. - * - * @param tool The tool to check the axis capabilities of - * @return Nonzero if the axis is available, zero otherwise. - */ -int -libinput_tablet_tool_has_distance(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Return whether the tablet tool supports tilt. - * - * @param tool The tool to check the axis capabilities of - * @return Nonzero if the axis is available, zero otherwise. - */ -int -libinput_tablet_tool_has_tilt(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Return whether the tablet tool supports z-rotation. - * - * @param tool The tool to check the axis capabilities of - * @return Nonzero if the axis is available, zero otherwise. - */ -int -libinput_tablet_tool_has_rotation(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Return whether the tablet tool has a slider axis. - * - * @param tool The tool to check the axis capabilities of - * @return Nonzero if the axis is available, zero otherwise. - */ -int -libinput_tablet_tool_has_slider(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Return whether the tablet tool has a relative wheel. - * - * @param tool The tool to check the axis capabilities of - * @return Nonzero if the axis is available, zero otherwise. - */ -int -libinput_tablet_tool_has_wheel(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Check if a tablet tool has a button with the - * passed-in code (see linux/input.h). - * - * @param tool A tablet tool - * @param code button code to check for - * - * @return 1 if the tool supports this button code, 0 if it does not - */ -int -libinput_tablet_tool_has_button(struct libinput_tablet_tool *tool, - uint32_t code); - -/** - * @ingroup event_tablet - * - * Return nonzero if the physical tool can be uniquely identified by - * libinput, or nonzero otherwise. If a tool can be uniquely identified, - * keeping a reference to the tool allows tracking the tool across - * proximity out sequences and across compatible tablets. - * See @ref tablet-serial-numbers for more details. - * - * @param tool A tablet tool - * @return 1 if the tool can be uniquely identified, 0 otherwise. - * - * @see libinput_tablet_tool_get_serial - */ -int -libinput_tablet_tool_is_unique(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Return the serial number of a tool. If the tool does not report a serial - * number, this function returns zero. See @ref tablet-serial-numbers for - * details. - * - * @param tool The libinput tool - * @return The tool serial number - * - * @see libinput_tablet_tool_is_unique - */ -uint64_t -libinput_tablet_tool_get_serial(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Return the user data associated with a tool object. libinput does - * not manage, look at, or modify this data. The caller must ensure the - * data is valid. - * - * @param tool The libinput tool - * @return The user data associated with the tool object - */ -void * -libinput_tablet_tool_get_user_data(struct libinput_tablet_tool *tool); - -/** - * @ingroup event_tablet - * - * Set the user data associated with a tool object, if any. - * - * @param tool The libinput tool - * @param user_data The user data to associate with the tool object - */ -void -libinput_tablet_tool_set_user_data(struct libinput_tablet_tool *tool, - void *user_data); - -/** - * @defgroup event_tablet_pad Tablet pad events - * - * Events that come from the pad of tablet devices. For events from the - * tablet tools, see @ref event_tablet. - */ - -/** - * @ingroup event_tablet_pad - * - * @return The generic libinput_event of this event - */ -struct libinput_event * -libinput_event_tablet_pad_get_base_event(struct libinput_event_tablet_pad *event); - -/** - * @ingroup event_tablet_pad - * - * Returns the current position of the ring, in degrees counterclockwise - * from the northern-most point of the ring in the tablet's current logical - * orientation. - * - * If the source is @ref LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER, - * libinput sends a terminating event with a ring value of -1 when the - * finger is lifted from the ring. A caller may use this information to e.g. - * determine if kinetic scrolling should be triggered. - * - * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_TABLET_PAD_RING. For other events, this function - * returns 0. - * - * @param event The libinput tablet pad event - * @return The current value of the the axis - * @retval -1 The finger was lifted - */ -double -libinput_event_tablet_pad_get_ring_position(struct libinput_event_tablet_pad *event); - -/** - * @ingroup event_tablet_pad - * - * Returns the number of the ring that has changed state, with 0 being the - * first ring. On tablets with only one ring, this function always returns - * 0. - * - * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_TABLET_PAD_RING. For other events, this function - * returns 0. - * - * @param event The libinput tablet pad event - * @return The index of the ring that changed state - */ -unsigned int -libinput_event_tablet_pad_get_ring_number(struct libinput_event_tablet_pad *event); - -/** - * @ingroup event_tablet_pad - * - * Returns the source of the interaction with the ring. If the source is - * @ref LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER, libinput sends a ring - * position value of -1 to terminate the current interaction. - * - * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_TABLET_PAD_RING. For other events, this function - * returns 0. - * - * @param event The libinput tablet pad event - * @return The source of the ring interaction - */ -enum libinput_tablet_pad_ring_axis_source -libinput_event_tablet_pad_get_ring_source(struct libinput_event_tablet_pad *event); - -/** - * @ingroup event_tablet_pad - * - * Returns the current position of the strip, normalized to the range - * [0, 1], with 0 being the top/left-most point in the tablet's current - * logical orientation. - * - * If the source is @ref LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER, - * libinput sends a terminating event with a ring value of -1 when the - * finger is lifted from the ring. A caller may use this information to e.g. - * determine if kinetic scrolling should be triggered. - * - * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_TABLET_PAD_STRIP. For other events, this function - * returns 0. - * - * @param event The libinput tablet pad event - * @return The current value of the the axis - * @retval -1 The finger was lifted - */ -double -libinput_event_tablet_pad_get_strip_position(struct libinput_event_tablet_pad *event); - -/** - * @ingroup event_tablet_pad - * - * Returns the number of the strip that has changed state, with 0 being the - * first strip. On tablets with only one strip, this function always returns - * 0. - * - * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_TABLET_PAD_STRIP. For other events, this function - * returns 0. - * - * @param event The libinput tablet pad event - * @return The index of the strip that changed state - */ -unsigned int -libinput_event_tablet_pad_get_strip_number(struct libinput_event_tablet_pad *event); - -/** - * @ingroup event_tablet_pad - * - * Returns the source of the interaction with the strip. If the source is - * @ref LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER, libinput sends a strip - * position value of -1 to terminate the current interaction. - * - * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_TABLET_PAD_STRIP. For other events, this function - * returns 0. - * - * @param event The libinput tablet pad event - * @return The source of the strip interaction - */ -enum libinput_tablet_pad_strip_axis_source -libinput_event_tablet_pad_get_strip_source(struct libinput_event_tablet_pad *event); - -/** - * @ingroup event_tablet_pad - * - * Return the button number that triggered this event, starting at 0. - * For events that are not of type @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON, - * this function returns 0. - * - * Note that the number returned is a generic sequential button number and - * not a semantic button code as defined in linux/input.h. - * See @ref tablet-pad-buttons for more details. - * - * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON. For other events, this function - * returns 0. - * - * @param event The libinput tablet pad event - * @return the button triggering this event - */ -uint32_t -libinput_event_tablet_pad_get_button_number(struct libinput_event_tablet_pad *event); - -/** - * @ingroup event_tablet_pad - * - * Return the button state of the event. - * - * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_TABLET_PAD_BUTTON. For other events, this function - * returns 0. - * - * @param event The libinput tablet pad event - * @return the button state triggering this event - */ -enum libinput_button_state -libinput_event_tablet_pad_get_button_state(struct libinput_event_tablet_pad *event); - -/** - * @ingroup event_tablet_pad - * - * Returns the mode the button, ring, or strip that triggered this event is - * in, at the time of the event. - * - * The mode is a virtual grouping of functionality, usually based on some - * visual feedback like LEDs on the pad. See @ref tablet-pad-modes for - * details. Mode indices start at 0, a device that does not support modes - * always returns 0. - * - * Mode switching is controlled by libinput and more than one mode may exist - * on the tablet. This function returns the mode that this event's button, - * ring or strip is logically in. If the button is a mode toggle button - * and the button event caused a new mode to be toggled, the mode returned - * is the new mode the button is in. - * - * Note that the returned mode is the mode valid as of the time of the - * event. The returned mode may thus be different to the mode returned by - * libinput_tablet_pad_mode_group_get_mode(). See - * libinput_tablet_pad_mode_group_get_mode() for details. - * - * @param event The libinput tablet pad event - * @return the 0-indexed mode of this button, ring or strip at the time of - * the event - * - * @see libinput_tablet_pad_mode_group_get_mode - */ -unsigned int -libinput_event_tablet_pad_get_mode(struct libinput_event_tablet_pad *event); - -/** - * @ingroup event_tablet_pad - * - * Returns the mode group that the button, ring, or strip that triggered - * this event is considered in. The mode is a virtual grouping of - * functionality, usually based on some visual feedback like LEDs on the - * pad. See @ref tablet-pad-modes for details. - * - * The returned mode group is not refcounted and may become invalid after - * the next call to libinput. Use libinput_tablet_pad_mode_group_ref() and - * libinput_tablet_pad_mode_group_unref() to continue using the handle - * outside of the immediate scope. - * - * @param event The libinput tablet pad event - * @return the mode group of the button, ring or strip that caused this event - * - * @see libinput_device_tablet_pad_get_mode_group - */ -struct libinput_tablet_pad_mode_group * -libinput_event_tablet_pad_get_mode_group(struct libinput_event_tablet_pad *event); - -/** - * @ingroup event_tablet_pad - * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. - * - * @param event The libinput tablet pad event - * @return The event time for this event - */ -uint32_t -libinput_event_tablet_pad_get_time(struct libinput_event_tablet_pad *event); - -/** - * @ingroup event_tablet_pad - * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. - * - * @param event The libinput tablet pad event - * @return The event time for this event in microseconds - */ -uint64_t -libinput_event_tablet_pad_get_time_usec(struct libinput_event_tablet_pad *event); - -/** - * @defgroup event_switch Switch events - * - * Events that come from switch devices. - */ - -/** - * @ingroup event_switch - * - * Return the switch that triggered this event. - * For pointer events that are not of type @ref - * LIBINPUT_EVENT_SWITCH_TOGGLE, this function returns 0. - * - * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_SWITCH_TOGGLE. - * - * @param event The libinput switch event - * @return The switch triggering this event - */ -enum libinput_switch -libinput_event_switch_get_switch(struct libinput_event_switch *event); - -/** - * @ingroup event_switch - * - * Return the switch state that triggered this event. - * For switch events that are not of type @ref - * LIBINPUT_EVENT_SWITCH_TOGGLE, this function returns 0. - * - * @note It is an application bug to call this function for events other than - * @ref LIBINPUT_EVENT_SWITCH_TOGGLE. - * - * @param event The libinput switch event - * @return The switch state triggering this event - */ -enum libinput_switch_state -libinput_event_switch_get_switch_state(struct libinput_event_switch *event); - -/** - * @ingroup event_switch + * @ref LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, @ref + * LIBINPUT_EVENT_GESTURE_PINCH_END or + * @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE. * - * @return The generic libinput_event of this event + * @return the absolute scale of a pinch gesture */ -struct libinput_event * -libinput_event_switch_get_base_event(struct libinput_event_switch *event); +double +libinput_event_gesture_get_scale(struct libinput_event_gesture *event); /** - * @ingroup event_switch + * @ingroup event_gesture * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. + * Return the angle delta in degrees between the last and the current @ref + * LIBINPUT_EVENT_GESTURE_PINCH_UPDATE event. For gesture events that + * are not of type @ref LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, this + * function returns 0. * - * @param event The libinput switch event - * @return The event time for this event - */ -uint32_t -libinput_event_switch_get_time(struct libinput_event_switch *event); - -/** - * @ingroup event_switch + * The angle delta is defined as the change in angle of the line formed by + * the 2 fingers of a pinch gesture. Clockwise rotation is represented + * by a postive delta, counter-clockwise by a negative delta. If e.g. the + * fingers are on the 12 and 6 location of a clock face plate and they move + * to the 1 resp. 7 location in a single event then the angle delta is + * 30 degrees. * - * @note Timestamps may not always increase. See @ref event_timestamps for - * details. + * If more than two fingers are present, the angle represents the rotation + * around the center of gravity. The calculation of the center of gravity is + * implementation-dependent. * - * @param event The libinput switch event - * @return The event time for this event in microseconds + * @return the angle delta since the last event */ -uint64_t -libinput_event_switch_get_time_usec(struct libinput_event_switch *event); +double +libinput_event_gesture_get_angle_delta(struct libinput_event_gesture *event); /** * @defgroup base Initialization and manipulation of libinput contexts @@ -3076,7 +1368,7 @@ * * @param libinput A previously initialized libinput context * @return The event type of the next available event or @ref - * LIBINPUT_EVENT_NONE if no event is available. + * LIBINPUT_EVENT_NONE if no event is availble. */ enum libinput_event_type libinput_next_event_type(struct libinput *libinput); @@ -3153,27 +1445,6 @@ * destroyed, if the last reference was dereferenced. If so, the context is * invalid and may not be interacted with. * - * @bug When the refcount reaches zero, libinput_unref() releases resources - * even if a caller still holds refcounted references to related resources - * (e.g. a libinput_device). When libinput_unref() returns - * NULL, the caller must consider any resources related to that context - * invalid. See https://bugs.freedesktop.org/show_bug.cgi?id=91872. - * - * Example code: - * @code - * li = libinput_path_create_context(&interface, NULL); - * device = libinput_path_add_device(li, "/dev/input/event0"); - * // get extra reference to device - * libinput_device_ref(device); - * - * // refcount reaches 0, so *all* resources are cleaned up, - * // including device - * libinput_unref(li); - * - * // INCORRECT: device has been cleaned up and must not be used - * // li = libinput_device_get_context(device); - * @endcode - * * @param libinput A previously initialized libinput context * @return NULL if context was destroyed otherwise the passed context */ @@ -3551,14 +1822,6 @@ * beyond the boundaries of this output. An absolute device has its input * coordinates mapped to the extents of this output. * - * @note Use of this function is discouraged. Its return value is not - * precisely defined and may not be understood by the caller or may be - * insufficient to map the device. Instead, the system configuration could - * set a udev property the caller understands and interprets correctly. The - * caller could then obtain device with libinput_device_get_udev_device() - * and query it for this property. For more complex cases, the caller - * must implement monitor-to-device association heuristics. - * * @return The name of the output this device is mapped to, or NULL if no * output is set */ @@ -3576,11 +1839,6 @@ * seat name pair at any given time, but if no external reference is kept, it * may be destroyed if no device belonging to it is left. * - * The returned seat is not refcounted and may become invalid after - * the next call to libinput. Use libinput_seat_ref() and - * libinput_seat_unref() to continue using the handle outside of the - * immediate scope. - * * @param device A previously obtained device * @return The seat this input device belongs to */ @@ -3594,7 +1852,7 @@ * device and adding it to the new seat. * * This command is identical to physically unplugging the device, then - * re-plugging it as a member of the new seat. libinput will generate a + * re-plugging it as member of the new seat. libinput will generate a * @ref LIBINPUT_EVENT_DEVICE_REMOVED event and this @ref libinput_device is * considered removed from the context; it will not generate further events * and will be freed when the refcount reaches zero. @@ -3716,67 +1974,6 @@ /** * @ingroup device * - * Check if a @ref LIBINPUT_DEVICE_CAP_SWITCH device has a switch of the - * given type. - * - * @param device A current input device - * @param sw Switch to check for - * - * @return 1 if the device supports this switch, 0 if it does not, -1 - * on error. - */ -int -libinput_device_switch_has_switch(struct libinput_device *device, - enum libinput_switch sw); - -/** - * @ingroup device - * - * Return the number of buttons on a device with the - * @ref LIBINPUT_DEVICE_CAP_TABLET_PAD capability. - * Buttons on a pad device are numbered sequentially, see @ref - * tablet-pad-buttons for details. - * - * @param device A current input device - * - * @return The number of buttons supported by the device. - */ -int -libinput_device_tablet_pad_get_num_buttons(struct libinput_device *device); - -/** - * @ingroup device - * - * Return the number of rings a device with the @ref - * LIBINPUT_DEVICE_CAP_TABLET_PAD capability provides. - * - * @param device A current input device - * - * @return The number of rings or 0 if the device has no rings. - * - * @see libinput_event_tablet_pad_get_ring_number - */ -int -libinput_device_tablet_pad_get_num_rings(struct libinput_device *device); - -/** - * @ingroup device - * - * Return the number of strips a device with the @ref - * LIBINPUT_DEVICE_CAP_TABLET_PAD capability provides. - * - * @param device A current input device - * - * @return The number of strips or 0 if the device has no strips. - * - * @see libinput_event_tablet_pad_get_strip_number - */ -int -libinput_device_tablet_pad_get_num_strips(struct libinput_device *device); - -/** - * @ingroup device - * * Increase the refcount of the device group. A device group will be freed * whenever the refcount reaches 0. This may happen during * libinput_dispatch() if all devices of this group were removed from the @@ -3841,37 +2038,10 @@ * configuration. This default can be obtained with the respective * get_default call. * - * Configuration options are device dependent and not all options are - * supported on all devices. For all configuration options, libinput - * provides a call to check if a configuration option is available on a - * device (e.g. libinput_device_config_calibration_has_matrix()) - * * Some configuration option may be dependent on or mutually exclusive with * with other options. The behavior in those cases is * implementation-dependent, the caller must ensure that the options are set * in the right order. - * - * Below is a general grouping of configuration options according to device - * type. Note that this is a guide only and not indicative of any specific - * device. - * - Touchpad: - * - libinput_device_config_tap_set_enabled() - * - libinput_device_config_tap_set_drag_enabled() - * - libinput_device_config_tap_set_drag_lock_enabled() - * - libinput_device_config_click_set_method() - * - libinput_device_config_scroll_set_method() - * - libinput_device_config_dwt_set_enabled() - * - Touchscreens: - * - libinput_device_config_calibration_set_matrix() - * - Pointer devices (mice, trackballs, touchpads): - * - libinput_device_config_accel_set_speed() - * - libinput_device_config_accel_set_profile() - * - libinput_device_config_scroll_set_natural_scroll_enabled() - * - libinput_device_config_left_handed_set() - * - libinput_device_config_middle_emulation_set_enabled() - * - libinput_device_config_rotation_set_angle() - * - All devices: - * - libinput_device_config_send_events_set_mode() */ /** @@ -3989,161 +2159,6 @@ /** * @ingroup config */ -enum libinput_config_tap_button_map { - /** 1/2/3 finger tap maps to left/right/middle */ - LIBINPUT_CONFIG_TAP_MAP_LRM, - /** 1/2/3 finger tap maps to left/middle/right*/ - LIBINPUT_CONFIG_TAP_MAP_LMR, -}; - -/** - * @ingroup config - * - * Set the finger number to button number mapping for tap-to-click. The - * default mapping on most devices is to have a 1, 2 and 3 finger tap to map - * to the left, right and middle button, respectively. - * A device may permit changing the button mapping but disallow specific - * maps. In this case @ref LIBINPUT_CONFIG_STATUS_UNSUPPORTED is returned, - * the caller is expected to handle this case correctly. - * - * Changing the button mapping may not take effect immediately, - * the device may wait until it is in a neutral state before applying any - * changes. - * - * The mapping may be changed when tap-to-click is disabled. The new mapping - * takes effect when tap-to-click is enabled in the future. - * - * @note It is an application bug to call this function for devices where - * libinput_device_config_tap_get_finger_count() returns 0. - * - * @param device The device to configure - * @param map The new finger-to-button number mapping - * @return A config status code. Changing the order on a device that does not - * support tapping always fails with @ref LIBINPUT_CONFIG_STATUS_UNSUPPORTED. - * - * @see libinput_device_config_tap_get_button_map - * @see libinput_device_config_tap_get_default_button_map - */ -enum libinput_config_status -libinput_device_config_tap_set_button_map(struct libinput_device *device, - enum libinput_config_tap_button_map map); - -/** - * @ingroup config - * - * Get the finger number to button number mapping for tap-to-click. - * - * The return value for a device that does not support tapping is always - * @ref LIBINPUT_CONFIG_TAP_MAP_LRM. - * - * @note It is an application bug to call this function for devices where - * libinput_device_config_tap_get_finger_count() returns 0. - * - * @param device The device to configure - * @return The current finger-to-button number mapping - * - * @see libinput_device_config_tap_set_button_map - * @see libinput_device_config_tap_get_default_button_map - */ -enum libinput_config_tap_button_map -libinput_device_config_tap_get_button_map(struct libinput_device *device); - -/** - * @ingroup config - * - * Get the default finger number to button number mapping for tap-to-click. - * - * The return value for a device that does not support tapping is always - * @ref LIBINPUT_CONFIG_TAP_MAP_LRM. - * - * @note It is an application bug to call this function for devices where - * libinput_device_config_tap_get_finger_count() returns 0. - * - * @param device The device to configure - * @return The current finger-to-button number mapping - * - * @see libinput_device_config_tap_set_button_map - * @see libinput_device_config_tap_get_default_button_map - */ -enum libinput_config_tap_button_map -libinput_device_config_tap_get_default_button_map(struct libinput_device *device); - -/** - * @ingroup config - * - * A config status to distinguish or set dragging on a device. Currently - * implemented for tap-and-drag only, see - * libinput_device_config_tap_set_drag_enabled() - */ -enum libinput_config_drag_state { - /** - * Drag is to be disabled, or is - * currently disabled. - */ - LIBINPUT_CONFIG_DRAG_DISABLED, - /** - * Drag is to be enabled, or is - * currently enabled - */ - LIBINPUT_CONFIG_DRAG_ENABLED, -}; - -/** - * @ingroup config - * - * Enable or disable tap-and-drag on this device. When enabled, a - * single-finger tap immediately followed by a finger down results in a - * button down event, subsequent finger motion thus triggers a drag. The - * button is released on finger up. See @ref tapndrag for more details. - * - * @param device The device to configure - * @param enable @ref LIBINPUT_CONFIG_DRAG_ENABLED to enable, @ref - * LIBINPUT_CONFIG_DRAG_DISABLED to disable tap-and-drag - * - * @see libinput_device_config_tap_drag_get_enabled - * @see libinput_device_config_tap_drag_get_default_enabled - */ -enum libinput_config_status -libinput_device_config_tap_set_drag_enabled(struct libinput_device *device, - enum libinput_config_drag_state enable); - -/** - * @ingroup config - * - * Return whether tap-and-drag is enabled or disabled on this device. - * - * @param device The device to check - * @retval LIBINPUT_CONFIG_DRAG_ENABLED if tap-and-drag is enabled - * @retval LIBINPUT_CONFIG_DRAG_DISABLED if tap-and-drag is - * disabled - * - * @see libinput_device_config_tap_drag_set_enabled - * @see libinput_device_config_tap_drag_get_default_enabled - */ -enum libinput_config_drag_state -libinput_device_config_tap_get_drag_enabled(struct libinput_device *device); - -/** - * @ingroup config - * - * Return whether tap-and-drag is enabled or disabled by default on this - * device. - * - * @param device The device to check - * @retval LIBINPUT_CONFIG_DRAG_ENABLED if tap-and-drag is enabled by - * default - * @retval LIBINPUT_CONFIG_DRAG_DISABLED if tap-and-drag is - * disabled by default - * - * @see libinput_device_config_tap_drag_set_enabled - * @see libinput_device_config_tap_drag_get_enabled - */ -enum libinput_config_drag_state -libinput_device_config_tap_get_default_drag_enabled(struct libinput_device *device); - -/** - * @ingroup config - */ enum libinput_config_drag_lock_state { /** Drag lock is to be disabled, or is currently disabled */ LIBINPUT_CONFIG_DRAG_LOCK_DISABLED, @@ -4332,8 +2347,6 @@ float matrix[6]); /** - * @ingroup config - * * The send-event mode of a device defines when a device may generate events * and pass those events to the caller. */ @@ -4461,10 +2474,6 @@ * @param device The device to configure * * @return 0 if the device is not accelerated, nonzero if it is accelerated - * - * @see libinput_device_config_accel_set_speed - * @see libinput_device_config_accel_get_speed - * @see libinput_device_config_accel_get_default_speed */ int libinput_device_config_accel_is_available(struct libinput_device *device); @@ -4484,10 +2493,6 @@ * @param speed The normalized speed, in a range of [-1, 1] * * @return A config status code - * - * @see libinput_device_config_accel_is_available - * @see libinput_device_config_accel_get_speed - * @see libinput_device_config_accel_get_default_speed */ enum libinput_config_status libinput_device_config_accel_set_speed(struct libinput_device *device, @@ -4503,10 +2508,6 @@ * @param device The device to configure * * @return The current speed, range -1 to 1 - * - * @see libinput_device_config_accel_is_available - * @see libinput_device_config_accel_set_speed - * @see libinput_device_config_accel_get_default_speed */ double libinput_device_config_accel_get_speed(struct libinput_device *device); @@ -4520,93 +2521,12 @@ * * @param device The device to configure * @return The default speed setting for this device. - * - * @see libinput_device_config_accel_is_available - * @see libinput_device_config_accel_set_speed - * @see libinput_device_config_accel_get_speed */ double libinput_device_config_accel_get_default_speed(struct libinput_device *device); /** * @ingroup config - */ -enum libinput_config_accel_profile { - /** - * Placeholder for devices that don't have a configurable pointer - * acceleration profile. - */ - LIBINPUT_CONFIG_ACCEL_PROFILE_NONE = 0, - /** - * A flat acceleration profile. Pointer motion is accelerated by a - * constant (device-specific) factor, depending on the current - * speed. - * - * @see libinput_device_config_accel_set_speed - */ - LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT = (1 << 0), - - /** - * An adaptive acceleration profile. Pointer acceleration depends - * on the input speed. This is the default profile for most devices. - */ - LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE = (1 << 1), -}; - -/** - * @ingroup config - * - * Returns a bitmask of the configurable acceleration modes available on - * this device. - * - * @param device The device to configure - * - * @return A bitmask of all configurable modes available on this device. - */ -uint32_t -libinput_device_config_accel_get_profiles(struct libinput_device *device); - -/** - * @ingroup config - * - * Set the pointer acceleration profile of this pointer device to the given - * mode. - * - * @param device The device to configure - * @param mode The mode to set the device to. - * - * @return A config status code - */ -enum libinput_config_status -libinput_device_config_accel_set_profile(struct libinput_device *device, - enum libinput_config_accel_profile mode); - -/** - * @ingroup config - * - * Get the current pointer acceleration profile for this pointer device. - * - * @param device The device to configure - * - * @return The currently configured pointer acceleration profile. - */ -enum libinput_config_accel_profile -libinput_device_config_accel_get_profile(struct libinput_device *device); - -/** - * @ingroup config - * - * Return the default pointer acceleration profile for this pointer device. - * - * @param device The device to configure - * - * @return The default acceleration profile for this device. - */ -enum libinput_config_accel_profile -libinput_device_config_accel_get_default_profile(struct libinput_device *device); - -/** - * @ingroup config * * Return non-zero if the device supports "natural scrolling". * @@ -4630,9 +2550,9 @@ * @return Zero if natural scrolling is not supported, non-zero if natural * scrolling is supported by this device * - * @see libinput_device_config_scroll_set_natural_scroll_enabled - * @see libinput_device_config_scroll_get_natural_scroll_enabled - * @see libinput_device_config_scroll_get_default_natural_scroll_enabled + * @see libinput_device_config_set_natural_scroll_enabled + * @see libinput_device_config_get_natural_scroll_enabled + * @see libinput_device_config_get_default_natural_scroll_enabled */ int libinput_device_config_scroll_has_natural_scroll(struct libinput_device *device); @@ -4647,9 +2567,9 @@ * * @return A config status code * - * @see libinput_device_config_scroll_has_natural_scroll - * @see libinput_device_config_scroll_get_natural_scroll_enabled - * @see libinput_device_config_scroll_get_default_natural_scroll_enabled + * @see libinput_device_config_has_natural_scroll + * @see libinput_device_config_get_natural_scroll_enabled + * @see libinput_device_config_get_default_natural_scroll_enabled */ enum libinput_config_status libinput_device_config_scroll_set_natural_scroll_enabled(struct libinput_device *device, @@ -4663,9 +2583,9 @@ * * @return Zero if natural scrolling is disabled, non-zero if enabled * - * @see libinput_device_config_scroll_has_natural_scroll - * @see libinput_device_config_scroll_set_natural_scroll_enabled - * @see libinput_device_config_scroll_get_default_natural_scroll_enabled + * @see libinput_device_config_has_natural_scroll + * @see libinput_device_config_set_natural_scroll_enabled + * @see libinput_device_config_get_default_natural_scroll_enabled */ int libinput_device_config_scroll_get_natural_scroll_enabled(struct libinput_device *device); @@ -4679,9 +2599,9 @@ * * @return Zero if natural scrolling is disabled by default, non-zero if enabled * - * @see libinput_device_config_scroll_has_natural_scroll - * @see libinput_device_config_scroll_set_natural_scroll_enabled - * @see libinput_device_config_scroll_get_natural_scroll_enabled + * @see libinput_device_config_has_natural_scroll + * @see libinput_device_config_set_natural_scroll_enabled + * @see libinput_device_config_get_natural_scroll_enabled */ int libinput_device_config_scroll_get_default_natural_scroll_enabled(struct libinput_device *device); @@ -4882,7 +2802,8 @@ * @ingroup config * * Check if middle mouse button emulation configuration is available on this - * device. See @ref middle_button_emulation for details. + * device. See libinput_device_config_middle_emulation_set_enabled() for + * details. * * @note Some devices provide middle mouse button emulation but do not allow * enabling/disabling that emulation. These devices return zero in @@ -4909,7 +2830,15 @@ * button event. Releasing the buttons generates a middle mouse button * release, the left and right button events are discarded otherwise. * - * See @ref middle_button_emulation for details. + * The middle button release event may be generated when either button is + * released, or when both buttons have been released. The exact behavior is + * device-dependent. + * + * The middle button emulation behavior when combined with other device + * buttons, including a physical middle button is device-dependent. + * + * @note Some devices provide middle mouse button emulation but do not allow + * enabling/disabling that emulation. * * @param device The device to configure * @param enable @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED to @@ -4932,8 +2861,6 @@ * @ingroup config * * Check if configurable middle button emulation is enabled on this device. - * See @ref middle_button_emulation for details. - * * If the device does not have configurable middle button emulation, this * function returns @ref LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED. * @@ -4958,9 +2885,7 @@ * @ingroup config * * Check if configurable middle button emulation is enabled by default on - * this device. See @ref middle_button_emulation for details. - * - * If the device does not have configurable middle button + * this device. If the device does not have configurable middle button * emulation, this function returns @ref * LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED. * @@ -5200,7 +3125,7 @@ * @ingroup config * * Check if this device supports configurable disable-while-typing feature. - * This feature is usually available on built-in touchpads and disables the + * This feature is usally available on built-in touchpads and disables the * touchpad while typing. See @ref disable-while-typing for details. * * @param device The device to configure @@ -5275,89 +3200,6 @@ enum libinput_config_dwt_state libinput_device_config_dwt_get_default_enabled(struct libinput_device *device); -/** - * @ingroup config - * - * Check whether a device can have a custom rotation applied. - * - * @param device The device to configure - * @return Non-zero if a device can be rotated, zero otherwise. - * - * @see libinput_device_config_rotation_set_angle - * @see libinput_device_config_rotation_get_angle - * @see libinput_device_config_rotation_get_default_angle - */ -int -libinput_device_config_rotation_is_available(struct libinput_device *device); - -/** - * @ingroup config - * - * Set the rotation of a device in degrees clockwise off the logical neutral - * position. Any subsequent motion events are adjusted according to the - * given angle. - * - * The angle has to be in the range of [0, 360[ degrees, otherwise this - * function returns LIBINPUT_CONFIG_STATUS_INVALID. If the angle is a - * multiple of 360 or negative, the caller must ensure the correct ranging - * before calling this function. - * - * libinput guarantees that this function accepts multiples of 90 degrees. - * If a value is within the [0, 360[ range but not a multiple of 90 degrees, - * this function may return LIBINPUT_CONFIG_STATUS_INVALID if the underlying - * device or implementation does not support finer-grained rotation angles. - * - * The rotation angle is applied to all motion events emitted by the device. - * Thus, rotating the device also changes the angle required or presented by - * scrolling, gestures, etc. - * - * @param device The device to configure - * @param degrees_cw The angle in degrees clockwise - * @return A config status code. Setting a rotation of 0 degrees on a - * device that does not support rotation always succeeds. - * - * @see libinput_device_config_rotation_is_available - * @see libinput_device_config_rotation_get_angle - * @see libinput_device_config_rotation_get_default_angle - */ -enum libinput_config_status -libinput_device_config_rotation_set_angle(struct libinput_device *device, - unsigned int degrees_cw); - -/** - * @ingroup config - * - * Get the current rotation of a device in degrees clockwise off the logical - * neutral position. If this device does not support rotation, the return - * value is always 0. - * - * @param device The device to configure - * @return The angle in degrees clockwise - * - * @see libinput_device_config_rotation_is_available - * @see libinput_device_config_rotation_set_angle - * @see libinput_device_config_rotation_get_default_angle - */ -unsigned int -libinput_device_config_rotation_get_angle(struct libinput_device *device); - -/** - * @ingroup config - * - * Get the default rotation of a device in degrees clockwise off the logical - * neutral position. If this device does not support rotation, the return - * value is always 0. - * - * @param device The device to configure - * @return The default angle in degrees clockwise - * - * @see libinput_device_config_rotation_is_available - * @see libinput_device_config_rotation_set_angle - * @see libinput_device_config_rotation_get_angle - */ -unsigned int -libinput_device_config_rotation_get_default_angle(struct libinput_device *device); - #ifdef __cplusplus } #endif diff -Nru libinput-1.10.3/src/libinput-private.h libinput-0.21.0/src/libinput-private.h --- libinput-1.10.3/src/libinput-private.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/libinput-private.h 2015-08-03 04:55:20.000000000 +0000 @@ -25,23 +25,13 @@ #ifndef LIBINPUT_PRIVATE_H #define LIBINPUT_PRIVATE_H -#include "config.h" - #include #include -#include #include "linux/input.h" #include "libinput.h" #include "libinput-util.h" -#include "libinput-version.h" - -#if LIBINPUT_VERSION_MICRO >= 90 -#define HTTP_DOC_LINK "https://wayland.freedesktop.org/libinput/doc/latest/" -#else -#define HTTP_DOC_LINK "https://wayland.freedesktop.org/libinput/doc/" LIBINPUT_VERSION "/" -#endif struct libinput_source; @@ -68,38 +58,6 @@ int x, y; }; -/* A pair of coordinates normalized to a [0,1] or [-1, 1] range */ -struct normalized_range_coords { - double x, y; -}; - -/* A pair of angles in degrees */ -struct wheel_angle { - double x, y; -}; - -/* A pair of angles in degrees */ -struct tilt_degrees { - double x, y; -}; - -/* A threshold with an upper and lower limit */ -struct threshold { - int upper; - int lower; -}; - -/* A pair of coordinates in mm */ -struct phys_coords { - double x; - double y; -}; - -/* A pair of tilt flags */ -struct wheel_tilt_flags { - bool vertical, horizontal; -}; - struct libinput_interface_backend { int (*resume)(struct libinput *libinput); void (*suspend)(struct libinput *libinput); @@ -118,7 +76,6 @@ struct list list; struct libinput_source *source; int fd; - uint64_t next_expiry; } timer; struct libinput_event **events; @@ -127,8 +84,6 @@ size_t events_in; size_t events_out; - struct list tool_list; - const struct libinput_interface *interface; const struct libinput_interface_backend *interface_backend; @@ -136,10 +91,6 @@ enum libinput_log_priority log_priority; void *user_data; int refcount; - - struct list device_group_list; - - uint64_t last_event_time; }; typedef void (*libinput_seat_destroy_func) (struct libinput_seat *seat); @@ -167,16 +118,6 @@ enum libinput_config_tap_state (*get_enabled)(struct libinput_device *device); enum libinput_config_tap_state (*get_default)(struct libinput_device *device); - enum libinput_config_status (*set_map)(struct libinput_device *device, - enum libinput_config_tap_button_map map); - enum libinput_config_tap_button_map (*get_map)(struct libinput_device *device); - enum libinput_config_tap_button_map (*get_default_map)(struct libinput_device *device); - - enum libinput_config_status (*set_drag_enabled)(struct libinput_device *device, - enum libinput_config_drag_state); - enum libinput_config_drag_state (*get_drag_enabled)(struct libinput_device *device); - enum libinput_config_drag_state (*get_default_drag_enabled)(struct libinput_device *device); - enum libinput_config_status (*set_draglock_enabled)(struct libinput_device *device, enum libinput_config_drag_lock_state); enum libinput_config_drag_lock_state (*get_draglock_enabled)(struct libinput_device *device); @@ -207,12 +148,6 @@ double speed); double (*get_speed)(struct libinput_device *device); double (*get_default_speed)(struct libinput_device *device); - - uint32_t (*get_profiles)(struct libinput_device *device); - enum libinput_config_status (*set_profile)(struct libinput_device *device, - enum libinput_config_accel_profile); - enum libinput_config_accel_profile (*get_profile)(struct libinput_device *device); - enum libinput_config_accel_profile (*get_default_profile)(struct libinput_device *device); }; struct libinput_device_config_natural_scroll { @@ -272,15 +207,6 @@ struct libinput_device *device); }; -struct libinput_device_config_rotation { - int (*is_available)(struct libinput_device *device); - enum libinput_config_status (*set_angle)( - struct libinput_device *device, - unsigned int degrees_cw); - unsigned int (*get_angle)(struct libinput_device *device); - unsigned int (*get_default_angle)(struct libinput_device *device); -}; - struct libinput_device_config { struct libinput_device_config_tap *tap; struct libinput_device_config_calibration *calibration; @@ -292,15 +218,12 @@ struct libinput_device_config_click_method *click_method; struct libinput_device_config_middle_emulation *middle_emulation; struct libinput_device_config_dwt *dwt; - struct libinput_device_config_rotation *rotation; }; struct libinput_device_group { int refcount; void *user_data; char *identifier; /* unique identifier or NULL for singletons */ - - struct list link; }; struct libinput_device { @@ -313,67 +236,6 @@ struct libinput_device_config config; }; -enum libinput_tablet_tool_axis { - LIBINPUT_TABLET_TOOL_AXIS_X = 1, - LIBINPUT_TABLET_TOOL_AXIS_Y = 2, - LIBINPUT_TABLET_TOOL_AXIS_DISTANCE = 3, - LIBINPUT_TABLET_TOOL_AXIS_PRESSURE = 4, - LIBINPUT_TABLET_TOOL_AXIS_TILT_X = 5, - LIBINPUT_TABLET_TOOL_AXIS_TILT_Y = 6, - LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z = 7, - LIBINPUT_TABLET_TOOL_AXIS_SLIDER = 8, - LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL = 9, -}; - -#define LIBINPUT_TABLET_TOOL_AXIS_MAX LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL - -struct tablet_axes { - struct device_coords point; - struct normalized_coords delta; - double distance; - double pressure; - struct tilt_degrees tilt; - double rotation; - double slider; - double wheel; - int wheel_discrete; -}; - -struct libinput_tablet_tool { - struct list link; - uint32_t serial; - uint32_t tool_id; - enum libinput_tablet_tool_type type; - unsigned char axis_caps[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)]; - unsigned char buttons[NCHARS(KEY_MAX) + 1]; - int refcount; - void *user_data; - - /* The pressure threshold assumes a pressure_offset of 0 */ - struct threshold pressure_threshold; - int pressure_offset; /* in device coordinates */ - bool has_pressure_offset; -}; - -struct libinput_tablet_pad_mode_group { - struct libinput_device *device; - struct list link; - int refcount; - void *user_data; - - unsigned int index; - unsigned int num_modes; - unsigned int current_mode; - - uint32_t button_mask; - uint32_t ring_mask; - uint32_t strip_mask; - - uint32_t toggle_button_mask; - - void (*destroy)(struct libinput_tablet_pad_mode_group *group); -}; - struct libinput_event { enum libinput_event_type type; struct libinput_device *device; @@ -394,20 +256,6 @@ #define log_bug_libinput(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, "libinput bug: " __VA_ARGS__) #define log_bug_client(li_, ...) log_msg((li_), LIBINPUT_LOG_PRIORITY_ERROR, "client bug: " __VA_ARGS__) -#define log_debug_ratelimit(li_, r_, ...) log_msg_ratelimit((li_), (r_), LIBINPUT_LOG_PRIORITY_DEBUG, __VA_ARGS__) -#define log_info_ratelimit(li_, r_, ...) log_msg_ratelimit((li_), (r_), LIBINPUT_LOG_PRIORITY_INFO, __VA_ARGS__) -#define log_error_ratelimit(li_, r_, ...) log_msg_ratelimit((li_), (r_), LIBINPUT_LOG_PRIORITY_ERROR, __VA_ARGS__) -#define log_bug_kernel_ratelimit(li_, r_, ...) log_msg_ratelimit((li_), (r_), LIBINPUT_LOG_PRIORITY_ERROR, "kernel bug: " __VA_ARGS__) -#define log_bug_libinput_ratelimit(li_, r_, ...) log_msg_ratelimit((li_), (r_), LIBINPUT_LOG_PRIORITY_ERROR, "libinput bug: " __VA_ARGS__) -#define log_bug_client_ratelimit(li_, r_, ...) log_msg_ratelimit((li_), (r_), LIBINPUT_LOG_PRIORITY_ERROR, "client bug: " __VA_ARGS__) - -void -log_msg_ratelimit(struct libinput *libinput, - struct ratelimit *ratelimit, - enum libinput_log_priority priority, - const char *format, ...) - LIBINPUT_ATTRIBUTE_PRINTF(4, 5); - void log_msg(struct libinput *libinput, enum libinput_log_priority priority, @@ -459,21 +307,13 @@ struct libinput_seat *seat); struct libinput_device_group * -libinput_device_group_create(struct libinput *libinput, - const char *identifier); - -struct libinput_device_group * -libinput_device_group_find_group(struct libinput *libinput, - const char *identifier); +libinput_device_group_create(const char *identifier); void libinput_device_set_device_group(struct libinput_device *device, struct libinput_device_group *group); void -libinput_device_init_event_listener(struct libinput_event_listener *listener); - -void libinput_device_add_event_listener(struct libinput_device *device, struct libinput_event_listener *listener, void (*notify_func)( @@ -543,10 +383,6 @@ int32_t seat_slot); void -touch_notify_frame(struct libinput_device *device, - uint64_t time); - -void gesture_notify_swipe(struct libinput_device *device, uint64_t time, enum libinput_event_type type, @@ -564,7 +400,6 @@ gesture_notify_pinch(struct libinput_device *device, uint64_t time, enum libinput_event_type type, - int finger_count, const struct normalized_coords *delta, const struct normalized_coords *unaccel, double scale, @@ -573,68 +408,12 @@ void gesture_notify_pinch_end(struct libinput_device *device, uint64_t time, - int finger_count, double scale, int cancelled); void -tablet_notify_axis(struct libinput_device *device, - uint64_t time, - struct libinput_tablet_tool *tool, - enum libinput_tablet_tool_tip_state tip_state, - unsigned char *changed_axes, - const struct tablet_axes *axes); - -void -tablet_notify_proximity(struct libinput_device *device, - uint64_t time, - struct libinput_tablet_tool *tool, - enum libinput_tablet_tool_proximity_state state, - unsigned char *changed_axes, - const struct tablet_axes *axes); - -void -tablet_notify_tip(struct libinput_device *device, - uint64_t time, - struct libinput_tablet_tool *tool, - enum libinput_tablet_tool_tip_state tip_state, - unsigned char *changed_axes, - const struct tablet_axes *axes); - -void -tablet_notify_button(struct libinput_device *device, - uint64_t time, - struct libinput_tablet_tool *tool, - enum libinput_tablet_tool_tip_state tip_state, - const struct tablet_axes *axes, - int32_t button, - enum libinput_button_state state); - -void -tablet_pad_notify_button(struct libinput_device *device, - uint64_t time, - int32_t button, - enum libinput_button_state state, - struct libinput_tablet_pad_mode_group *group); -void -tablet_pad_notify_ring(struct libinput_device *device, - uint64_t time, - unsigned int number, - double value, - enum libinput_tablet_pad_ring_axis_source source, - struct libinput_tablet_pad_mode_group *group); -void -tablet_pad_notify_strip(struct libinput_device *device, - uint64_t time, - unsigned int number, - double value, - enum libinput_tablet_pad_strip_axis_source source, - struct libinput_tablet_pad_mode_group *group); -void -switch_notify_toggle(struct libinput_device *device, - uint64_t time, - enum libinput_switch sw, - enum libinput_switch_state state); +touch_notify_frame(struct libinput_device *device, + uint64_t time); static inline uint64_t libinput_now(struct libinput *libinput) @@ -693,30 +472,18 @@ return average; } -static inline bool -device_float_is_zero(struct device_float_coords coords) -{ - return coords.x == 0.0 && coords.y == 0.0; -} - static inline double normalized_length(struct normalized_coords norm) { return hypot(norm.x, norm.y); } -static inline bool +static inline int normalized_is_zero(struct normalized_coords norm) { return norm.x == 0.0 && norm.y == 0.0; } -static inline double -length_in_mm(struct phys_coords mm) -{ - return hypot(mm.x, mm.y); -} - enum directions { N = 1 << 0, NE = 1 << 1, @@ -729,29 +496,29 @@ UNDEFINED_DIRECTION = 0xff }; -static inline uint32_t -xy_get_direction(double x, double y) +static inline int +normalized_get_direction(struct normalized_coords norm) { - uint32_t dir = UNDEFINED_DIRECTION; + int dir = UNDEFINED_DIRECTION; int d1, d2; double r; - if (fabs(x) < 2.0 && fabs(y) < 2.0) { - if (x > 0.0 && y > 0.0) + if (fabs(norm.x) < 2.0 && fabs(norm.y) < 2.0) { + if (norm.x > 0.0 && norm.y > 0.0) dir = S | SE | E; - else if (x > 0.0 && y < 0.0) + else if (norm.x > 0.0 && norm.y < 0.0) dir = N | NE | E; - else if (x < 0.0 && y > 0.0) + else if (norm.x < 0.0 && norm.y > 0.0) dir = S | SW | W; - else if (x < 0.0 && y < 0.0) + else if (norm.x < 0.0 && norm.y < 0.0) dir = N | NW | W; - else if (x > 0.0) + else if (norm.x > 0.0) dir = NE | E | SE; - else if (x < 0.0) + else if (norm.x < 0.0) dir = NW | W | SW; - else if (y > 0.0) + else if (norm.y > 0.0) dir = SE | S | SW; - else if (y < 0.0) + else if (norm.y < 0.0) dir = NE | N | NW; } else { /* Calculate r within the interval [0 to 8) @@ -760,7 +527,7 @@ * d_f = r / 2π ([0 .. 1)) * d_8 = 8 * d_f */ - r = atan2(y, x); + r = atan2(norm.y, norm.x); r = fmod(r + 2.5*M_PI, 2*M_PI); r *= 4*M_1_PI; @@ -774,19 +541,4 @@ return dir; } -static inline uint32_t -phys_get_direction(struct phys_coords mm) -{ - return xy_get_direction(mm.x, mm.y); -} - -/** - * Get the direction for the given set of coordinates. - * assumption: coordinates are normalized to one axis resolution. - */ -static inline uint32_t -device_float_get_direction(struct device_float_coords coords) -{ - return xy_get_direction(coords.x, coords.y); -} #endif /* LIBINPUT_PRIVATE_H */ diff -Nru libinput-1.10.3/src/libinput-restore-selinux-context.sh libinput-0.21.0/src/libinput-restore-selinux-context.sh --- libinput-1.10.3/src/libinput-restore-selinux-context.sh 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/libinput-restore-selinux-context.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -#!/bin/sh -# -# $1: abs path to libdir -# $2: abs path to .so file - -libdir="$1" -sofile=$(basename "$2") - -if command -v restorecon >/dev/null; then - echo "Restoring SELinux context on ${DESTDIR}${libdir}/${sofile}" - restorecon "${DESTDIR}${libdir}/${sofile}" -fi diff -Nru libinput-1.10.3/src/libinput.sym libinput-0.21.0/src/libinput.sym --- libinput-1.10.3/src/libinput.sym 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/libinput.sym 2015-08-04 00:08:52.000000000 +0000 @@ -124,7 +124,6 @@ libinput_udev_assign_seat; libinput_udev_create_context; libinput_unref; - local: *; }; @@ -173,123 +172,3 @@ libinput_event_pointer_get_time_usec; libinput_event_touch_get_time_usec; } LIBINPUT_0.20.0; - -LIBINPUT_1.1 { - libinput_device_config_accel_get_profile; - libinput_device_config_accel_get_profiles; - libinput_device_config_accel_get_default_profile; - libinput_device_config_accel_set_profile; -} LIBINPUT_0.21.0; - -LIBINPUT_1.2 { - libinput_device_config_tap_get_drag_enabled; - libinput_device_config_tap_get_default_drag_enabled; - libinput_device_config_tap_set_drag_enabled; - libinput_event_get_tablet_tool_event; - libinput_event_tablet_tool_x_has_changed; - libinput_event_tablet_tool_y_has_changed; - libinput_event_tablet_tool_pressure_has_changed; - libinput_event_tablet_tool_distance_has_changed; - libinput_event_tablet_tool_rotation_has_changed; - libinput_event_tablet_tool_tilt_x_has_changed; - libinput_event_tablet_tool_tilt_y_has_changed; - libinput_event_tablet_tool_wheel_has_changed; - libinput_event_tablet_tool_slider_has_changed; - libinput_event_tablet_tool_get_dx; - libinput_event_tablet_tool_get_dy; - libinput_event_tablet_tool_get_x; - libinput_event_tablet_tool_get_y; - libinput_event_tablet_tool_get_pressure; - libinput_event_tablet_tool_get_distance; - libinput_event_tablet_tool_get_tilt_x; - libinput_event_tablet_tool_get_tilt_y; - libinput_event_tablet_tool_get_rotation; - libinput_event_tablet_tool_get_slider_position; - libinput_event_tablet_tool_get_wheel_delta; - libinput_event_tablet_tool_get_wheel_delta_discrete; - libinput_event_tablet_tool_get_base_event; - libinput_event_tablet_tool_get_button; - libinput_event_tablet_tool_get_button_state; - libinput_event_tablet_tool_get_proximity_state; - libinput_event_tablet_tool_get_seat_button_count; - libinput_event_tablet_tool_get_time; - libinput_event_tablet_tool_get_tip_state; - libinput_event_tablet_tool_get_tool; - libinput_event_tablet_tool_get_x_transformed; - libinput_event_tablet_tool_get_y_transformed; - libinput_event_tablet_tool_get_time_usec; - libinput_tablet_tool_get_serial; - libinput_tablet_tool_get_tool_id; - libinput_tablet_tool_get_type; - libinput_tablet_tool_get_user_data; - libinput_tablet_tool_has_pressure; - libinput_tablet_tool_has_distance; - libinput_tablet_tool_has_rotation; - libinput_tablet_tool_has_tilt; - libinput_tablet_tool_has_wheel; - libinput_tablet_tool_has_slider; - libinput_tablet_tool_has_button; - libinput_tablet_tool_is_unique; - libinput_tablet_tool_ref; - libinput_tablet_tool_set_user_data; - libinput_tablet_tool_unref; -} LIBINPUT_1.1; - -LIBINPUT_1.3 { - libinput_device_tablet_pad_get_num_buttons; - libinput_device_tablet_pad_get_num_rings; - libinput_device_tablet_pad_get_num_strips; - libinput_event_get_tablet_pad_event; - libinput_event_tablet_pad_get_base_event; - libinput_event_tablet_pad_get_button_number; - libinput_event_tablet_pad_get_button_state; - libinput_event_tablet_pad_get_ring_position; - libinput_event_tablet_pad_get_ring_number; - libinput_event_tablet_pad_get_ring_source; - libinput_event_tablet_pad_get_strip_position; - libinput_event_tablet_pad_get_strip_number; - libinput_event_tablet_pad_get_strip_source; - libinput_event_tablet_pad_get_time; - libinput_event_tablet_pad_get_time_usec; -} LIBINPUT_1.2; - -LIBINPUT_1.4 { - libinput_device_config_rotation_get_angle; - libinput_device_config_rotation_get_default_angle; - libinput_device_config_rotation_is_available; - libinput_device_config_rotation_set_angle; - libinput_device_tablet_pad_get_mode_group; - libinput_device_tablet_pad_get_num_mode_groups; - libinput_event_tablet_pad_get_mode; - libinput_event_tablet_pad_get_mode_group; - libinput_tablet_pad_mode_group_button_is_toggle; - libinput_tablet_pad_mode_group_get_index; - libinput_tablet_pad_mode_group_get_mode; - libinput_tablet_pad_mode_group_get_num_modes; - libinput_tablet_pad_mode_group_get_user_data; - libinput_tablet_pad_mode_group_has_button; - libinput_tablet_pad_mode_group_has_strip; - libinput_tablet_pad_mode_group_has_ring; - libinput_tablet_pad_mode_group_ref; - libinput_tablet_pad_mode_group_set_user_data; - libinput_tablet_pad_mode_group_unref; -} LIBINPUT_1.3; - -LIBINPUT_1.5 { - libinput_device_config_tap_get_button_map; - libinput_device_config_tap_get_default_button_map; - libinput_device_config_tap_set_button_map; -} LIBINPUT_1.4; - -LIBINPUT_1.7 { - libinput_event_get_switch_event; - libinput_event_switch_get_base_event; - libinput_event_switch_get_switch_state; - libinput_event_switch_get_switch; - libinput_event_switch_get_time; - libinput_event_switch_get_time_usec; -} LIBINPUT_1.5; - -LIBINPUT_1.9 { - libinput_device_switch_has_switch; -} LIBINPUT_1.7; diff -Nru libinput-1.10.3/src/libinput-uninstalled.pc.in libinput-0.21.0/src/libinput-uninstalled.pc.in --- libinput-1.10.3/src/libinput-uninstalled.pc.in 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/libinput-uninstalled.pc.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -libdir=@abs_builddir@/.libs -includedir=@abs_srcdir@ - -Name: Libinput -Description: Input device library (not installed) -Version: @LIBINPUT_VERSION@ -Cflags: -I${includedir} -Libs: -L${libdir} -linput -Libs.private: -lm -lrt -Requires.private: libudev diff -Nru libinput-1.10.3/src/libinput-util.c libinput-0.21.0/src/libinput-util.c --- libinput-1.10.3/src/libinput-util.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/libinput-util.c 2015-08-03 03:44:47.000000000 +0000 @@ -50,11 +50,6 @@ void list_insert(struct list *list, struct list *elm) { - assert((list->next != NULL && list->prev != NULL) || - !"list->next|prev is NULL, possibly missing list_init()"); - assert(((elm->next == NULL && elm->prev == NULL) || list_empty(elm)) || - !"elm->next|prev is not NULL, list node used twice?"); - elm->prev = list; elm->next = list->next; list->next = elm; @@ -64,21 +59,15 @@ void list_remove(struct list *elm) { - assert((elm->next != NULL && elm->prev != NULL) || - !"list->next|prev is NULL, possibly missing list_init()"); - elm->prev->next = elm->next; elm->next->prev = elm->prev; elm->next = NULL; elm->prev = NULL; } -bool +int list_empty(const struct list *list) { - assert((list->next != NULL && list->prev != NULL) || - !"list->next|prev is NULL, possibly missing list_init()"); - return list->next == list; } @@ -155,9 +144,6 @@ bool is_default = false; int nread, dpi = 0, rate; - if (!prop) - return 0; - while (*prop != 0) { if (*prop == ' ') { prop++; @@ -190,48 +176,30 @@ } /** - * Helper function to parse the MOUSE_WHEEL_CLICK_COUNT property from udev. - * Property is of the form: - * MOUSE_WHEEL_CLICK_COUNT= - * Where the number indicates the number of wheel clicks per 360 deg - * rotation. - * - * @param prop The value of the udev property (without the MOUSE_WHEEL_CLICK_COUNT=) - * @return The click count of the wheel (may be negative) or 0 on error. - */ -int -parse_mouse_wheel_click_count_property(const char *prop) -{ - int count = 0; - - if (!prop) - return 0; - - if (!safe_atoi(prop, &count) || abs(count) > 360) - return 0; - - return count; -} - -/** - * * Helper function to parse the MOUSE_WHEEL_CLICK_ANGLE property from udev. * Property is of the form: * MOUSE_WHEEL_CLICK_ANGLE= * Where the number indicates the degrees travelled for each click. * + * We skip preceding whitespaces and parse the first number seen. If + * multiple numbers are specified, we ignore those. + * * @param prop The value of the udev property (without the MOUSE_WHEEL_CLICK_ANGLE=) * @return The angle of the wheel (may be negative) or 0 on error. */ int parse_mouse_wheel_click_angle_property(const char *prop) { - int angle = 0; + int angle = 0, + nread = 0; - if (!prop) - return 0; + while(*prop != 0 && *prop == ' ') + prop++; - if (!safe_atoi(prop, &angle) || abs(angle) > 360) + sscanf(prop, "%d%n", &angle, &nread); + if (nread == 0 || angle == 0 || abs(angle) > 360) + return 0; + if (prop[nread] != ' ' && prop[nread] != '\0') return 0; return angle; @@ -248,13 +216,21 @@ double parse_trackpoint_accel_property(const char *prop) { + locale_t c_locale; double accel; + char *endp; - if (!prop) + /* Create a "C" locale to force strtod to use '.' as separator */ + c_locale = newlocale(LC_NUMERIC_MASK, "C", (locale_t)0); + if (c_locale == (locale_t)0) return 0.0; - if (!safe_atod(prop, &accel)) - accel = 0.0; + accel = strtod_l(prop, &endp, c_locale); + + freelocale(c_locale); + + if (*endp != '\0') + return 0.0; return accel; } @@ -288,252 +264,3 @@ *h = (size_t)y; return true; } - -/** - * Parses a set of 6 space-separated floats. - * - * @param prop The string value of the property - * @param calibration Returns the six components - * @return true on success, false otherwise - */ -bool -parse_calibration_property(const char *prop, float calibration_out[6]) -{ - int idx; - char **strv; - float calibration[6]; - - if (!prop) - return false; - - strv = strv_from_string(prop, " "); - if (!strv) - return false; - - for (idx = 0; idx < 6; idx++) { - double v; - if (strv[idx] == NULL || !safe_atod(strv[idx], &v)) { - strv_free(strv); - return false; - } - - calibration[idx] = v; - } - - strv_free(strv); - - memcpy(calibration_out, calibration, sizeof(calibration)); - - return true; -} - -bool -parse_switch_reliability_property(const char *prop, - enum switch_reliability *reliability) -{ - if (!prop) { - *reliability = RELIABILITY_UNKNOWN; - return true; - } - - if (streq(prop, "reliable")) - *reliability = RELIABILITY_RELIABLE; - else if (streq(prop, "write_open")) - *reliability = RELIABILITY_WRITE_OPEN; - else - return false; - - return true; -} - -/** - * Parses a string with the allowed values: "below" - * The value refers to the position of the touchpad (relative to the - * keyboard, i.e. your average laptop would be 'below') - * - * @param prop The value of the property - * @param layout The layout - * @return true on success, false otherwise - */ -bool -parse_tpkbcombo_layout_poperty(const char *prop, - enum tpkbcombo_layout *layout) -{ - if (!prop) - return false; - - if (streq(prop, "below")) { - *layout = TPKBCOMBO_LAYOUT_BELOW; - return true; - } - - return false; -} - -/** - * Parses a string of the format "a:b" where both a and b must be integer - * numbers and a > b. Also allowed is the special string vaule "none" which - * amounts to unsetting the property. - * - * @param prop The value of the property - * @param hi Set to the first digit or 0 in case of 'none' - * @param lo Set to the second digit or 0 in case of 'none' - * @return true on success, false otherwise - */ -bool -parse_range_property(const char *prop, int *hi, int *lo) -{ - int first, second; - - if (!prop) - return false; - - if (streq(prop, "none")) { - *hi = 0; - *lo = 0; - return true; - } - - if (sscanf(prop, "%d:%d", &first, &second) != 2) - return false; - - if (second >= first) - return false; - - *hi = first; - *lo = second; - - return true; -} - -/** - * Helper function to parse the LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD - * property from udev. Property is of the form: - * LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD= - * Where the number indicates the minimum threshold to consider a touch to - * be a palm. - * - * @param prop The value of the udev property (without the * - * LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD=) - * @return The pressure threshold or 0 on error - */ -int -parse_palm_pressure_property(const char *prop) -{ - int threshold = 0; - - if (!prop) - return 0; - - if (!safe_atoi(prop, &threshold) || - threshold < 0 || - threshold > 255) /* No touchpad device has pressure > 255 */ - return 0; - - return threshold; -} - -/** - * Helper function to parse the LIBINPUT_ATTR_PALM_SIZE_THRESHOLD property - * from udev. Property is of the form: - * LIBINPUT_ATTR_PALM_SIZE_THRESHOLD= - * Where the number indicates the minimum threshold to consider a touch to - * be a palm. - * - * @param prop The value of the udev property (without the - * LIBINPUT_ATTR_PALM_SIZE_THRESHOLD=) - * @return The pressure threshold or 0 on error - */ -int -parse_palm_size_property(const char *prop) -{ - int thr = 0; - - if (!prop) - return 0; - - if (!safe_atoi(prop, &thr) || thr < 0 || thr > 2028) - return 0; - - return thr; -} - -/** - * Return the next word in a string pointed to by state before the first - * separator character. Call repeatedly to tokenize a whole string. - * - * @param state Current state - * @param len String length of the word returned - * @param separators List of separator characters - * - * @return The first word in *state, NOT null-terminated - */ -static const char * -next_word(const char **state, size_t *len, const char *separators) -{ - const char *next = *state; - size_t l; - - if (!*next) - return NULL; - - next += strspn(next, separators); - if (!*next) { - *state = next; - return NULL; - } - - l = strcspn(next, separators); - *state = next + l; - *len = l; - - return next; -} - -/** - * Return a null-terminated string array with the tokens in the input - * string, e.g. "one two\tthree" with a separator list of " \t" will return - * an array [ "one", "two", "three", NULL ]. - * - * Use strv_free() to free the array. - * - * @param in Input string - * @param separators List of separator characters - * - * @return A null-terminated string array or NULL on errors - */ -char ** -strv_from_string(const char *in, const char *separators) -{ - const char *s, *word; - char **strv = NULL; - int nelems = 0, idx; - size_t l; - - assert(in != NULL); - - s = in; - while ((word = next_word(&s, &l, separators)) != NULL) - nelems++; - - if (nelems == 0) - return NULL; - - nelems++; /* NULL-terminated */ - strv = zalloc(nelems * sizeof *strv); - - idx = 0; - - s = in; - while ((word = next_word(&s, &l, separators)) != NULL) { - char *copy = strndup(word, l); - if (!copy) { - strv_free(strv); - return NULL; - } - - strv[idx++] = copy; - } - - return strv; -} diff -Nru libinput-1.10.3/src/libinput-util.h libinput-0.21.0/src/libinput-util.h --- libinput-1.10.3/src/libinput-util.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/libinput-util.h 2015-08-03 04:35:00.000000000 +0000 @@ -25,54 +25,31 @@ #ifndef LIBINPUT_UTIL_H #define LIBINPUT_UTIL_H -#include "config.h" - -#include -#include -#include -#include +#include #include #include #include -#include #include #include #include -#include #include "libinput.h" #define VENDOR_ID_APPLE 0x5ac -#define VENDOR_ID_CHICONY 0x4f2 -#define VENDOR_ID_LOGITECH 0x46d #define VENDOR_ID_WACOM 0x56a #define VENDOR_ID_SYNAPTICS_SERIAL 0x002 -#define PRODUCT_ID_APPLE_KBD_TOUCHPAD 0x273 -#define PRODUCT_ID_APPLE_APPLETOUCH 0x21a #define PRODUCT_ID_SYNAPTICS_SERIAL 0x007 -#define PRODUCT_ID_WACOM_EKR 0x0331 /* The HW DPI rate we normalize to before calculating pointer acceleration */ #define DEFAULT_MOUSE_DPI 1000 -#define DEFAULT_TRACKPOINT_RANGE 20 -#define DEFAULT_TRACKPOINT_SENSITIVITY 128 -#define ANSI_HIGHLIGHT "\x1B[0;1;39m" -#define ANSI_RED "\x1B[0;31m" -#define ANSI_GREEN "\x1B[0;32m" -#define ANSI_YELLOW "\x1B[0;33m" -#define ANSI_BLUE "\x1B[0;34m" -#define ANSI_MAGENTA "\x1B[0;35m" -#define ANSI_CYAN "\x1B[0;36m" -#define ANSI_BRIGHT_RED "\x1B[0;31;1m" -#define ANSI_BRIGHT_GREEN "\x1B[0;32;1m" -#define ANSI_BRIGHT_YELLOW "\x1B[0;33;1m" -#define ANSI_BRIGHT_BLUE "\x1B[0;34;1m" -#define ANSI_BRIGHT_MAGENTA "\x1B[0;35;1m" -#define ANSI_BRIGHT_CYAN "\x1B[0;36;1m" -#define ANSI_NORMAL "\x1B[0m" +#define CASE_RETURN_STRING(a) case a: return #a; -#define CASE_RETURN_STRING(a) case a: return #a +void +set_logging_enabled(int enabled); + +void +log_info(const char *format, ...); /* * This list data structure is a verbatim copy from wayland-util.h from the @@ -87,29 +64,31 @@ void list_init(struct list *list); void list_insert(struct list *list, struct list *elm); void list_remove(struct list *elm); -bool list_empty(const struct list *list); - -#define container_of(ptr, type, member) \ - (__typeof__(type) *)((char *)(ptr) - \ - offsetof(__typeof__(type), member)) +int list_empty(const struct list *list); -#define list_first_entry(head, pos, member) \ - container_of((head)->next, __typeof__(*pos), member) +#ifdef __GNUC__ +#define container_of(ptr, sample, member) \ + (__typeof__(sample))((char *)(ptr) - \ + ((char *)&(sample)->member - (char *)(sample))) +#else +#define container_of(ptr, sample, member) \ + (void *)((char *)(ptr) - \ + ((char *)&(sample)->member - (char *)(sample))) +#endif #define list_for_each(pos, head, member) \ - for (pos = 0, pos = list_first_entry(head, pos, member); \ + for (pos = 0, pos = container_of((head)->next, pos, member); \ &pos->member != (head); \ - pos = list_first_entry(&pos->member, pos, member)) + pos = container_of(pos->member.next, pos, member)) #define list_for_each_safe(pos, tmp, head, member) \ for (pos = 0, tmp = 0, \ - pos = list_first_entry(head, pos, member), \ - tmp = list_first_entry(&pos->member, tmp, member); \ + pos = container_of((head)->next, pos, member), \ + tmp = container_of((pos)->member.next, tmp, member); \ &pos->member != (head); \ pos = tmp, \ - tmp = list_first_entry(&pos->member, tmp, member)) + tmp = container_of(pos->member.next, tmp, member)) -#define NBITS(b) (b * 8) #define LONG_BITS (sizeof(long) * 8) #define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS) #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) @@ -122,8 +101,6 @@ #define streq(s1, s2) (strcmp((s1), (s2)) == 0) #define strneq(s1, s2, n) (strncmp((s1), (s2), (n)) == 0) -#define NCHARS(x) ((size_t)(((x) + 7) / 8)) - #ifdef DEBUG_TRACE #define debug_trace(...) \ do { \ @@ -133,60 +110,12 @@ #else #define debug_trace(...) { } #endif - #define LIBINPUT_EXPORT __attribute__ ((visibility("default"))) static inline void * zalloc(size_t size) { - void *p; - - p = calloc(1, size); - if (!p) - abort(); - - return p; -} - -/** - * strdup guaranteed to succeed. If the input string is NULL, the output - * string is NULL. If the input string is a string pointer, we strdup or - * abort on failure. - */ -static inline char* -safe_strdup(const char *str) -{ - char *s; - - if (!str) - return NULL; - - s = strdup(str); - if (!s) - abort(); - return s; -} - -/* This bitfield helper implementation is taken from from libevdev-util.h, - * except that it has been modified to work with arrays of unsigned chars - */ - -static inline bool -bit_is_set(const unsigned char *array, int bit) -{ - return !!(array[bit / 8] & (1 << (bit % 8))); -} - - static inline void -set_bit(unsigned char *array, int bit) -{ - array[bit / 8] |= (1 << (bit % 8)); -} - - static inline void -clear_bit(unsigned char *array, int bit) -{ - array[bit / 8] &= ~(1 << (bit % 8)); + return calloc(1, size); } static inline void @@ -195,22 +124,22 @@ usleep(ms * 1000); } -static inline bool +static inline int long_bit_is_set(const unsigned long *array, int bit) { - return !!(array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS))); + return !!(array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS))); } static inline void long_set_bit(unsigned long *array, int bit) { - array[bit / LONG_BITS] |= (1LL << (bit % LONG_BITS)); + array[bit / LONG_BITS] |= (1LL << (bit % LONG_BITS)); } static inline void long_clear_bit(unsigned long *array, int bit) { - array[bit / LONG_BITS] &= ~(1LL << (bit % LONG_BITS)); + array[bit / LONG_BITS] &= ~(1LL << (bit % LONG_BITS)); } static inline void @@ -222,25 +151,6 @@ long_clear_bit(array, bit); } -static inline bool -long_any_bit_set(unsigned long *array, size_t size) -{ - unsigned long i; - - assert(size > 0); - - for (i = 0; i < size; i++) - if (array[i] != 0) - return true; - return false; -} - -static inline double -deg2rad(int degree) -{ - return M_PI * degree / 180.0; -} - struct matrix { float val[3][3]; /* [row][col] */ }; @@ -282,23 +192,8 @@ m->val[1][2] = y; } -static inline void -matrix_init_rotate(struct matrix *m, int degrees) -{ - double s, c; - - s = sin(deg2rad(degrees)); - c = cos(deg2rad(degrees)); - - matrix_init_identity(m); - m->val[0][0] = c; - m->val[0][1] = -s; - m->val[1][0] = s; - m->val[1][1] = c; -} - -static inline bool -matrix_is_identity(const struct matrix *m) +static inline int +matrix_is_identity(struct matrix *m) { return (m->val[0][0] == 1 && m->val[0][1] == 0 && @@ -333,7 +228,7 @@ } static inline void -matrix_mult_vec(const struct matrix *m, int *x, int *y) +matrix_mult_vec(struct matrix *m, int *x, int *y) { int tx, ty; @@ -355,16 +250,6 @@ out[5] = m->val[1][2]; } -static inline void -matrix_to_relative(struct matrix *dest, const struct matrix *src) -{ - matrix_init_identity(dest); - dest->val[0][0] = src->val[0][0]; - dest->val[0][1] = src->val[0][1]; - dest->val[1][0] = src->val[1][0]; - dest->val[1][1] = src->val[1][1]; -} - /** * Simple wrapper for asprintf that ensures the passed in-pointer is set * to NULL upon error. @@ -378,7 +263,10 @@ * upon success or -1 upon failure. In the case of failure the pointer is set * to NULL. */ -LIBINPUT_ATTRIBUTE_PRINTF(2, 3) +static inline int +xasprintf(char **strp, const char *fmt, ...) + LIBINPUT_ATTRIBUTE_PRINTF(2, 3); + static inline int xasprintf(char **strp, const char *fmt, ...) { @@ -412,30 +300,8 @@ int parse_mouse_dpi_property(const char *prop); int parse_mouse_wheel_click_angle_property(const char *prop); -int parse_mouse_wheel_click_count_property(const char *prop); double parse_trackpoint_accel_property(const char *prop); bool parse_dimension_property(const char *prop, size_t *width, size_t *height); -bool parse_calibration_property(const char *prop, float calibration[6]); -bool parse_range_property(const char *prop, int *hi, int *lo); -int parse_palm_pressure_property(const char *prop); -int parse_palm_size_property(const char *prop); - -enum tpkbcombo_layout { - TPKBCOMBO_LAYOUT_UNKNOWN, - TPKBCOMBO_LAYOUT_BELOW, -}; -bool parse_tpkbcombo_layout_poperty(const char *prop, - enum tpkbcombo_layout *layout); - -enum switch_reliability { - RELIABILITY_UNKNOWN, - RELIABILITY_RELIABLE, - RELIABILITY_WRITE_OPEN, -}; - -bool -parse_switch_reliability_property(const char *prop, - enum switch_reliability *reliability); static inline uint64_t us(uint64_t us) @@ -467,97 +333,4 @@ return (uint32_t)(us / 1000); } -static inline uint64_t -tv2us(const struct timeval *tv) -{ - return s2us(tv->tv_sec) + tv->tv_usec; -} - -static inline struct timeval -us2tv(uint64_t time) -{ - struct timeval tv; - - tv.tv_sec = time / ms2us(1000); - tv.tv_usec = time % ms2us(1000); - - return tv; -} - -static inline bool -safe_atoi_base(const char *str, int *val, int base) -{ - char *endptr; - long v; - - assert(base == 10 || base == 16 || base == 8); - - errno = 0; - v = strtol(str, &endptr, base); - if (errno > 0) - return false; - if (str == endptr) - return false; - if (*str != '\0' && *endptr != '\0') - return false; - - if (v > INT_MAX || v < INT_MIN) - return false; - - *val = v; - return true; -} - -static inline bool -safe_atoi(const char *str, int *val) -{ - return safe_atoi_base(str, val, 10); -} - -static inline bool -safe_atod(const char *str, double *val) -{ - char *endptr; - double v; - locale_t c_locale; - - /* Create a "C" locale to force strtod to use '.' as separator */ - c_locale = newlocale(LC_NUMERIC_MASK, "C", (locale_t)0); - if (c_locale == (locale_t)0) - return false; - - errno = 0; - v = strtod_l(str, &endptr, c_locale); - freelocale(c_locale); - if (errno > 0) - return false; - if (str == endptr) - return false; - if (*str != '\0' && *endptr != '\0') - return false; - if (isnan(v) || isinf(v)) - return false; - - *val = v; - return true; -} - -char **strv_from_string(const char *string, const char *separator); - -static inline void -strv_free(char **strv) { - char **s = strv; - - if (!strv) - return; - - while (*s != NULL) { - free(*s); - *s = (char*)0x1; /* detect use-after-free */ - s++; - } - - free (strv); -} - #endif /* LIBINPUT_UTIL_H */ diff -Nru libinput-1.10.3/src/Makefile.am libinput-0.21.0/src/Makefile.am --- libinput-1.10.3/src/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/src/Makefile.am 2015-07-24 03:24:43.000000000 +0000 @@ -0,0 +1,69 @@ +lib_LTLIBRARIES = libinput.la +noinst_LTLIBRARIES = libinput-util.la \ + libfilter.la + +include_HEADERS = \ + libinput.h + +libinput_la_SOURCES = \ + libinput.c \ + libinput.h \ + libinput-private.h \ + evdev.c \ + evdev.h \ + evdev-middle-button.c \ + evdev-mt-touchpad.c \ + evdev-mt-touchpad.h \ + evdev-mt-touchpad-tap.c \ + evdev-mt-touchpad-buttons.c \ + evdev-mt-touchpad-edge-scroll.c \ + evdev-mt-touchpad-gestures.c \ + filter.c \ + filter.h \ + filter-private.h \ + path.h \ + path.c \ + udev-seat.c \ + udev-seat.h \ + timer.c \ + timer.h \ + ../include/linux/input.h + +libinput_la_LIBADD = $(MTDEV_LIBS) \ + $(LIBUDEV_LIBS) \ + $(LIBEVDEV_LIBS) \ + libinput-util.la + +libinput_la_CFLAGS = -I$(top_srcdir)/include \ + $(MTDEV_CFLAGS) \ + $(LIBUDEV_CFLAGS) \ + $(LIBEVDEV_CFLAGS) \ + $(GCC_CFLAGS) +EXTRA_libinput_la_DEPENDENCIES = $(srcdir)/libinput.sym + +libinput_util_la_SOURCES = \ + libinput-util.c \ + libinput-util.h + +libinput_util_la_LIBADD = +libinput_util_la_CFLAGS = -I$(top_srcdir)/include \ + $(LIBUDEV_CFLAGS) \ + $(GCC_CFLAGS) + +libfilter_la_SOURCES = \ + filter.c \ + filter.h \ + filter-private.h +libfilter_la_LIBADD = +libfilter_la_CFLAGS = + +libinput_la_LDFLAGS = -version-info $(LIBINPUT_LT_VERSION) -shared \ + -Wl,--version-script=$(srcdir)/libinput.sym + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libinput.pc + +AM_CFLAGS = $(GCC_CFLAGS) + +DISTCLEANFILES = libinput-version.h +EXTRA_DIST = libinput-version.h.in libinput.sym diff -Nru libinput-1.10.3/src/Makefile.in libinput-0.21.0/src/Makefile.in --- libinput-1.10.3/src/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/src/Makefile.in 2015-08-04 00:58:30.000000000 +0000 @@ -0,0 +1,950 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 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__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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 +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(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)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(include_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = libinput.pc libinput-version.h +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)$(includedir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) +libfilter_la_DEPENDENCIES = +am_libfilter_la_OBJECTS = libfilter_la-filter.lo +libfilter_la_OBJECTS = $(am_libfilter_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 = +libfilter_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libfilter_la_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +libinput_util_la_DEPENDENCIES = +am_libinput_util_la_OBJECTS = libinput_util_la-libinput-util.lo +libinput_util_la_OBJECTS = $(am_libinput_util_la_OBJECTS) +libinput_util_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libinput_util_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +am__DEPENDENCIES_1 = +libinput_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) libinput-util.la +am_libinput_la_OBJECTS = libinput_la-libinput.lo libinput_la-evdev.lo \ + libinput_la-evdev-middle-button.lo \ + libinput_la-evdev-mt-touchpad.lo \ + libinput_la-evdev-mt-touchpad-tap.lo \ + libinput_la-evdev-mt-touchpad-buttons.lo \ + libinput_la-evdev-mt-touchpad-edge-scroll.lo \ + libinput_la-evdev-mt-touchpad-gestures.lo \ + libinput_la-filter.lo libinput_la-path.lo \ + libinput_la-udev-seat.lo libinput_la-timer.lo +libinput_la_OBJECTS = $(am_libinput_la_OBJECTS) +libinput_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libinput_la_CFLAGS) \ + $(CFLAGS) $(libinput_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 = $(libfilter_la_SOURCES) $(libinput_util_la_SOURCES) \ + $(libinput_la_SOURCES) +DIST_SOURCES = $(libfilter_la_SOURCES) $(libinput_util_la_SOURCES) \ + $(libinput_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 = $(include_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(srcdir)/libinput-version.h.in $(srcdir)/libinput.pc.in \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADDR2LINE = @ADDR2LINE@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GCC_CFLAGS = @GCC_CFLAGS@ +GCC_CXXFLAGS = @GCC_CXXFLAGS@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBEVDEV_CFLAGS = @LIBEVDEV_CFLAGS@ +LIBEVDEV_LIBS = @LIBEVDEV_LIBS@ +LIBINPUT_LT_VERSION = @LIBINPUT_LT_VERSION@ +LIBINPUT_VERSION = @LIBINPUT_VERSION@ +LIBINPUT_VERSION_MAJOR = @LIBINPUT_VERSION_MAJOR@ +LIBINPUT_VERSION_MICRO = @LIBINPUT_VERSION_MICRO@ +LIBINPUT_VERSION_MINOR = @LIBINPUT_VERSION_MINOR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@ +LIBUDEV_LIBS = @LIBUDEV_LIBS@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MTDEV_CFLAGS = @MTDEV_CFLAGS@ +MTDEV_LIBS = @MTDEV_LIBS@ +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@ +STRIP = @STRIP@ +UDEV_DIR = @UDEV_DIR@ +UDEV_TEST_PATH = @UDEV_TEST_PATH@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +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_CXX = @ac_ct_CXX@ +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@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +lib_LTLIBRARIES = libinput.la +noinst_LTLIBRARIES = libinput-util.la \ + libfilter.la + +include_HEADERS = \ + libinput.h + +libinput_la_SOURCES = \ + libinput.c \ + libinput.h \ + libinput-private.h \ + evdev.c \ + evdev.h \ + evdev-middle-button.c \ + evdev-mt-touchpad.c \ + evdev-mt-touchpad.h \ + evdev-mt-touchpad-tap.c \ + evdev-mt-touchpad-buttons.c \ + evdev-mt-touchpad-edge-scroll.c \ + evdev-mt-touchpad-gestures.c \ + filter.c \ + filter.h \ + filter-private.h \ + path.h \ + path.c \ + udev-seat.c \ + udev-seat.h \ + timer.c \ + timer.h \ + ../include/linux/input.h + +libinput_la_LIBADD = $(MTDEV_LIBS) \ + $(LIBUDEV_LIBS) \ + $(LIBEVDEV_LIBS) \ + libinput-util.la + +libinput_la_CFLAGS = -I$(top_srcdir)/include \ + $(MTDEV_CFLAGS) \ + $(LIBUDEV_CFLAGS) \ + $(LIBEVDEV_CFLAGS) \ + $(GCC_CFLAGS) + +EXTRA_libinput_la_DEPENDENCIES = $(srcdir)/libinput.sym +libinput_util_la_SOURCES = \ + libinput-util.c \ + libinput-util.h + +libinput_util_la_LIBADD = +libinput_util_la_CFLAGS = -I$(top_srcdir)/include \ + $(LIBUDEV_CFLAGS) \ + $(GCC_CFLAGS) + +libfilter_la_SOURCES = \ + filter.c \ + filter.h \ + filter-private.h + +libfilter_la_LIBADD = +libfilter_la_CFLAGS = +libinput_la_LDFLAGS = -version-info $(LIBINPUT_LT_VERSION) -shared \ + -Wl,--version-script=$(srcdir)/libinput.sym + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libinput.pc +AM_CFLAGS = $(GCC_CFLAGS) +DISTCLEANFILES = libinput-version.h +EXTRA_DIST = libinput-version.h.in libinput.sym +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(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 +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: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +libinput.pc: $(top_builddir)/config.status $(srcdir)/libinput.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +libinput-version.h: $(top_builddir)/config.status $(srcdir)/libinput-version.h.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}; \ + } + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_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}; \ + } + +libfilter.la: $(libfilter_la_OBJECTS) $(libfilter_la_DEPENDENCIES) $(EXTRA_libfilter_la_DEPENDENCIES) + $(AM_V_CCLD)$(libfilter_la_LINK) $(libfilter_la_OBJECTS) $(libfilter_la_LIBADD) $(LIBS) + +libinput-util.la: $(libinput_util_la_OBJECTS) $(libinput_util_la_DEPENDENCIES) $(EXTRA_libinput_util_la_DEPENDENCIES) + $(AM_V_CCLD)$(libinput_util_la_LINK) $(libinput_util_la_OBJECTS) $(libinput_util_la_LIBADD) $(LIBS) + +libinput.la: $(libinput_la_OBJECTS) $(libinput_la_DEPENDENCIES) $(EXTRA_libinput_la_DEPENDENCIES) + $(AM_V_CCLD)$(libinput_la_LINK) -rpath $(libdir) $(libinput_la_OBJECTS) $(libinput_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfilter_la-filter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_la-evdev-middle-button.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_la-evdev-mt-touchpad-buttons.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_la-evdev-mt-touchpad-edge-scroll.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_la-evdev-mt-touchpad-gestures.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_la-evdev-mt-touchpad-tap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_la-evdev-mt-touchpad.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_la-evdev.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_la-filter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_la-libinput.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_la-path.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_la-timer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_la-udev-seat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_util_la-libinput-util.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 -o $@ $< + +.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 -o $@ `$(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 $@ $< + +libfilter_la-filter.lo: filter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfilter_la_CFLAGS) $(CFLAGS) -MT libfilter_la-filter.lo -MD -MP -MF $(DEPDIR)/libfilter_la-filter.Tpo -c -o libfilter_la-filter.lo `test -f 'filter.c' || echo '$(srcdir)/'`filter.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libfilter_la-filter.Tpo $(DEPDIR)/libfilter_la-filter.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter.c' object='libfilter_la-filter.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfilter_la_CFLAGS) $(CFLAGS) -c -o libfilter_la-filter.lo `test -f 'filter.c' || echo '$(srcdir)/'`filter.c + +libinput_util_la-libinput-util.lo: libinput-util.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_util_la_CFLAGS) $(CFLAGS) -MT libinput_util_la-libinput-util.lo -MD -MP -MF $(DEPDIR)/libinput_util_la-libinput-util.Tpo -c -o libinput_util_la-libinput-util.lo `test -f 'libinput-util.c' || echo '$(srcdir)/'`libinput-util.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_util_la-libinput-util.Tpo $(DEPDIR)/libinput_util_la-libinput-util.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libinput-util.c' object='libinput_util_la-libinput-util.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_util_la_CFLAGS) $(CFLAGS) -c -o libinput_util_la-libinput-util.lo `test -f 'libinput-util.c' || echo '$(srcdir)/'`libinput-util.c + +libinput_la-libinput.lo: libinput.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -MT libinput_la-libinput.lo -MD -MP -MF $(DEPDIR)/libinput_la-libinput.Tpo -c -o libinput_la-libinput.lo `test -f 'libinput.c' || echo '$(srcdir)/'`libinput.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_la-libinput.Tpo $(DEPDIR)/libinput_la-libinput.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libinput.c' object='libinput_la-libinput.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -c -o libinput_la-libinput.lo `test -f 'libinput.c' || echo '$(srcdir)/'`libinput.c + +libinput_la-evdev.lo: evdev.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -MT libinput_la-evdev.lo -MD -MP -MF $(DEPDIR)/libinput_la-evdev.Tpo -c -o libinput_la-evdev.lo `test -f 'evdev.c' || echo '$(srcdir)/'`evdev.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_la-evdev.Tpo $(DEPDIR)/libinput_la-evdev.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='evdev.c' object='libinput_la-evdev.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -c -o libinput_la-evdev.lo `test -f 'evdev.c' || echo '$(srcdir)/'`evdev.c + +libinput_la-evdev-middle-button.lo: evdev-middle-button.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -MT libinput_la-evdev-middle-button.lo -MD -MP -MF $(DEPDIR)/libinput_la-evdev-middle-button.Tpo -c -o libinput_la-evdev-middle-button.lo `test -f 'evdev-middle-button.c' || echo '$(srcdir)/'`evdev-middle-button.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_la-evdev-middle-button.Tpo $(DEPDIR)/libinput_la-evdev-middle-button.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='evdev-middle-button.c' object='libinput_la-evdev-middle-button.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -c -o libinput_la-evdev-middle-button.lo `test -f 'evdev-middle-button.c' || echo '$(srcdir)/'`evdev-middle-button.c + +libinput_la-evdev-mt-touchpad.lo: evdev-mt-touchpad.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -MT libinput_la-evdev-mt-touchpad.lo -MD -MP -MF $(DEPDIR)/libinput_la-evdev-mt-touchpad.Tpo -c -o libinput_la-evdev-mt-touchpad.lo `test -f 'evdev-mt-touchpad.c' || echo '$(srcdir)/'`evdev-mt-touchpad.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_la-evdev-mt-touchpad.Tpo $(DEPDIR)/libinput_la-evdev-mt-touchpad.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='evdev-mt-touchpad.c' object='libinput_la-evdev-mt-touchpad.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -c -o libinput_la-evdev-mt-touchpad.lo `test -f 'evdev-mt-touchpad.c' || echo '$(srcdir)/'`evdev-mt-touchpad.c + +libinput_la-evdev-mt-touchpad-tap.lo: evdev-mt-touchpad-tap.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -MT libinput_la-evdev-mt-touchpad-tap.lo -MD -MP -MF $(DEPDIR)/libinput_la-evdev-mt-touchpad-tap.Tpo -c -o libinput_la-evdev-mt-touchpad-tap.lo `test -f 'evdev-mt-touchpad-tap.c' || echo '$(srcdir)/'`evdev-mt-touchpad-tap.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_la-evdev-mt-touchpad-tap.Tpo $(DEPDIR)/libinput_la-evdev-mt-touchpad-tap.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='evdev-mt-touchpad-tap.c' object='libinput_la-evdev-mt-touchpad-tap.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -c -o libinput_la-evdev-mt-touchpad-tap.lo `test -f 'evdev-mt-touchpad-tap.c' || echo '$(srcdir)/'`evdev-mt-touchpad-tap.c + +libinput_la-evdev-mt-touchpad-buttons.lo: evdev-mt-touchpad-buttons.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -MT libinput_la-evdev-mt-touchpad-buttons.lo -MD -MP -MF $(DEPDIR)/libinput_la-evdev-mt-touchpad-buttons.Tpo -c -o libinput_la-evdev-mt-touchpad-buttons.lo `test -f 'evdev-mt-touchpad-buttons.c' || echo '$(srcdir)/'`evdev-mt-touchpad-buttons.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_la-evdev-mt-touchpad-buttons.Tpo $(DEPDIR)/libinput_la-evdev-mt-touchpad-buttons.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='evdev-mt-touchpad-buttons.c' object='libinput_la-evdev-mt-touchpad-buttons.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -c -o libinput_la-evdev-mt-touchpad-buttons.lo `test -f 'evdev-mt-touchpad-buttons.c' || echo '$(srcdir)/'`evdev-mt-touchpad-buttons.c + +libinput_la-evdev-mt-touchpad-edge-scroll.lo: evdev-mt-touchpad-edge-scroll.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -MT libinput_la-evdev-mt-touchpad-edge-scroll.lo -MD -MP -MF $(DEPDIR)/libinput_la-evdev-mt-touchpad-edge-scroll.Tpo -c -o libinput_la-evdev-mt-touchpad-edge-scroll.lo `test -f 'evdev-mt-touchpad-edge-scroll.c' || echo '$(srcdir)/'`evdev-mt-touchpad-edge-scroll.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_la-evdev-mt-touchpad-edge-scroll.Tpo $(DEPDIR)/libinput_la-evdev-mt-touchpad-edge-scroll.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='evdev-mt-touchpad-edge-scroll.c' object='libinput_la-evdev-mt-touchpad-edge-scroll.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -c -o libinput_la-evdev-mt-touchpad-edge-scroll.lo `test -f 'evdev-mt-touchpad-edge-scroll.c' || echo '$(srcdir)/'`evdev-mt-touchpad-edge-scroll.c + +libinput_la-evdev-mt-touchpad-gestures.lo: evdev-mt-touchpad-gestures.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -MT libinput_la-evdev-mt-touchpad-gestures.lo -MD -MP -MF $(DEPDIR)/libinput_la-evdev-mt-touchpad-gestures.Tpo -c -o libinput_la-evdev-mt-touchpad-gestures.lo `test -f 'evdev-mt-touchpad-gestures.c' || echo '$(srcdir)/'`evdev-mt-touchpad-gestures.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_la-evdev-mt-touchpad-gestures.Tpo $(DEPDIR)/libinput_la-evdev-mt-touchpad-gestures.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='evdev-mt-touchpad-gestures.c' object='libinput_la-evdev-mt-touchpad-gestures.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -c -o libinput_la-evdev-mt-touchpad-gestures.lo `test -f 'evdev-mt-touchpad-gestures.c' || echo '$(srcdir)/'`evdev-mt-touchpad-gestures.c + +libinput_la-filter.lo: filter.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -MT libinput_la-filter.lo -MD -MP -MF $(DEPDIR)/libinput_la-filter.Tpo -c -o libinput_la-filter.lo `test -f 'filter.c' || echo '$(srcdir)/'`filter.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_la-filter.Tpo $(DEPDIR)/libinput_la-filter.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='filter.c' object='libinput_la-filter.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -c -o libinput_la-filter.lo `test -f 'filter.c' || echo '$(srcdir)/'`filter.c + +libinput_la-path.lo: path.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -MT libinput_la-path.lo -MD -MP -MF $(DEPDIR)/libinput_la-path.Tpo -c -o libinput_la-path.lo `test -f 'path.c' || echo '$(srcdir)/'`path.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_la-path.Tpo $(DEPDIR)/libinput_la-path.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='path.c' object='libinput_la-path.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -c -o libinput_la-path.lo `test -f 'path.c' || echo '$(srcdir)/'`path.c + +libinput_la-udev-seat.lo: udev-seat.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -MT libinput_la-udev-seat.lo -MD -MP -MF $(DEPDIR)/libinput_la-udev-seat.Tpo -c -o libinput_la-udev-seat.lo `test -f 'udev-seat.c' || echo '$(srcdir)/'`udev-seat.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_la-udev-seat.Tpo $(DEPDIR)/libinput_la-udev-seat.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='udev-seat.c' object='libinput_la-udev-seat.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -c -o libinput_la-udev-seat.lo `test -f 'udev-seat.c' || echo '$(srcdir)/'`udev-seat.c + +libinput_la-timer.lo: timer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -MT libinput_la-timer.lo -MD -MP -MF $(DEPDIR)/libinput_la-timer.Tpo -c -o libinput_la-timer.lo `test -f 'timer.c' || echo '$(srcdir)/'`timer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_la-timer.Tpo $(DEPDIR)/libinput_la-timer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='timer.c' object='libinput_la-timer.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_la_CFLAGS) $(CFLAGS) -c -o libinput_la-timer.lo `test -f 'timer.c' || echo '$(srcdir)/'`timer.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-includeHEADERS: $(include_HEADERS) + @$(NORMAL_INSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(includedir)" || 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)$(includedir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ + done + +uninstall-includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + 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-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + 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: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + 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)$(includedir)"; 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) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +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 \ + clean-noinstLTLIBRARIES 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-includeHEADERS install-pkgconfigDATA + +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-includeHEADERS uninstall-libLTLIBRARIES \ + uninstall-pkgconfigDATA + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am 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-includeHEADERS install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-pkgconfigDATA install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-includeHEADERS \ + uninstall-libLTLIBRARIES uninstall-pkgconfigDATA + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru libinput-1.10.3/src/path.c libinput-0.21.0/src/path.c --- libinput-1.10.3/src/path.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/src/path.c 2015-08-03 03:44:47.000000000 +0000 @@ -0,0 +1,383 @@ +/* + * Copyright © 2013-2015 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "path.h" +#include "evdev.h" + +static const char default_seat[] = "seat0"; +static const char default_seat_name[] = "default"; + +int path_input_process_event(struct libinput_event); +static void path_seat_destroy(struct libinput_seat *seat); + +static void +path_disable_device(struct libinput *libinput, + struct evdev_device *device) +{ + struct libinput_seat *seat = device->base.seat; + struct evdev_device *dev, *next; + + list_for_each_safe(dev, next, + &seat->devices_list, base.link) { + if (dev != device) + continue; + + evdev_device_remove(device); + break; + } +} + +static void +path_input_disable(struct libinput *libinput) +{ + struct path_input *input = (struct path_input*)libinput; + struct path_seat *seat, *tmp; + struct evdev_device *device, *next; + + list_for_each_safe(seat, tmp, &input->base.seat_list, base.link) { + libinput_seat_ref(&seat->base); + list_for_each_safe(device, next, + &seat->base.devices_list, base.link) + path_disable_device(libinput, device); + libinput_seat_unref(&seat->base); + } +} + +static void +path_seat_destroy(struct libinput_seat *seat) +{ + struct path_seat *pseat = (struct path_seat*)seat; + free(pseat); +} + +static struct path_seat* +path_seat_create(struct path_input *input, + const char *seat_name, + const char *seat_logical_name) +{ + struct path_seat *seat; + + seat = zalloc(sizeof(*seat)); + if (!seat) + return NULL; + + libinput_seat_init(&seat->base, &input->base, seat_name, + seat_logical_name, path_seat_destroy); + + return seat; +} + +static struct path_seat* +path_seat_get_named(struct path_input *input, + const char *seat_name_physical, + const char *seat_name_logical) +{ + struct path_seat *seat; + + list_for_each(seat, &input->base.seat_list, base.link) { + if (streq(seat->base.physical_name, seat_name_physical) && + streq(seat->base.logical_name, seat_name_logical)) + return seat; + } + + return NULL; +} + +static struct libinput_device * +path_device_enable(struct path_input *input, + struct udev_device *udev_device, + const char *seat_logical_name_override) +{ + struct path_seat *seat; + struct evdev_device *device = NULL; + char *seat_name = NULL, *seat_logical_name = NULL; + const char *seat_prop; + const char *devnode; + + devnode = udev_device_get_devnode(udev_device); + + seat_prop = udev_device_get_property_value(udev_device, "ID_SEAT"); + seat_name = strdup(seat_prop ? seat_prop : default_seat); + + if (seat_logical_name_override) { + seat_logical_name = strdup(seat_logical_name_override); + } else { + seat_prop = udev_device_get_property_value(udev_device, "WL_SEAT"); + seat_logical_name = strdup(seat_prop ? seat_prop : default_seat_name); + } + + if (!seat_logical_name) { + log_error(&input->base, + "failed to create seat name for device '%s'.\n", + devnode); + goto out; + } + + seat = path_seat_get_named(input, seat_name, seat_logical_name); + + if (seat) { + libinput_seat_ref(&seat->base); + } else { + seat = path_seat_create(input, seat_name, seat_logical_name); + if (!seat) { + log_info(&input->base, + "failed to create seat for device '%s'.\n", + devnode); + goto out; + } + } + + device = evdev_device_create(&seat->base, udev_device); + libinput_seat_unref(&seat->base); + + if (device == EVDEV_UNHANDLED_DEVICE) { + device = NULL; + log_info(&input->base, + "not using input device '%s'.\n", + devnode); + goto out; + } else if (device == NULL) { + log_info(&input->base, + "failed to create input device '%s'.\n", + devnode); + goto out; + } + +out: + free(seat_name); + free(seat_logical_name); + + return device ? &device->base : NULL; +} + +static int +path_input_enable(struct libinput *libinput) +{ + struct path_input *input = (struct path_input*)libinput; + struct path_device *dev; + + list_for_each(dev, &input->path_list, link) { + if (path_device_enable(input, dev->udev_device, NULL) == NULL) { + path_input_disable(libinput); + return -1; + } + } + + return 0; +} + +static void +path_input_destroy(struct libinput *input) +{ + struct path_input *path_input = (struct path_input*)input; + struct path_device *dev, *tmp; + + udev_unref(path_input->udev); + + list_for_each_safe(dev, tmp, &path_input->path_list, link) { + udev_device_unref(dev->udev_device); + free(dev); + } + +} + +static struct libinput_device * +path_create_device(struct libinput *libinput, + struct udev_device *udev_device, + const char *seat_name) +{ + struct path_input *input = (struct path_input*)libinput; + struct path_device *dev; + struct libinput_device *device; + + dev = zalloc(sizeof *dev); + if (!dev) + return NULL; + + dev->udev_device = udev_device_ref(udev_device); + + list_insert(&input->path_list, &dev->link); + + device = path_device_enable(input, udev_device, seat_name); + + if (!device) { + udev_device_unref(dev->udev_device); + list_remove(&dev->link); + free(dev); + } + + return device; +} + +static int +path_device_change_seat(struct libinput_device *device, + const char *seat_name) +{ + struct libinput *libinput = device->seat->libinput; + struct evdev_device *evdev_device = (struct evdev_device *)device; + struct udev_device *udev_device = NULL; + int rc = -1; + + udev_device = evdev_device->udev_device; + udev_device_ref(udev_device); + libinput_path_remove_device(device); + + if (path_create_device(libinput, udev_device, seat_name) != NULL) + rc = 0; + udev_device_unref(udev_device); + return rc; +} + +static const struct libinput_interface_backend interface_backend = { + .resume = path_input_enable, + .suspend = path_input_disable, + .destroy = path_input_destroy, + .device_change_seat = path_device_change_seat, +}; + +LIBINPUT_EXPORT struct libinput * +libinput_path_create_context(const struct libinput_interface *interface, + void *user_data) +{ + struct path_input *input; + struct udev *udev; + + if (!interface) + return NULL; + + udev = udev_new(); + if (!udev) + return NULL; + + input = zalloc(sizeof *input); + if (!input || + libinput_init(&input->base, interface, + &interface_backend, user_data) != 0) { + udev_unref(udev); + free(input); + return NULL; + } + + input->udev = udev; + list_init(&input->path_list); + + return &input->base; +} + +static inline struct udev_device * +udev_device_from_devnode(struct libinput *libinput, + struct udev *udev, + const char *devnode) +{ + struct udev_device *dev; + struct stat st; + size_t count = 0; + + if (stat(devnode, &st) < 0) + return NULL; + + dev = udev_device_new_from_devnum(udev, 'c', st.st_rdev); + + while (dev && !udev_device_get_is_initialized(dev)) { + udev_device_unref(dev); + msleep(10); + dev = udev_device_new_from_devnum(udev, 'c', st.st_rdev); + + count++; + if (count > 200) { + log_bug_libinput(libinput, + "udev device never initialized (%s)\n", + devnode); + break; + } + } + + return dev; +} + +LIBINPUT_EXPORT struct libinput_device * +libinput_path_add_device(struct libinput *libinput, + const char *path) +{ + struct path_input *input = (struct path_input *)libinput; + struct udev *udev = input->udev; + struct udev_device *udev_device; + struct libinput_device *device; + + if (libinput->interface_backend != &interface_backend) { + log_bug_client(libinput, "Mismatching backends.\n"); + return NULL; + } + + udev_device = udev_device_from_devnode(libinput, udev, path); + if (!udev_device) { + log_bug_client(libinput, "Invalid path %s\n", path); + return NULL; + } + + if (ignore_litest_test_suite_device(udev_device)) { + udev_device_unref(udev_device); + return NULL; + } + + device = path_create_device(libinput, udev_device, NULL); + udev_device_unref(udev_device); + return device; +} + +LIBINPUT_EXPORT void +libinput_path_remove_device(struct libinput_device *device) +{ + struct libinput *libinput = device->seat->libinput; + struct path_input *input = (struct path_input*)libinput; + struct libinput_seat *seat; + struct evdev_device *evdev = (struct evdev_device*)device; + struct path_device *dev; + + if (libinput->interface_backend != &interface_backend) { + log_bug_client(libinput, "Mismatching backends.\n"); + return; + } + + list_for_each(dev, &input->path_list, link) { + if (dev->udev_device == evdev->udev_device) { + list_remove(&dev->link); + udev_device_unref(dev->udev_device); + free(dev); + break; + } + } + + seat = device->seat; + libinput_seat_ref(seat); + path_disable_device(libinput, evdev); + libinput_seat_unref(seat); +} diff -Nru libinput-1.10.3/src/path.h libinput-0.21.0/src/path.h --- libinput-1.10.3/src/path.h 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/src/path.h 2015-07-15 04:18:08.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright © 2013 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#ifndef _PATH_H_ +#define _PATH_H_ + +#include "config.h" +#include "libinput-private.h" + +struct path_input { + struct libinput base; + struct udev *udev; + struct list path_list; +}; + +struct path_device { + struct list link; + struct udev_device *udev_device; +}; + +struct path_seat { + struct libinput_seat base; +}; + +int path_input_process_event(struct libinput_event); + +#endif diff -Nru libinput-1.10.3/src/path-seat.c libinput-0.21.0/src/path-seat.c --- libinput-1.10.3/src/path-seat.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/path-seat.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,383 +0,0 @@ -/* - * Copyright © 2013-2015 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include -#include -#include -#include -#include - -#include "path-seat.h" -#include "evdev.h" - -static const char default_seat[] = "seat0"; -static const char default_seat_name[] = "default"; - -static void -path_disable_device(struct libinput *libinput, - struct evdev_device *device) -{ - struct libinput_seat *seat = device->base.seat; - struct evdev_device *dev, *next; - - list_for_each_safe(dev, next, - &seat->devices_list, base.link) { - if (dev != device) - continue; - - evdev_device_remove(device); - break; - } -} - -static void -path_input_disable(struct libinput *libinput) -{ - struct path_input *input = (struct path_input*)libinput; - struct path_seat *seat, *tmp; - struct evdev_device *device, *next; - - list_for_each_safe(seat, tmp, &input->base.seat_list, base.link) { - libinput_seat_ref(&seat->base); - list_for_each_safe(device, next, - &seat->base.devices_list, base.link) - path_disable_device(libinput, device); - libinput_seat_unref(&seat->base); - } -} - -static void -path_seat_destroy(struct libinput_seat *seat) -{ - struct path_seat *pseat = (struct path_seat*)seat; - free(pseat); -} - -static struct path_seat* -path_seat_create(struct path_input *input, - const char *seat_name, - const char *seat_logical_name) -{ - struct path_seat *seat; - - seat = zalloc(sizeof(*seat)); - - libinput_seat_init(&seat->base, &input->base, seat_name, - seat_logical_name, path_seat_destroy); - - return seat; -} - -static struct path_seat* -path_seat_get_named(struct path_input *input, - const char *seat_name_physical, - const char *seat_name_logical) -{ - struct path_seat *seat; - - list_for_each(seat, &input->base.seat_list, base.link) { - if (streq(seat->base.physical_name, seat_name_physical) && - streq(seat->base.logical_name, seat_name_logical)) - return seat; - } - - return NULL; -} - -static struct libinput_device * -path_device_enable(struct path_input *input, - struct udev_device *udev_device, - const char *seat_logical_name_override) -{ - struct path_seat *seat; - struct evdev_device *device = NULL; - char *seat_name = NULL, *seat_logical_name = NULL; - const char *seat_prop, *output_name; - const char *devnode, *sysname; - - devnode = udev_device_get_devnode(udev_device); - sysname = udev_device_get_sysname(udev_device); - - seat_prop = udev_device_get_property_value(udev_device, "ID_SEAT"); - seat_name = safe_strdup(seat_prop ? seat_prop : default_seat); - - if (seat_logical_name_override) { - seat_logical_name = safe_strdup(seat_logical_name_override); - } else { - seat_prop = udev_device_get_property_value(udev_device, "WL_SEAT"); - seat_logical_name = strdup(seat_prop ? seat_prop : default_seat_name); - } - - if (!seat_logical_name) { - log_error(&input->base, - "%s: failed to create seat name for device '%s'.\n", - sysname, - devnode); - goto out; - } - - seat = path_seat_get_named(input, seat_name, seat_logical_name); - - if (seat) { - libinput_seat_ref(&seat->base); - } else { - seat = path_seat_create(input, seat_name, seat_logical_name); - if (!seat) { - log_info(&input->base, - "%s: failed to create seat for device '%s'.\n", - sysname, - devnode); - goto out; - } - } - - device = evdev_device_create(&seat->base, udev_device); - libinput_seat_unref(&seat->base); - - if (device == EVDEV_UNHANDLED_DEVICE) { - device = NULL; - log_info(&input->base, - "%-7s - not using input device '%s'.\n", - sysname, - devnode); - goto out; - } else if (device == NULL) { - log_info(&input->base, - "%-7s - failed to create input device '%s'.\n", - sysname, - devnode); - goto out; - } - - evdev_read_calibration_prop(device); - output_name = udev_device_get_property_value(udev_device, "WL_OUTPUT"); - device->output_name = safe_strdup(output_name); - -out: - free(seat_name); - free(seat_logical_name); - - return device ? &device->base : NULL; -} - -static int -path_input_enable(struct libinput *libinput) -{ - struct path_input *input = (struct path_input*)libinput; - struct path_device *dev; - - list_for_each(dev, &input->path_list, link) { - if (path_device_enable(input, dev->udev_device, NULL) == NULL) { - path_input_disable(libinput); - return -1; - } - } - - return 0; -} - -static void -path_input_destroy(struct libinput *input) -{ - struct path_input *path_input = (struct path_input*)input; - struct path_device *dev, *tmp; - - udev_unref(path_input->udev); - - list_for_each_safe(dev, tmp, &path_input->path_list, link) { - udev_device_unref(dev->udev_device); - free(dev); - } - -} - -static struct libinput_device * -path_create_device(struct libinput *libinput, - struct udev_device *udev_device, - const char *seat_name) -{ - struct path_input *input = (struct path_input*)libinput; - struct path_device *dev; - struct libinput_device *device; - - dev = zalloc(sizeof *dev); - dev->udev_device = udev_device_ref(udev_device); - - list_insert(&input->path_list, &dev->link); - - device = path_device_enable(input, udev_device, seat_name); - - if (!device) { - udev_device_unref(dev->udev_device); - list_remove(&dev->link); - free(dev); - } - - return device; -} - -static int -path_device_change_seat(struct libinput_device *device, - const char *seat_name) -{ - struct libinput *libinput = device->seat->libinput; - struct evdev_device *evdev = evdev_device(device); - struct udev_device *udev_device = NULL; - int rc = -1; - - udev_device = evdev->udev_device; - udev_device_ref(udev_device); - libinput_path_remove_device(device); - - if (path_create_device(libinput, udev_device, seat_name) != NULL) - rc = 0; - udev_device_unref(udev_device); - return rc; -} - -static const struct libinput_interface_backend interface_backend = { - .resume = path_input_enable, - .suspend = path_input_disable, - .destroy = path_input_destroy, - .device_change_seat = path_device_change_seat, -}; - -LIBINPUT_EXPORT struct libinput * -libinput_path_create_context(const struct libinput_interface *interface, - void *user_data) -{ - struct path_input *input; - struct udev *udev; - - if (!interface) - return NULL; - - udev = udev_new(); - if (!udev) - return NULL; - - input = zalloc(sizeof *input); - if (libinput_init(&input->base, interface, - &interface_backend, user_data) != 0) { - udev_unref(udev); - free(input); - return NULL; - } - - input->udev = udev; - list_init(&input->path_list); - - return &input->base; -} - -static inline struct udev_device * -udev_device_from_devnode(struct libinput *libinput, - struct udev *udev, - const char *devnode) -{ - struct udev_device *dev; - struct stat st; - size_t count = 0; - - if (stat(devnode, &st) < 0) - return NULL; - - dev = udev_device_new_from_devnum(udev, 'c', st.st_rdev); - - while (dev && !udev_device_get_is_initialized(dev)) { - udev_device_unref(dev); - msleep(10); - dev = udev_device_new_from_devnum(udev, 'c', st.st_rdev); - - count++; - if (count > 200) { - log_bug_libinput(libinput, - "udev device never initialized (%s)\n", - devnode); - return NULL; - } - } - - return dev; -} - -LIBINPUT_EXPORT struct libinput_device * -libinput_path_add_device(struct libinput *libinput, - const char *path) -{ - struct path_input *input = (struct path_input *)libinput; - struct udev *udev = input->udev; - struct udev_device *udev_device; - struct libinput_device *device; - - if (libinput->interface_backend != &interface_backend) { - log_bug_client(libinput, "Mismatching backends.\n"); - return NULL; - } - - udev_device = udev_device_from_devnode(libinput, udev, path); - if (!udev_device) { - log_bug_client(libinput, "Invalid path %s\n", path); - return NULL; - } - - if (ignore_litest_test_suite_device(udev_device)) { - udev_device_unref(udev_device); - return NULL; - } - - device = path_create_device(libinput, udev_device, NULL); - udev_device_unref(udev_device); - return device; -} - -LIBINPUT_EXPORT void -libinput_path_remove_device(struct libinput_device *device) -{ - struct libinput *libinput = device->seat->libinput; - struct path_input *input = (struct path_input*)libinput; - struct libinput_seat *seat; - struct evdev_device *evdev = evdev_device(device); - struct path_device *dev; - - if (libinput->interface_backend != &interface_backend) { - log_bug_client(libinput, "Mismatching backends.\n"); - return; - } - - list_for_each(dev, &input->path_list, link) { - if (dev->udev_device == evdev->udev_device) { - list_remove(&dev->link); - udev_device_unref(dev->udev_device); - free(dev); - break; - } - } - - seat = device->seat; - libinput_seat_ref(seat); - path_disable_device(libinput, evdev); - libinput_seat_unref(seat); -} diff -Nru libinput-1.10.3/src/path-seat.h libinput-0.21.0/src/path-seat.h --- libinput-1.10.3/src/path-seat.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/path-seat.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright © 2013 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#ifndef _PATH_H_ -#define _PATH_H_ - -#include "config.h" -#include "libinput-private.h" - -struct path_input { - struct libinput base; - struct udev *udev; - struct list path_list; -}; - -struct path_device { - struct list link; - struct udev_device *udev_device; -}; - -struct path_seat { - struct libinput_seat base; -}; - -#endif diff -Nru libinput-1.10.3/src/timer.c libinput-0.21.0/src/timer.c --- libinput-1.10.3/src/timer.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/timer.c 2015-08-03 04:55:20.000000000 +0000 @@ -34,24 +34,15 @@ #include "timer.h" void -libinput_timer_init(struct libinput_timer *timer, - struct libinput *libinput, - const char *timer_name, +libinput_timer_init(struct libinput_timer *timer, struct libinput *libinput, void (*timer_func)(uint64_t now, void *timer_func_data), void *timer_func_data) { timer->libinput = libinput; - timer->timer_name = safe_strdup(timer_name); timer->timer_func = timer_func; timer->timer_func_data = timer_func_data; } -void -libinput_timer_destroy(struct libinput_timer *timer) -{ - free(timer->timer_name); -} - static void libinput_timer_arm_timer_fd(struct libinput *libinput) { @@ -72,30 +63,22 @@ r = timerfd_settime(libinput->timer.fd, TFD_TIMER_ABSTIME, &its, NULL); if (r) - log_error(libinput, "timer: timerfd_settime error: %s\n", strerror(errno)); - - libinput->timer.next_expiry = earliest_expire; + log_error(libinput, "timerfd_settime error: %s\n", strerror(errno)); } void -libinput_timer_set_flags(struct libinput_timer *timer, - uint64_t expire, - uint32_t flags) +libinput_timer_set(struct libinput_timer *timer, uint64_t expire) { #ifndef NDEBUG uint64_t now = libinput_now(timer->libinput); - if (expire < now) { - if ((flags & TIMER_FLAG_ALLOW_NEGATIVE) == 0) - log_bug_client(timer->libinput, - "timer %s: offset negative (-%dms)\n", - timer->timer_name, - us2ms(now - expire)); - } else if ((expire - now) > ms2us(5000)) { + if (expire < now) log_bug_libinput(timer->libinput, - "timer %s: offset more than 5s, now %d expire %d\n", - timer->timer_name, - us2ms(now), us2ms(expire)); - } + "timer offset negative\n"); + else if ((expire - now) > ms2us(5000)) + log_bug_libinput(timer->libinput, + "timer offset more than 5s, now %" + PRIu64 " expire %" PRIu64 "\n", + now, expire); #endif assert(expire); @@ -108,12 +91,6 @@ } void -libinput_timer_set(struct libinput_timer *timer, uint64_t expire) -{ - libinput_timer_set_flags(timer, expire, TIMER_FLAG_NONE); -} - -void libinput_timer_cancel(struct libinput_timer *timer) { if (!timer->expire) @@ -125,38 +102,10 @@ } static void -libinput_timer_handler(struct libinput *libinput , uint64_t now) -{ - struct libinput_timer *timer; - -restart: - list_for_each(timer, &libinput->timer.list, link) { - if (timer->expire == 0) - continue; - - if (timer->expire <= now) { - /* Clear the timer before calling timer_func, - as timer_func may re-arm it */ - libinput_timer_cancel(timer); - timer->timer_func(now, timer->timer_func_data); - - /* - * Restart the loop. We can't use - * list_for_each_safe() here because that only - * allows removing one (our) timer per timer_func. - * But the timer func may trigger another unrelated - * timer to be cancelled and removed, causing a - * segfault. - */ - goto restart; - } - } -} - -static void -libinput_timer_dispatch(void *data) +libinput_timer_handler(void *data) { struct libinput *libinput = data; + struct libinput_timer *timer, *tmp; uint64_t now; uint64_t discard; int r; @@ -164,7 +113,7 @@ r = read(libinput->timer.fd, &discard, sizeof(discard)); if (r == -1 && errno != EAGAIN) log_bug_libinput(libinput, - "timer: error %d reading from timerfd (%s)", + "Error %d reading from timerfd (%s)", errno, strerror(errno)); @@ -172,7 +121,14 @@ if (now == 0) return; - libinput_timer_handler(libinput, now); + list_for_each_safe(timer, tmp, &libinput->timer.list, link) { + if (timer->expire <= now) { + /* Clear the timer before calling timer_func, + as timer_func may re-arm it */ + libinput_timer_cancel(timer); + timer->timer_func(now, timer->timer_func_data); + } + } } int @@ -187,7 +143,7 @@ libinput->timer.source = libinput_add_fd(libinput, libinput->timer.fd, - libinput_timer_dispatch, + libinput_timer_handler, libinput); if (!libinput->timer.source) { close(libinput->timer.fd); @@ -206,22 +162,3 @@ libinput_remove_source(libinput, libinput->timer.source); close(libinput->timer.fd); } - -/** - * For a caller calling libinput_dispatch() only infrequently, we may have a - * timer expiry *and* a later input event waiting in the pipe. We cannot - * guarantee that we read the timer expiry first, so this hook exists to - * flush any timers. - * - * Assume 'now' is the current time check if there is a current timer expiry - * before this time. If so, trigger the timer func. - */ -void -libinput_timer_flush(struct libinput *libinput, uint64_t now) -{ - if (libinput->timer.next_expiry == 0 || - libinput->timer.next_expiry > now) - return; - - libinput_timer_handler(libinput, now); -} diff -Nru libinput-1.10.3/src/timer.h libinput-0.21.0/src/timer.h --- libinput-1.10.3/src/timer.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/timer.h 2015-08-03 04:55:20.000000000 +0000 @@ -32,7 +32,6 @@ struct libinput_timer { struct libinput *libinput; - char *timer_name; struct list link; uint64_t expire; /* in absolute us CLOCK_MONOTONIC */ void (*timer_func)(uint64_t now, void *timer_func_data); @@ -41,27 +40,13 @@ void libinput_timer_init(struct libinput_timer *timer, struct libinput *libinput, - const char *timer_name, void (*timer_func)(uint64_t now, void *timer_func_data), void *timer_func_data); -void -libinput_timer_destroy(struct libinput_timer *timer); - /* Set timer expire time, in absolute us CLOCK_MONOTONIC */ void libinput_timer_set(struct libinput_timer *timer, uint64_t expire); -enum timer_flags { - TIMER_FLAG_NONE = 0, - TIMER_FLAG_ALLOW_NEGATIVE = (1 << 0), -}; - -void -libinput_timer_set_flags(struct libinput_timer *timer, - uint64_t expire, - uint32_t flags); - void libinput_timer_cancel(struct libinput_timer *timer); @@ -71,7 +56,4 @@ void libinput_timer_subsys_destroy(struct libinput *libinput); -void -libinput_timer_flush(struct libinput *libinput, uint64_t now); - #endif diff -Nru libinput-1.10.3/src/udev-seat.c libinput-0.21.0/src/udev-seat.c --- libinput-1.10.3/src/udev-seat.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/src/udev-seat.c 2015-08-03 03:44:47.000000000 +0000 @@ -49,8 +49,10 @@ const char *seat_name) { struct evdev_device *device; - const char *devnode, *sysname; + const char *devnode; const char *device_seat, *output_name; + const char *calibration_values; + float calibration[6]; struct udev_seat *seat; device_seat = udev_device_get_property_value(udev_device, "ID_SEAT"); @@ -64,7 +66,6 @@ return 0; devnode = udev_device_get_devnode(udev_device); - sysname = udev_device_get_sysname(udev_device); /* Search for matching logical seat */ if (!seat_name) @@ -86,23 +87,40 @@ libinput_seat_unref(&seat->base); if (device == EVDEV_UNHANDLED_DEVICE) { - log_info(&input->base, - "%-7s - not using input device '%s'\n", - sysname, - devnode); + log_info(&input->base, "not using input device '%s'.\n", devnode); return 0; } else if (device == NULL) { - log_info(&input->base, - "%-7s - failed to create input device '%s'\n", - sysname, - devnode); + log_info(&input->base, "failed to create input device '%s'.\n", devnode); return 0; } - evdev_read_calibration_prop(device); + calibration_values = + udev_device_get_property_value(udev_device, + "LIBINPUT_CALIBRATION_MATRIX"); + + if (device->abs.absinfo_x && device->abs.absinfo_y && + calibration_values && sscanf(calibration_values, + "%f %f %f %f %f %f", + &calibration[0], + &calibration[1], + &calibration[2], + &calibration[3], + &calibration[4], + &calibration[5]) == 6) { + evdev_device_set_default_calibration(device, calibration); + log_info(&input->base, + "Applying calibration: %f %f %f %f %f %f\n", + calibration[0], + calibration[1], + calibration[2], + calibration[3], + calibration[4], + calibration[5]); + } output_name = udev_device_get_property_value(udev_device, "WL_OUTPUT"); - device->output_name = safe_strdup(output_name); + if (output_name) + device->output_name = strdup(output_name); return 0; } @@ -120,6 +138,10 @@ &seat->base.devices_list, base.link) { if (streq(syspath, udev_device_get_syspath(device->udev_device))) { + log_info(&input->base, + "input device %s, %s removed\n", + device->devname, + udev_device_get_devnode(device->udev_device)); evdev_device_remove(device); break; } @@ -229,7 +251,7 @@ struct udev *udev = input->udev; int fd; - if (input->udev_monitor || !input->seat_id) + if (input->udev_monitor) return 0; input->udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); @@ -295,6 +317,8 @@ struct udev_seat *seat; seat = zalloc(sizeof *seat); + if (!seat) + return NULL; libinput_seat_init(&seat->base, &input->base, device_seat, seat_name, @@ -322,8 +346,8 @@ { struct libinput *libinput = device->seat->libinput; struct udev_input *input = (struct udev_input *)libinput; - struct evdev_device *evdev = evdev_device(device); - struct udev_device *udev_device = evdev->udev_device; + struct evdev_device *evdev_device = (struct evdev_device *)device; + struct udev_device *udev_device = evdev_device->udev_device; int rc; udev_device_ref(udev_device); @@ -352,6 +376,8 @@ return NULL; input = zalloc(sizeof *input); + if (!input) + return NULL; if (libinput_init(&input->base, interface, &interface_backend, user_data) != 0) { @@ -373,16 +399,15 @@ if (!seat_id) return -1; + if (input->seat_id != NULL) + return -1; if (libinput->interface_backend != &interface_backend) { log_bug_client(libinput, "Mismatching backends.\n"); return -1; } - if (input->seat_id != NULL) - return -1; - - input->seat_id = safe_strdup(seat_id); + input->seat_id = strdup(seat_id); if (udev_input_enable(&input->base) < 0) return -1; diff -Nru libinput-1.10.3/test/50-litest.conf libinput-0.21.0/test/50-litest.conf --- libinput-1.10.3/test/50-litest.conf 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/50-litest.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -# Ignore devices created by libinput's test suite (litest) -Section "InputClass" - Identifier "libinput test suite blacklist" - MatchProduct "litest" - Option "Ignore" "on" -EndSection diff -Nru libinput-1.10.3/test/device.c libinput-0.21.0/test/device.c --- libinput-1.10.3/test/device.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/device.c 2015-07-31 01:50:42.000000000 +0000 @@ -0,0 +1,1080 @@ +/* + * Copyright © 2014 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include "litest.h" +#include "libinput-util.h" + +START_TEST(device_sendevents_config) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device; + uint32_t modes; + + device = dev->libinput_device; + + modes = libinput_device_config_send_events_get_modes(device); + ck_assert_int_eq(modes, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); +} +END_TEST + +START_TEST(device_sendevents_config_invalid) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device; + enum libinput_config_status status; + + device = dev->libinput_device; + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED | (1 << 4)); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); +} +END_TEST + +START_TEST(device_sendevents_config_touchpad) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device; + uint32_t modes, expected; + + expected = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED; + + /* The wacom devices in the test suite are external */ + if (libevdev_get_id_vendor(dev->evdev) != VENDOR_ID_WACOM && + libevdev_get_id_bustype(dev->evdev) != BUS_BLUETOOTH) + expected |= + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE; + + device = dev->libinput_device; + + modes = libinput_device_config_send_events_get_modes(device); + ck_assert_int_eq(modes, expected); +} +END_TEST + +START_TEST(device_sendevents_config_touchpad_superset) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device; + enum libinput_config_status status; + uint32_t modes; + + /* The wacom devices in the test suite are external */ + if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM || + libevdev_get_id_bustype(dev->evdev) == BUS_BLUETOOTH) + return; + + device = dev->libinput_device; + + modes = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED | + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE; + + status = libinput_device_config_send_events_set_mode(device, + modes); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + /* DISABLED supersedes the rest, expect the rest to be dropped */ + modes = libinput_device_config_send_events_get_mode(device); + ck_assert_int_eq(modes, LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); +} +END_TEST + +START_TEST(device_sendevents_config_default) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device; + uint32_t mode; + + device = dev->libinput_device; + + mode = libinput_device_config_send_events_get_mode(device); + ck_assert_int_eq(mode, + LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); + + mode = libinput_device_config_send_events_get_default_mode(device); + ck_assert_int_eq(mode, + LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); +} +END_TEST + +START_TEST(device_disable) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_device *device; + enum libinput_config_status status; + struct libinput_event *event; + struct litest_device *tmp; + + device = dev->libinput_device; + + litest_drain_events(li); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + /* no event from disabling */ + litest_assert_empty_queue(li); + + /* no event from disabled device */ + litest_event(dev, EV_REL, REL_X, 10); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_assert_empty_queue(li); + + /* create a new device so the resumed fd isn't the same as the + suspended one */ + tmp = litest_add_device(li, LITEST_KEYBOARD); + ck_assert_notnull(tmp); + litest_drain_events(li); + + /* no event from resuming */ + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + litest_assert_empty_queue(li); + + /* event from renabled device */ + litest_event(dev, EV_REL, REL_X, 10); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + event = libinput_get_event(li); + ck_assert_notnull(event); + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_MOTION); + libinput_event_destroy(event); + + litest_delete_device(tmp); +} +END_TEST + +START_TEST(device_disable_touchpad) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_device *device; + enum libinput_config_status status; + + device = dev->libinput_device; + + litest_drain_events(li); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + /* no event from disabling */ + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 90, 90, 10, 0); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); + + /* no event from resuming */ + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(device_disable_events_pending) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_device *device; + enum libinput_config_status status; + struct libinput_event *event; + int i; + + device = dev->libinput_device; + + litest_drain_events(li); + + /* put a couple of events in the queue, enough to + feed the ptraccel trackers */ + for (i = 0; i < 10; i++) { + litest_event(dev, EV_REL, REL_X, 10); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + } + libinput_dispatch(li); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + /* expect above events */ + litest_wait_for_event(li); + while ((event = libinput_get_event(li)) != NULL) { + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_MOTION); + libinput_event_destroy(event); + } +} +END_TEST + +START_TEST(device_double_disable) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_device *device; + enum libinput_config_status status; + + device = dev->libinput_device; + + litest_drain_events(li); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(device_double_enable) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_device *device; + enum libinput_config_status status; + + device = dev->libinput_device; + + litest_drain_events(li); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(device_reenable_syspath_changed) +{ + struct libinput *li; + struct litest_device *litest_device; + struct libinput_device *device1, *device2; + enum libinput_config_status status; + struct libinput_event *event; + + li = litest_create_context(); + litest_device = litest_add_device(li, LITEST_MOUSE); + device1 = litest_device->libinput_device; + + libinput_device_ref(device1); + status = libinput_device_config_send_events_set_mode(device1, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_drain_events(li); + + litest_delete_device(litest_device); + litest_drain_events(li); + + litest_device = litest_add_device(li, LITEST_MOUSE); + device2 = litest_device->libinput_device; + /* Note: if the sysname isn't the same, some other device got added + * or removed while this test was running. This is unlikely and + * would result in a false positive, so let's fail the test here */ + ck_assert_str_eq(libinput_device_get_sysname(device1), + libinput_device_get_sysname(device2)); + + status = libinput_device_config_send_events_set_mode(device1, + LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + /* can't really check for much here, other than that if we pump + events through libinput, none of them should be from the first + device */ + litest_event(litest_device, EV_REL, REL_X, 1); + litest_event(litest_device, EV_REL, REL_Y, 1); + litest_event(litest_device, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + while ((event = libinput_get_event(li))) { + ck_assert(libinput_event_get_device(event) != device1); + libinput_event_destroy(event); + } + + litest_delete_device(litest_device); + libinput_device_unref(device1); + libinput_unref(li); +} +END_TEST + +START_TEST(device_reenable_device_removed) +{ + struct libinput *li; + struct litest_device *litest_device; + struct libinput_device *device; + enum libinput_config_status status; + + li = litest_create_context(); + litest_device = litest_add_device(li, LITEST_MOUSE); + device = litest_device->libinput_device; + + libinput_device_ref(device); + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_drain_events(li); + + litest_delete_device(litest_device); + litest_drain_events(li); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + /* can't really check for much here, this really just exercises the + code path. */ + litest_assert_empty_queue(li); + + libinput_device_unref(device); + libinput_unref(li); +} +END_TEST + +START_TEST(device_disable_release_buttons) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_device *device; + struct libinput_event *event; + struct libinput_event_pointer *ptrevent; + enum libinput_config_status status; + + device = dev->libinput_device; + + litest_button_click(dev, BTN_LEFT, true); + litest_drain_events(li); + litest_assert_empty_queue(li); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_wait_for_event(li); + event = libinput_get_event(li); + + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_BUTTON); + ptrevent = libinput_event_get_pointer_event(event); + ck_assert_int_eq(libinput_event_pointer_get_button(ptrevent), + BTN_LEFT); + ck_assert_int_eq(libinput_event_pointer_get_button_state(ptrevent), + LIBINPUT_BUTTON_STATE_RELEASED); + + libinput_event_destroy(event); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(device_disable_release_keys) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_device *device; + struct libinput_event *event; + struct libinput_event_keyboard *kbdevent; + enum libinput_config_status status; + + device = dev->libinput_device; + + litest_button_click(dev, KEY_A, true); + litest_drain_events(li); + litest_assert_empty_queue(li); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_wait_for_event(li); + event = libinput_get_event(li); + + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_KEYBOARD_KEY); + kbdevent = libinput_event_get_keyboard_event(event); + ck_assert_int_eq(libinput_event_keyboard_get_key(kbdevent), + KEY_A); + ck_assert_int_eq(libinput_event_keyboard_get_key_state(kbdevent), + LIBINPUT_KEY_STATE_RELEASED); + + libinput_event_destroy(event); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(device_disable_release_tap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_device *device; + enum libinput_config_status status; + + device = dev->libinput_device; + + libinput_device_config_tap_set_enabled(device, + LIBINPUT_CONFIG_TAP_ENABLED); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + /* tap happened before suspending, so we still expect the event */ + + litest_timeout_tap(); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); + + /* resume, make sure we don't get anything */ + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + libinput_dispatch(li); + litest_assert_empty_queue(li); + +} +END_TEST + +START_TEST(device_disable_release_tap_n_drag) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_device *device; + enum libinput_config_status status; + + device = dev->libinput_device; + + libinput_device_config_tap_set_enabled(device, + LIBINPUT_CONFIG_TAP_ENABLED); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 50, 50); + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + libinput_dispatch(li); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(device_disable_release_softbutton) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_device *device; + enum libinput_config_status status; + + device = dev->libinput_device; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 90, 90); + litest_button_click(dev, BTN_LEFT, true); + + /* make sure softbutton works */ + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + /* disable */ + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); + + litest_button_click(dev, BTN_LEFT, false); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); + + /* resume, make sure we don't get anything */ + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + libinput_dispatch(li); + litest_assert_empty_queue(li); + +} +END_TEST + +START_TEST(device_disable_topsoftbutton) +{ + struct litest_device *dev = litest_current_device(); + struct litest_device *trackpoint; + struct libinput *li = dev->libinput; + struct libinput_device *device; + enum libinput_config_status status; + + struct libinput_event *event; + struct libinput_event_pointer *ptrevent; + + device = dev->libinput_device; + + trackpoint = litest_add_device(li, LITEST_TRACKPOINT); + + status = libinput_device_config_send_events_set_mode(device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + litest_drain_events(li); + + litest_touch_down(dev, 0, 90, 10); + litest_button_click(dev, BTN_LEFT, true); + litest_button_click(dev, BTN_LEFT, false); + litest_touch_up(dev, 0); + + litest_wait_for_event(li); + event = libinput_get_event(li); + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_BUTTON); + ck_assert_ptr_eq(libinput_event_get_device(event), + trackpoint->libinput_device); + ptrevent = libinput_event_get_pointer_event(event); + ck_assert_int_eq(libinput_event_pointer_get_button(ptrevent), + BTN_RIGHT); + ck_assert_int_eq(libinput_event_pointer_get_button_state(ptrevent), + LIBINPUT_BUTTON_STATE_PRESSED); + libinput_event_destroy(event); + + event = libinput_get_event(li); + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_BUTTON); + ck_assert_ptr_eq(libinput_event_get_device(event), + trackpoint->libinput_device); + ptrevent = libinput_event_get_pointer_event(event); + ck_assert_int_eq(libinput_event_pointer_get_button(ptrevent), + BTN_RIGHT); + ck_assert_int_eq(libinput_event_pointer_get_button_state(ptrevent), + LIBINPUT_BUTTON_STATE_RELEASED); + libinput_event_destroy(event); + + litest_assert_empty_queue(li); + + litest_delete_device(trackpoint); +} +END_TEST + +START_TEST(device_ids) +{ + struct litest_device *dev = litest_current_device(); + const char *name; + unsigned int pid, vid; + + name = libevdev_get_name(dev->evdev); + pid = libevdev_get_id_product(dev->evdev); + vid = libevdev_get_id_vendor(dev->evdev); + + ck_assert_str_eq(name, + libinput_device_get_name(dev->libinput_device)); + ck_assert_int_eq(pid, + libinput_device_get_id_product(dev->libinput_device)); + ck_assert_int_eq(vid, + libinput_device_get_id_vendor(dev->libinput_device)); +} +END_TEST + +START_TEST(device_get_udev_handle) +{ + struct litest_device *dev = litest_current_device(); + struct udev_device *udev_device; + + udev_device = libinput_device_get_udev_device(dev->libinput_device); + ck_assert_notnull(udev_device); + udev_device_unref(udev_device); +} +END_TEST + +START_TEST(device_context) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_seat *seat; + + ck_assert(dev->libinput == libinput_device_get_context(dev->libinput_device)); + seat = libinput_device_get_seat(dev->libinput_device); + ck_assert(dev->libinput == libinput_seat_get_context(seat)); +} +END_TEST + +START_TEST(device_group_get) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device_group *group; + + int userdata = 10; + + group = libinput_device_get_device_group(dev->libinput_device); + ck_assert_notnull(group); + + libinput_device_group_ref(group); + + libinput_device_group_set_user_data(group, &userdata); + ck_assert_ptr_eq(&userdata, + libinput_device_group_get_user_data(group)); + + libinput_device_group_unref(group); +} +END_TEST + +START_TEST(device_group_ref) +{ + struct libinput *li = litest_create_context(); + struct litest_device *dev = litest_add_device(li, + LITEST_MOUSE); + struct libinput_device *device = dev->libinput_device; + struct libinput_device_group *group; + + group = libinput_device_get_device_group(device); + ck_assert_notnull(group); + libinput_device_group_ref(group); + + libinput_device_ref(device); + litest_drain_events(li); + litest_delete_device(dev); + litest_drain_events(li); + + /* make sure the device is dead but the group is still around */ + ck_assert(libinput_device_unref(device) == NULL); + + libinput_device_group_ref(group); + ck_assert_notnull(libinput_device_group_unref(group)); + ck_assert(libinput_device_group_unref(group) == NULL); + + libinput_unref(li); +} +END_TEST + +START_TEST(abs_device_no_absx) +{ + struct libevdev_uinput *uinput; + struct libinput *li; + struct libinput_device *device; + + uinput = litest_create_uinput_device("test device", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_ABS, ABS_Y, + -1); + li = litest_create_context(); + litest_disable_log_handler(li); + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput)); + litest_restore_log_handler(li); + ck_assert(device == NULL); + libinput_unref(li); + + libevdev_uinput_destroy(uinput); +} +END_TEST + +START_TEST(abs_device_no_absy) +{ + struct libevdev_uinput *uinput; + struct libinput *li; + struct libinput_device *device; + + uinput = litest_create_uinput_device("test device", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_ABS, ABS_X, + -1); + li = litest_create_context(); + litest_disable_log_handler(li); + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput)); + litest_restore_log_handler(li); + ck_assert(device == NULL); + libinput_unref(li); + + libevdev_uinput_destroy(uinput); +} +END_TEST + +START_TEST(abs_mt_device_no_absy) +{ + struct libevdev_uinput *uinput; + struct libinput *li; + struct libinput_device *device; + + uinput = litest_create_uinput_device("test device", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_ABS, ABS_X, + EV_ABS, ABS_Y, + EV_ABS, ABS_MT_SLOT, + EV_ABS, ABS_MT_POSITION_X, + -1); + li = litest_create_context(); + litest_disable_log_handler(li); + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput)); + litest_restore_log_handler(li); + ck_assert(device == NULL); + libinput_unref(li); + + libevdev_uinput_destroy(uinput); +} +END_TEST + +START_TEST(abs_mt_device_no_absx) +{ + struct libevdev_uinput *uinput; + struct libinput *li; + struct libinput_device *device; + + uinput = litest_create_uinput_device("test device", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_ABS, ABS_X, + EV_ABS, ABS_Y, + EV_ABS, ABS_MT_SLOT, + EV_ABS, ABS_MT_POSITION_Y, + -1); + li = litest_create_context(); + litest_disable_log_handler(li); + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput)); + litest_restore_log_handler(li); + ck_assert(device == NULL); + libinput_unref(li); + + libevdev_uinput_destroy(uinput); +} +END_TEST + +static void +assert_device_ignored(struct libinput *li, struct input_absinfo *absinfo) +{ + struct libevdev_uinput *uinput; + struct libinput_device *device; + + uinput = litest_create_uinput_abs_device("test device", NULL, + absinfo, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + -1); + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput)); + litest_assert_ptr_null(device); + libevdev_uinput_destroy(uinput); +} + +START_TEST(abs_device_no_range) +{ + struct libinput *li; + int code = _i; /* looped test */ + /* set x/y so libinput doesn't just reject for missing axes */ + struct input_absinfo absinfo[] = { + { ABS_X, 0, 10, 0, 0, 0 }, + { ABS_Y, 0, 10, 0, 0, 0 }, + { code, 0, 0, 0, 0, 0 }, + { -1, -1, -1, -1, -1, -1 } + }; + + li = litest_create_context(); + litest_disable_log_handler(li); + + assert_device_ignored(li, absinfo); + + litest_restore_log_handler(li); + libinput_unref(li); +} +END_TEST + +START_TEST(abs_mt_device_no_range) +{ + struct libinput *li; + int code = _i; /* looped test */ + /* set x/y so libinput doesn't just reject for missing axes */ + struct input_absinfo absinfo[] = { + { ABS_X, 0, 10, 0, 0, 0 }, + { ABS_Y, 0, 10, 0, 0, 0 }, + { ABS_MT_SLOT, 0, 10, 0, 0, 0 }, + { ABS_MT_TRACKING_ID, 0, 255, 0, 0, 0 }, + { ABS_MT_POSITION_X, 0, 10, 0, 0, 0 }, + { ABS_MT_POSITION_Y, 0, 10, 0, 0, 0 }, + { code, 0, 0, 0, 0, 0 }, + { -1, -1, -1, -1, -1, -1 } + }; + + li = litest_create_context(); + litest_disable_log_handler(li); + + if (code != ABS_MT_TOOL_TYPE && + code != ABS_MT_TRACKING_ID) /* kernel overrides it */ + assert_device_ignored(li, absinfo); + + litest_restore_log_handler(li); + libinput_unref(li); +} +END_TEST + +START_TEST(abs_device_missing_res) +{ + struct libinput *li; + struct input_absinfo absinfo[] = { + { ABS_X, 0, 10, 0, 0, 10 }, + { ABS_Y, 0, 10, 0, 0, 0 }, + { -1, -1, -1, -1, -1, -1 } + }; + + li = litest_create_context(); + litest_disable_log_handler(li); + + assert_device_ignored(li, absinfo); + + absinfo[0].resolution = 0; + absinfo[1].resolution = 20; + + assert_device_ignored(li, absinfo); + + litest_restore_log_handler(li); + libinput_unref(li); +} +END_TEST + +START_TEST(abs_mt_device_missing_res) +{ + struct libinput *li; + struct input_absinfo absinfo[] = { + { ABS_X, 0, 10, 0, 0, 10 }, + { ABS_Y, 0, 10, 0, 0, 10 }, + { ABS_MT_SLOT, 0, 2, 0, 0, 0 }, + { ABS_MT_TRACKING_ID, 0, 255, 0, 0, 0 }, + { ABS_MT_POSITION_X, 0, 10, 0, 0, 10 }, + { ABS_MT_POSITION_Y, 0, 10, 0, 0, 0 }, + { -1, -1, -1, -1, -1, -1 } + }; + + li = litest_create_context(); + litest_disable_log_handler(li); + assert_device_ignored(li, absinfo); + + absinfo[4].resolution = 0; + absinfo[5].resolution = 20; + + assert_device_ignored(li, absinfo); + + litest_restore_log_handler(li); + libinput_unref(li); + +} +END_TEST + +START_TEST(device_wheel_only) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + + ck_assert(libinput_device_has_capability(device, + LIBINPUT_DEVICE_CAP_POINTER)); +} +END_TEST + +START_TEST(device_udev_tag_alps) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + struct udev_device *d; + const char *prop; + + d = libinput_device_get_udev_device(device); + prop = udev_device_get_property_value(d, + "LIBINPUT_MODEL_ALPS_TOUCHPAD"); + + if (strstr(libinput_device_get_name(device), "ALPS")) + ck_assert_notnull(prop); + else + ck_assert(prop == NULL); + + udev_device_unref(d); +} +END_TEST + +START_TEST(device_udev_tag_wacom) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + struct udev_device *d; + const char *prop; + + d = libinput_device_get_udev_device(device); + prop = udev_device_get_property_value(d, + "LIBINPUT_MODEL_WACOM_TOUCHPAD"); + + if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM) + ck_assert_notnull(prop); + else + ck_assert(prop == NULL); + + udev_device_unref(d); +} +END_TEST + +START_TEST(device_udev_tag_apple) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + struct udev_device *d; + const char *prop; + + d = libinput_device_get_udev_device(device); + prop = udev_device_get_property_value(d, + "LIBINPUT_MODEL_WACOM_TOUCHPAD"); + + if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM) + ck_assert_notnull(prop); + else + ck_assert(prop == NULL); + + udev_device_unref(d); +} +END_TEST + +START_TEST(device_udev_tag_synaptics_serial) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + struct udev_device *d; + const char *prop; + + d = libinput_device_get_udev_device(device); + prop = udev_device_get_property_value(d, + "LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD"); + + if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_SYNAPTICS_SERIAL && + libevdev_get_id_product(dev->evdev) == PRODUCT_ID_SYNAPTICS_SERIAL) + ck_assert_notnull(prop); + else + ck_assert(prop == NULL); + + udev_device_unref(d); +} +END_TEST + +void +litest_setup_tests(void) +{ + struct range abs_range = { 0, ABS_MISC }; + struct range abs_mt_range = { ABS_MT_SLOT + 1, ABS_CNT }; + + litest_add("device:sendevents", device_sendevents_config, LITEST_ANY, LITEST_TOUCHPAD); + litest_add("device:sendevents", device_sendevents_config_invalid, LITEST_ANY, LITEST_ANY); + litest_add("device:sendevents", device_sendevents_config_touchpad, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("device:sendevents", device_sendevents_config_touchpad_superset, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("device:sendevents", device_sendevents_config_default, LITEST_ANY, LITEST_ANY); + litest_add("device:sendevents", device_disable, LITEST_RELATIVE, LITEST_ANY); + litest_add("device:sendevents", device_disable_touchpad, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("device:sendevents", device_disable_events_pending, LITEST_RELATIVE, LITEST_TOUCHPAD); + litest_add("device:sendevents", device_double_disable, LITEST_ANY, LITEST_ANY); + litest_add("device:sendevents", device_double_enable, LITEST_ANY, LITEST_ANY); + litest_add_no_device("device:sendevents", device_reenable_syspath_changed); + litest_add_no_device("device:sendevents", device_reenable_device_removed); + litest_add_for_device("device:sendevents", device_disable_release_buttons, LITEST_MOUSE); + litest_add_for_device("device:sendevents", device_disable_release_keys, LITEST_KEYBOARD); + litest_add("device:sendevents", device_disable_release_tap, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("device:sendevents", device_disable_release_tap_n_drag, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("device:sendevents", device_disable_release_softbutton, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("device:sendevents", device_disable_topsoftbutton, LITEST_TOPBUTTONPAD, LITEST_ANY); + litest_add("device:id", device_ids, LITEST_ANY, LITEST_ANY); + litest_add_for_device("device:context", device_context, LITEST_SYNAPTICS_CLICKPAD); + + litest_add("device:udev", device_get_udev_handle, LITEST_ANY, LITEST_ANY); + + litest_add("device:group", device_group_get, LITEST_ANY, LITEST_ANY); + litest_add_no_device("device:group", device_group_ref); + + litest_add_no_device("device:invalid devices", abs_device_no_absx); + litest_add_no_device("device:invalid devices", abs_device_no_absy); + litest_add_no_device("device:invalid devices", abs_mt_device_no_absx); + litest_add_no_device("device:invalid devices", abs_mt_device_no_absy); + litest_add_ranged_no_device("device:invalid devices", abs_device_no_range, &abs_range); + litest_add_ranged_no_device("device:invalid devices", abs_mt_device_no_range, &abs_mt_range); + litest_add_no_device("device:invalid devices", abs_device_missing_res); + litest_add_no_device("device:invalid devices", abs_mt_device_missing_res); + + litest_add("device:wheel", device_wheel_only, LITEST_WHEEL, LITEST_RELATIVE|LITEST_ABSOLUTE); + + litest_add("device:udev tags", device_udev_tag_alps, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("device:udev tags", device_udev_tag_wacom, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("device:udev tags", device_udev_tag_apple, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("device:udev tags", device_udev_tag_synaptics_serial, LITEST_TOUCHPAD, LITEST_ANY); +} diff -Nru libinput-1.10.3/test/generate-gcov-report.sh libinput-0.21.0/test/generate-gcov-report.sh --- libinput-1.10.3/test/generate-gcov-report.sh 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/generate-gcov-report.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -#!/bin/bash -e - -if [[ $# -lt 2 ]]; then - echo "Usage: ./generate-gcov-report.sh [ ... ]" - exit 1 -fi - -target_dir=$1 -shift -source_dirs=$* - -if [[ "${target_dir:0:1}" != '/' ]]; then - target_dir="$PWD/$target_dir" -fi -summary_file="$target_dir/summary.txt" - -mkdir -p "$target_dir" -rm -f "$target_dir"/*.gcov - -for dir in $source_dirs; do - pushd "$dir" > /dev/null - for file in *.c; do - find ./ -name "*${file/\.c/.gcda}" \ - \! -path "*selftest*" \ - -exec gcov {} \; > /dev/null - done - find ./ -name "*.gcov" \ - \! -path "*/`basename "$target_dir"`/*" \ - -exec mv {} "$target_dir" \; - popd > /dev/null -done - -echo "========== coverage report ========" > "$summary_file" -for file in "$target_dir"/*.gcov; do - total=`grep -v " -:" "$file" | wc -l` - missing=`grep "#####" "$file" | wc -l` - hit=$((total - missing)); - percent=$((($hit * 100)/$total)) - fname=`basename "$file"` - printf "%-50s total lines: %4s not tested: %4s (%3s%%)\n" "$fname" "$total" "$missing" "$percent">> "$summary_file" -done -echo "========== =============== ========" >> "$summary_file" diff -Nru libinput-1.10.3/test/gestures.c libinput-0.21.0/test/gestures.c --- libinput-1.10.3/test/gestures.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/gestures.c 2015-08-03 04:35:00.000000000 +0000 @@ -0,0 +1,405 @@ +/* + * Copyright © 2015 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include + +#include +#include + +#include "libinput-util.h" +#include "litest.h" + +START_TEST(gestures_cap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + + if (litest_is_synaptics_semi_mt(dev)) + ck_assert(!libinput_device_has_capability(device, + LIBINPUT_DEVICE_CAP_GESTURE)); + else + ck_assert(libinput_device_has_capability(device, + LIBINPUT_DEVICE_CAP_GESTURE)); +} +END_TEST + +START_TEST(gestures_nocap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + + ck_assert(!libinput_device_has_capability(device, + LIBINPUT_DEVICE_CAP_GESTURE)); +} +END_TEST + +START_TEST(gestures_swipe_3fg) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_gesture *gevent; + double dx, dy; + int cardinal = _i; /* ranged test */ + double dir_x, dir_y; + int cardinals[8][2] = { + { 0, 30 }, + { 30, 30 }, + { 30, 0 }, + { 30, -30 }, + { 0, -30 }, + { -30, -30 }, + { -30, 0 }, + { -30, 30 }, + }; + + if (libevdev_get_num_slots(dev->evdev) < 3) + return; + + dir_x = cardinals[cardinal][0]; + dir_y = cardinals[cardinal][1]; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 40, 40); + litest_touch_down(dev, 1, 40, 50); + litest_touch_down(dev, 2, 40, 60); + libinput_dispatch(li); + litest_touch_move_three_touches(dev, + 40, 40, + 40, 50, + 40, 60, + dir_x, dir_y, + 10, 2); + libinput_dispatch(li); + + event = libinput_get_event(li); + gevent = litest_is_gesture_event(event, + LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN, + 3); + dx = libinput_event_gesture_get_dx(gevent); + dy = libinput_event_gesture_get_dy(gevent); + ck_assert(dx == 0.0); + ck_assert(dy == 0.0); + libinput_event_destroy(event); + + while ((event = libinput_get_event(li)) != NULL) { + gevent = litest_is_gesture_event(event, + LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, + 3); + + dx = libinput_event_gesture_get_dx(gevent); + dy = libinput_event_gesture_get_dy(gevent); + debug_trace("delta: %.2f/%.2f\n", dx, dy); + if (dir_x == 0.0) + ck_assert(dx == 0.0); + else if (dir_x < 0.0) + ck_assert(dx < 0.0); + else if (dir_x > 0.0) + ck_assert(dx > 0.0); + + if (dir_y == 0.0) + ck_assert(dy == 0.0); + else if (dir_y < 0.0) + ck_assert(dy < 0.0); + else if (dir_y > 0.0) + ck_assert(dy > 0.0); + + dx = libinput_event_gesture_get_dx_unaccelerated(gevent); + dy = libinput_event_gesture_get_dy_unaccelerated(gevent); + if (dir_x == 0.0) + ck_assert(dx == 0.0); + else if (dir_x < 0.0) + ck_assert(dx < 0.0); + else if (dir_x > 0.0) + ck_assert(dx > 0.0); + + if (dir_y == 0.0) + ck_assert(dy == 0.0); + else if (dir_y < 0.0) + ck_assert(dy < 0.0); + else if (dir_y > 0.0) + ck_assert(dy > 0.0); + + libinput_event_destroy(event); + } + + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + litest_touch_up(dev, 2); + libinput_dispatch(li); + event = libinput_get_event(li); + gevent = litest_is_gesture_event(event, + LIBINPUT_EVENT_GESTURE_SWIPE_END, + 3); + ck_assert(!libinput_event_gesture_get_cancelled(gevent)); + libinput_event_destroy(event); +} +END_TEST + +START_TEST(gestures_pinch) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_gesture *gevent; + double dx, dy; + int cardinal = _i; /* ranged test */ + double dir_x, dir_y; + int i; + double scale, oldscale; + double angle; + int cardinals[8][2] = { + { 0, 30 }, + { 30, 30 }, + { 30, 0 }, + { 30, -30 }, + { 0, -30 }, + { -30, -30 }, + { -30, 0 }, + { -30, 30 }, + }; + + if (libevdev_get_num_slots(dev->evdev) < 3) + return; + + dir_x = cardinals[cardinal][0]; + dir_y = cardinals[cardinal][1]; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y); + litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y); + libinput_dispatch(li); + + for (i = 0; i < 8; i++) { + litest_push_event_frame(dev); + if (dir_x > 0.0) + dir_x -= 3; + else if (dir_x < 0.0) + dir_x += 3; + if (dir_y > 0.0) + dir_y -= 3; + else if (dir_y < 0.0) + dir_y += 3; + litest_touch_move(dev, + 0, + 50 + dir_x, + 50 + dir_y); + litest_touch_move(dev, + 1, + 50 - dir_x, + 50 - dir_y); + litest_pop_event_frame(dev); + libinput_dispatch(li); + } + + event = libinput_get_event(li); + gevent = litest_is_gesture_event(event, + LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, + 2); + dx = libinput_event_gesture_get_dx(gevent); + dy = libinput_event_gesture_get_dy(gevent); + scale = libinput_event_gesture_get_scale(gevent); + ck_assert(dx == 0.0); + ck_assert(dy == 0.0); + ck_assert(scale == 1.0); + + libinput_event_destroy(event); + + while ((event = libinput_get_event(li)) != NULL) { + gevent = litest_is_gesture_event(event, + LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, + 2); + + oldscale = scale; + scale = libinput_event_gesture_get_scale(gevent); + + ck_assert(scale < oldscale); + + angle = libinput_event_gesture_get_angle_delta(gevent); + ck_assert_double_le(fabs(angle), 1.0); + + libinput_event_destroy(event); + libinput_dispatch(li); + } + + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + libinput_dispatch(li); + event = libinput_get_event(li); + gevent = litest_is_gesture_event(event, + LIBINPUT_EVENT_GESTURE_PINCH_END, + 2); + ck_assert(!libinput_event_gesture_get_cancelled(gevent)); + libinput_event_destroy(event); +} +END_TEST + +START_TEST(gestures_spread) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_gesture *gevent; + double dx, dy; + int cardinal = _i; /* ranged test */ + double dir_x, dir_y; + int i; + double scale, oldscale; + double angle; + int cardinals[8][2] = { + { 0, 1 }, + { 1, 1 }, + { 1, 0 }, + { 1, -1 }, + { 0, -1 }, + { -1, -1 }, + { -1, 0 }, + { -1, 1 }, + }; + + if (libevdev_get_num_slots(dev->evdev) < 3) + return; + + dir_x = cardinals[cardinal][0]; + dir_y = cardinals[cardinal][1]; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y); + litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y); + libinput_dispatch(li); + + for (i = 0; i < 15; i++) { + litest_push_event_frame(dev); + if (dir_x > 0.0) + dir_x += 2; + else if (dir_x < 0.0) + dir_x -= 2; + if (dir_y > 0.0) + dir_y += 2; + else if (dir_y < 0.0) + dir_y -= 2; + litest_touch_move(dev, + 0, + 50 + dir_x, + 50 + dir_y); + litest_touch_move(dev, + 1, + 50 - dir_x, + 50 - dir_y); + litest_pop_event_frame(dev); + libinput_dispatch(li); + } + + event = libinput_get_event(li); + gevent = litest_is_gesture_event(event, + LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, + 2); + dx = libinput_event_gesture_get_dx(gevent); + dy = libinput_event_gesture_get_dy(gevent); + scale = libinput_event_gesture_get_scale(gevent); + ck_assert(dx == 0.0); + ck_assert(dy == 0.0); + ck_assert(scale == 1.0); + + libinput_event_destroy(event); + + while ((event = libinput_get_event(li)) != NULL) { + gevent = litest_is_gesture_event(event, + LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, + 2); + oldscale = scale; + scale = libinput_event_gesture_get_scale(gevent); + ck_assert(scale > oldscale); + + angle = libinput_event_gesture_get_angle_delta(gevent); + ck_assert_double_le(fabs(angle), 1.0); + + libinput_event_destroy(event); + libinput_dispatch(li); + } + + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + libinput_dispatch(li); + event = libinput_get_event(li); + gevent = litest_is_gesture_event(event, + LIBINPUT_EVENT_GESTURE_PINCH_END, + 2); + ck_assert(!libinput_event_gesture_get_cancelled(gevent)); + libinput_event_destroy(event); +} +END_TEST + +START_TEST(gestures_time_usec) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_gesture *gevent; + + if (libevdev_get_num_slots(dev->evdev) < 3) + return; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 40, 40); + litest_touch_down(dev, 1, 40, 50); + litest_touch_down(dev, 2, 40, 60); + libinput_dispatch(li); + litest_touch_move_three_touches(dev, + 40, 40, + 40, 50, + 40, 60, + 0, 30, + 4, 2); + + litest_wait_for_event(li); + + event = libinput_get_event(li); + gevent = litest_is_gesture_event(event, + LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN, + 3); + ck_assert_int_eq(libinput_event_gesture_get_time(gevent), + libinput_event_gesture_get_time_usec(gevent) / 1000); + libinput_event_destroy(event); +} +END_TEST + +void +litest_setup_tests(void) +{ + /* N, NE, ... */ + struct range cardinals = { 0, 8 }; + + litest_add("gestures:cap", gestures_cap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("gestures:cap", gestures_nocap, LITEST_ANY, LITEST_TOUCHPAD); + + litest_add_ranged("gestures:swipe", gestures_swipe_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); + litest_add_ranged("gestures:pinch", gestures_pinch, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); + litest_add_ranged("gestures:pinch", gestures_spread, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); + + litest_add("gesture:time", gestures_time_usec, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); +} diff -Nru libinput-1.10.3/test/keyboard.c libinput-0.21.0/test/keyboard.c --- libinput-1.10.3/test/keyboard.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/keyboard.c 2015-08-03 03:44:47.000000000 +0000 @@ -0,0 +1,352 @@ +/* + * Copyright © 2014 Jonas Ådahl + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include "config.h" + +#include +#include + +#include "libinput-util.h" +#include "litest.h" + +START_TEST(keyboard_seat_key_count) +{ + const int num_devices = 4; + struct litest_device *devices[num_devices]; + struct libinput *libinput; + struct libinput_event *ev; + struct libinput_event_keyboard *kev; + int i; + int seat_key_count = 0; + int expected_key_button_count = 0; + char device_name[255]; + + libinput = litest_create_context(); + for (i = 0; i < num_devices; ++i) { + sprintf(device_name, "litest Generic keyboard (%d)", i); + devices[i] = litest_add_device_with_overrides(libinput, + LITEST_KEYBOARD, + device_name, + NULL, NULL, NULL); + } + + for (i = 0; i < num_devices; ++i) + litest_keyboard_key(devices[i], KEY_A, true); + + libinput_dispatch(libinput); + while ((ev = libinput_get_event(libinput))) { + if (libinput_event_get_type(ev) != + LIBINPUT_EVENT_KEYBOARD_KEY) { + libinput_event_destroy(ev); + libinput_dispatch(libinput); + continue; + } + + kev = litest_is_keyboard_event(ev, + KEY_A, + LIBINPUT_KEY_STATE_PRESSED); + + ++expected_key_button_count; + seat_key_count = + libinput_event_keyboard_get_seat_key_count(kev); + ck_assert_int_eq(expected_key_button_count, seat_key_count); + + libinput_event_destroy(ev); + libinput_dispatch(libinput); + } + + ck_assert_int_eq(seat_key_count, num_devices); + + for (i = 0; i < num_devices; ++i) + litest_keyboard_key(devices[i], KEY_A, false); + + libinput_dispatch(libinput); + while ((ev = libinput_get_event(libinput))) { + if (libinput_event_get_type(ev) != + LIBINPUT_EVENT_KEYBOARD_KEY) { + libinput_event_destroy(ev); + libinput_dispatch(libinput); + continue; + } + + kev = libinput_event_get_keyboard_event(ev); + ck_assert_notnull(kev); + ck_assert_int_eq(libinput_event_keyboard_get_key(kev), KEY_A); + ck_assert_int_eq(libinput_event_keyboard_get_key_state(kev), + LIBINPUT_KEY_STATE_RELEASED); + + --expected_key_button_count; + seat_key_count = + libinput_event_keyboard_get_seat_key_count(kev); + ck_assert_int_eq(expected_key_button_count, seat_key_count); + + libinput_event_destroy(ev); + libinput_dispatch(libinput); + } + + ck_assert_int_eq(seat_key_count, 0); + + for (i = 0; i < num_devices; ++i) + litest_delete_device(devices[i]); + libinput_unref(libinput); +} +END_TEST + +START_TEST(keyboard_ignore_no_pressed_release) +{ + struct litest_device *dev; + struct libinput *unused_libinput; + struct libinput *libinput; + struct libinput_event *event; + struct libinput_event_keyboard *kevent; + int events[] = { + EV_KEY, KEY_A, + -1, -1, + }; + enum libinput_key_state *state; + enum libinput_key_state expected_states[] = { + LIBINPUT_KEY_STATE_PRESSED, + LIBINPUT_KEY_STATE_RELEASED, + }; + + /* We can't send pressed -> released -> pressed events using uinput + * as such non-symmetric events are dropped. Work-around this by first + * adding the test device to the tested context after having sent an + * initial pressed event. */ + unused_libinput = litest_create_context(); + dev = litest_add_device_with_overrides(unused_libinput, + LITEST_KEYBOARD, + "Generic keyboard", + NULL, NULL, events); + + litest_keyboard_key(dev, KEY_A, true); + litest_drain_events(unused_libinput); + + libinput = litest_create_context(); + libinput_path_add_device(libinput, + libevdev_uinput_get_devnode(dev->uinput)); + litest_drain_events(libinput); + + litest_keyboard_key(dev, KEY_A, false); + litest_keyboard_key(dev, KEY_A, true); + litest_keyboard_key(dev, KEY_A, false); + + libinput_dispatch(libinput); + + ARRAY_FOR_EACH(expected_states, state) { + event = libinput_get_event(libinput); + ck_assert_notnull(event); + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_KEYBOARD_KEY); + kevent = libinput_event_get_keyboard_event(event); + ck_assert_int_eq(libinput_event_keyboard_get_key(kevent), + KEY_A); + ck_assert_int_eq(libinput_event_keyboard_get_key_state(kevent), + *state); + libinput_event_destroy(event); + libinput_dispatch(libinput); + } + + litest_assert_empty_queue(libinput); + litest_delete_device(dev); + libinput_unref(libinput); + libinput_unref(unused_libinput); +} +END_TEST + +START_TEST(keyboard_key_auto_release) +{ + struct libinput *libinput; + struct litest_device *dev; + struct libinput_event *event; + enum libinput_event_type type; + struct libinput_event_keyboard *kevent; + struct { + int code; + int released; + } keys[] = { + { .code = KEY_A, }, + { .code = KEY_S, }, + { .code = KEY_D, }, + { .code = KEY_G, }, + { .code = KEY_Z, }, + { .code = KEY_DELETE, }, + { .code = KEY_F24, }, + }; + int events[2 * (ARRAY_LENGTH(keys) + 1)]; + unsigned i; + int key; + int valid_code; + + /* Enable all tested keys on the device */ + i = 0; + while (i < 2 * ARRAY_LENGTH(keys)) { + key = keys[i / 2].code; + events[i++] = EV_KEY; + events[i++] = key; + } + events[i++] = -1; + events[i++] = -1; + + libinput = litest_create_context(); + dev = litest_add_device_with_overrides(libinput, + LITEST_KEYBOARD, + "Generic keyboard", + NULL, NULL, events); + + litest_drain_events(libinput); + + /* Send pressed events, without releasing */ + for (i = 0; i < ARRAY_LENGTH(keys); ++i) { + key = keys[i].code; + litest_event(dev, EV_KEY, key, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(libinput); + + event = libinput_get_event(libinput); + kevent = litest_is_keyboard_event(event, + key, + LIBINPUT_KEY_STATE_PRESSED); + libinput_event_destroy(event); + } + + litest_drain_events(libinput); + + /* "Disconnect" device */ + litest_delete_device(dev); + + /* Mark all released keys until device is removed */ + while (1) { + event = libinput_get_event(libinput); + ck_assert_notnull(event); + type = libinput_event_get_type(event); + + if (type == LIBINPUT_EVENT_DEVICE_REMOVED) { + libinput_event_destroy(event); + break; + } + + ck_assert_int_eq(type, LIBINPUT_EVENT_KEYBOARD_KEY); + kevent = libinput_event_get_keyboard_event(event); + ck_assert_int_eq(libinput_event_keyboard_get_key_state(kevent), + LIBINPUT_KEY_STATE_RELEASED); + key = libinput_event_keyboard_get_key(kevent); + + valid_code = 0; + for (i = 0; i < ARRAY_LENGTH(keys); ++i) { + if (keys[i].code == key) { + ck_assert_int_eq(keys[i].released, 0); + keys[i].released = 1; + valid_code = 1; + } + } + ck_assert_int_eq(valid_code, 1); + libinput_event_destroy(event); + } + + /* Check that all pressed keys has been released. */ + for (i = 0; i < ARRAY_LENGTH(keys); ++i) { + ck_assert_int_eq(keys[i].released, 1); + } + + libinput_unref(libinput); +} +END_TEST + +START_TEST(keyboard_has_key) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + unsigned int code; + int evdev_has, libinput_has; + + ck_assert(libinput_device_has_capability( + device, + LIBINPUT_DEVICE_CAP_KEYBOARD)); + + for (code = 0; code < KEY_CNT; code++) { + evdev_has = libevdev_has_event_code(dev->evdev, EV_KEY, code); + libinput_has = libinput_device_keyboard_has_key(device, code); + ck_assert_int_eq(evdev_has, libinput_has); + } +} +END_TEST + +START_TEST(keyboard_keys_bad_device) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + unsigned int code; + int has_key; + + if (libinput_device_has_capability(device, + LIBINPUT_DEVICE_CAP_KEYBOARD)) + return; + + for (code = 0; code < KEY_CNT; code++) { + has_key = libinput_device_keyboard_has_key(device, code); + ck_assert_int_eq(has_key, -1); + } +} +END_TEST + +START_TEST(keyboard_time_usec) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event_keyboard *kev; + struct libinput_event *event; + + if (!libevdev_has_event_code(dev->evdev, EV_KEY, KEY_A)) + return; + + litest_drain_events(dev->libinput); + + litest_keyboard_key(dev, KEY_A, true); + + litest_wait_for_event(li); + + event = libinput_get_event(li); + kev = litest_is_keyboard_event(event, + KEY_A, + LIBINPUT_KEY_STATE_PRESSED); + + ck_assert_int_eq(libinput_event_keyboard_get_time(kev), + libinput_event_keyboard_get_time_usec(kev) / 1000); + + libinput_event_destroy(event); + litest_drain_events(dev->libinput); +} +END_TEST + +void +litest_setup_tests(void) +{ + litest_add_no_device("keyboard:seat key count", keyboard_seat_key_count); + litest_add_no_device("keyboard:key counting", keyboard_ignore_no_pressed_release); + litest_add_no_device("keyboard:key counting", keyboard_key_auto_release); + litest_add("keyboard:keys", keyboard_has_key, LITEST_KEYS, LITEST_ANY); + litest_add("keyboard:keys", keyboard_keys_bad_device, LITEST_ANY, LITEST_ANY); + litest_add("keyboard:time", keyboard_time_usec, LITEST_KEYS, LITEST_ANY); +} diff -Nru libinput-1.10.3/test/litest.c libinput-0.21.0/test/litest.c --- libinput-1.10.3/test/litest.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest.c 2015-08-03 03:44:47.000000000 +0000 @@ -22,35 +22,29 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif +#include #include #include #include -#include #include #include #include #include -#include #include #include #include -#include #include #include #include "linux/input.h" #include -#include #include #include #include -#include -#include #include -#if HAVE_LIBSYSTEMD -#include -#endif #include "litest.h" #include "litest-int.h" @@ -60,31 +54,20 @@ #define UDEV_RULE_PREFIX "99-litest-" #define UDEV_HWDB_D "/etc/udev/hwdb.d" #define UDEV_MODEL_QUIRKS_RULE_FILE UDEV_RULES_D \ - "/91-litest-model-quirks-REMOVEME-XXXXXX.rules" + "/91-litest-model-quirks-REMOVEME.rules" #define UDEV_MODEL_QUIRKS_HWDB_FILE UDEV_HWDB_D \ - "/91-litest-model-quirks-REMOVEME-XXXXXX.hwdb" + "/91-litest-model-quirks-REMOVEME.hwdb" #define UDEV_TEST_DEVICE_RULE_FILE UDEV_RULES_D \ - "/91-litest-test-device-REMOVEME-XXXXXXX.rules" -#define UDEV_DEVICE_GROUPS_FILE UDEV_RULES_D \ - "/80-libinput-device-groups-litest-XXXXXX.rules" + "/91-litest-test-device-REMOVEME.rules" -static int jobs = 8; static int in_debugger = -1; static int verbose = 0; const char *filter_test = NULL; const char *filter_device = NULL; const char *filter_group = NULL; -struct created_file { - struct list link; - char *path; -}; - -struct list created_files_list; /* list of all files to remove at the end of - the test run */ - -static void litest_init_udev_rules(struct list *created_files_list); -static void litest_remove_udev_rules(struct list *created_files_list); +static inline void litest_remove_model_quirks(void); +static void litest_init_udev_rules(void); /* defined for the litest selftest */ #ifndef LITEST_DISABLE_BACKTRACE_LOGGING @@ -95,7 +78,7 @@ #define litest_vlog(...) { /* __VA_ARGS__ */ } #endif -#if HAVE_LIBUNWIND +#ifdef HAVE_LIBUNWIND #define UNW_LOCAL_ONLY #include #include @@ -178,6 +161,8 @@ char procname[256]; Dl_info dlinfo; /* filename and i are unused ifdef LITEST_SHUTUP */ + const char *filename __attribute__((unused)); + int i __attribute__((unused)) = 0; pip.unwind_info = NULL; ret = unw_getcontext(&context); @@ -202,8 +187,6 @@ char file[PATH_MAX]; int line; bool have_lineno = false; - const char *filename = "?"; - int i = 0; ret = unw_get_proc_info(&cursor, &pip); if (ret) { @@ -231,6 +214,8 @@ (pip.start_ip + off), file, &line); + } else { + filename = "?"; } if (have_lineno) { @@ -266,8 +251,6 @@ } #endif -LIBINPUT_ATTRIBUTE_PRINTF(5, 6) -__attribute__((noreturn)) void litest_fail_condition(const char *file, int line, @@ -290,7 +273,6 @@ abort(); } -__attribute__((noreturn)) void litest_fail_comparison_int(const char *file, int line, @@ -308,7 +290,6 @@ abort(); } -__attribute__((noreturn)) void litest_fail_comparison_ptr(const char *file, int line, @@ -324,18 +305,15 @@ struct test { struct list node; char *name; - char *devname; - void *func; - void *setup; - void *teardown; - - struct range range; + TCase *tc; + enum litest_device_type devices; }; struct suite { struct list node; struct list tests; char *name; + Suite *suite; }; static struct litest_device *current_device; @@ -356,7 +334,68 @@ current_device = NULL; } -struct litest_test_device** devices; +extern struct litest_test_device litest_keyboard_device; +extern struct litest_test_device litest_synaptics_clickpad_device; +extern struct litest_test_device litest_synaptics_touchpad_device; +extern struct litest_test_device litest_synaptics_t440_device; +extern struct litest_test_device litest_trackpoint_device; +extern struct litest_test_device litest_bcm5974_device; +extern struct litest_test_device litest_mouse_device; +extern struct litest_test_device litest_wacom_touch_device; +extern struct litest_test_device litest_alps_device; +extern struct litest_test_device litest_generic_singletouch_device; +extern struct litest_test_device litest_qemu_tablet_device; +extern struct litest_test_device litest_xen_virtual_pointer_device; +extern struct litest_test_device litest_vmware_virtmouse_device; +extern struct litest_test_device litest_synaptics_hover_device; +extern struct litest_test_device litest_synaptics_carbon3rd_device; +extern struct litest_test_device litest_protocol_a_screen; +extern struct litest_test_device litest_wacom_finger_device; +extern struct litest_test_device litest_keyboard_blackwidow_device; +extern struct litest_test_device litest_wheel_only_device; +extern struct litest_test_device litest_mouse_roccat_device; +extern struct litest_test_device litest_ms_surface_cover_device; +extern struct litest_test_device litest_logitech_trackball_device; +extern struct litest_test_device litest_atmel_hover_device; +extern struct litest_test_device litest_alps_dualpoint_device; +extern struct litest_test_device litest_mouse_low_dpi_device; +extern struct litest_test_device litest_generic_multitouch_screen_device; +extern struct litest_test_device litest_nexus4_device; +extern struct litest_test_device litest_magicpad_device; +extern struct litest_test_device litest_elantech_touchpad_device; + +struct litest_test_device* devices[] = { + &litest_synaptics_clickpad_device, + &litest_synaptics_touchpad_device, + &litest_synaptics_t440_device, + &litest_keyboard_device, + &litest_trackpoint_device, + &litest_bcm5974_device, + &litest_mouse_device, + &litest_wacom_touch_device, + &litest_alps_device, + &litest_generic_singletouch_device, + &litest_qemu_tablet_device, + &litest_xen_virtual_pointer_device, + &litest_vmware_virtmouse_device, + &litest_synaptics_hover_device, + &litest_synaptics_carbon3rd_device, + &litest_protocol_a_screen, + &litest_wacom_finger_device, + &litest_keyboard_blackwidow_device, + &litest_wheel_only_device, + &litest_mouse_roccat_device, + &litest_ms_surface_cover_device, + &litest_logitech_trackball_device, + &litest_atmel_hover_device, + &litest_alps_dualpoint_device, + &litest_mouse_low_dpi_device, + &litest_generic_multitouch_screen_device, + &litest_nexus4_device, + &litest_magicpad_device, + &litest_elantech_touchpad_device, + NULL, +}; static struct list all_tests; @@ -388,6 +427,49 @@ litest_system("udevadm hwdb --update"); } +static int +litest_udev_rule_filter(const struct dirent *entry) +{ + return strneq(entry->d_name, + UDEV_RULE_PREFIX, + strlen(UDEV_RULE_PREFIX)); +} + +static void +litest_drop_udev_rules(void) +{ + int n; + int rc; + struct dirent **entries; + char path[PATH_MAX]; + + n = scandir(UDEV_RULES_D, + &entries, + litest_udev_rule_filter, + alphasort); + if (n <= 0) + return; + + while (n--) { + rc = snprintf(path, sizeof(path), + "%s/%s", + UDEV_RULES_D, + entries[n]->d_name); + if (rc > 0 && + (size_t)rc == strlen(UDEV_RULES_D) + + strlen(entries[n]->d_name) + 1) + unlink(path); + else + fprintf(stderr, + "Failed to delete %s. Remaining tests are unreliable\n", + entries[n]->d_name); + free(entries[n]); + } + free(entries); + + litest_reload_udev_rules(); +} + static void litest_add_tcase_for_device(struct suite *suite, const char *funcname, @@ -396,43 +478,76 @@ const struct range *range) { struct test *t; + const char *test_name = dev->shortname; - t = zalloc(sizeof(*t)); - t->name = safe_strdup(funcname); - t->devname = safe_strdup(dev->shortname); - t->func = func; - t->setup = dev->setup; - t->teardown = dev->teardown ? - dev->teardown : litest_generic_device_teardown; - if (range) - t->range = *range; + list_for_each(t, &suite->tests, node) { + if (!streq(t->name, test_name)) + continue; + + if (range) + tcase_add_loop_test(t->tc, + func, + range->lower, + range->upper); + else + tcase_add_test(t->tc, func); + return; + } + t = zalloc(sizeof(*t)); + assert(t != NULL); + t->name = strdup(test_name); + t->tc = tcase_create(test_name); list_insert(&suite->tests, &t->node); + /* we can't guarantee that we clean up properly if a test fails, the + udev rules used for a previous test may still be in place. Add an + unchecked fixture to always clean up all rules before/after a + test case completes */ + tcase_add_unchecked_fixture(t->tc, + litest_drop_udev_rules, + litest_drop_udev_rules); + tcase_add_checked_fixture(t->tc, dev->setup, + dev->teardown ? dev->teardown : litest_generic_device_teardown); + if (range) + tcase_add_loop_test(t->tc, + func, + range->lower, + range->upper); + else + tcase_add_test(t->tc, func); + suite_add_tcase(suite->suite, t->tc); } static void litest_add_tcase_no_device(struct suite *suite, void *func, - const char *funcname, const struct range *range) { struct test *t; - const char *test_name = funcname; + const char *test_name = "no device"; if (filter_device && fnmatch(filter_device, test_name, 0) != 0) return; - t = zalloc(sizeof(*t)); - t->name = safe_strdup(test_name); - t->devname = safe_strdup("no device"); - t->func = func; - if (range) - t->range = *range; - t->setup = NULL; - t->teardown = NULL; + list_for_each(t, &suite->tests, node) { + if (!streq(t->name, test_name)) + continue; + + if (range) + tcase_add_loop_test(t->tc, func, range->lower, range->upper); + else + tcase_add_test(t->tc, func); + return; + } + t = zalloc(sizeof(*t)); + assert(t != NULL); + t->name = strdup(test_name); + t->tc = tcase_create(test_name); list_insert(&suite->tests, &t->node); + tcase_add_test(t->tc, func); + suite_add_tcase(suite->suite, t->tc); } static struct suite * @@ -440,13 +555,18 @@ { struct suite *s; + if (all_tests.next == NULL && all_tests.prev == NULL) + list_init(&all_tests); + list_for_each(s, &all_tests, node) { if (streq(s->name, name)) return s; } s = zalloc(sizeof(*s)); - s->name = safe_strdup(name); + assert(s != NULL); + s->name = strdup(name); + s->suite = suite_create(s->name); list_init(&s->tests); list_insert(&all_tests, &s->node); @@ -464,10 +584,9 @@ { struct litest_test_device **dev = devices; struct suite *suite; - bool added = false; - litest_assert(required >= LITEST_DISABLE_DEVICE); - litest_assert(excluded >= LITEST_DISABLE_DEVICE); + assert(required >= LITEST_DISABLE_DEVICE); + assert(excluded >= LITEST_DISABLE_DEVICE); if (filter_test && fnmatch(filter_test, funcname, 0) != 0) @@ -481,13 +600,9 @@ if (required == LITEST_DISABLE_DEVICE && excluded == LITEST_DISABLE_DEVICE) { - litest_add_tcase_no_device(suite, func, funcname, range); - added = true; + litest_add_tcase_no_device(suite, func, range); } else if (required != LITEST_ANY || excluded != LITEST_ANY) { for (; *dev; dev++) { - if ((*dev)->features & LITEST_IGNORED) - continue; - if (filter_device && fnmatch(filter_device, (*dev)->shortname, 0) != 0) continue; @@ -500,13 +615,9 @@ func, *dev, range); - added = true; } } else { for (; *dev; dev++) { - if ((*dev)->features & LITEST_IGNORED) - continue; - if (filter_device && fnmatch(filter_device, (*dev)->shortname, 0) != 0) continue; @@ -516,17 +627,8 @@ func, *dev, range); - added = true; } } - - if (!added && - filter_test == NULL && - filter_device == NULL && - filter_group == NULL) { - fprintf(stderr, "Test '%s' does not match any devices. Aborting.\n", funcname); - abort(); - } } void @@ -595,7 +697,7 @@ struct litest_test_device **dev = devices; bool device_filtered = false; - litest_assert(type < LITEST_NO_DEVICE); + assert(type < LITEST_NO_DEVICE); if (filter_test && fnmatch(filter_test, funcname, 0) != 0) @@ -625,92 +727,60 @@ /* only abort if no filter was set, that's a bug */ if (!device_filtered) - litest_abort_msg("Invalid test device type\n"); + litest_abort_msg("Invalid test device type"); +} + +static int +is_debugger_attached(void) +{ + int status; + int rc; + int pid = fork(); + + if (pid == -1) + return 0; + + if (pid == 0) { + int ppid = getppid(); + if (ptrace(PTRACE_ATTACH, ppid, NULL, NULL) == 0) { + waitpid(ppid, NULL, 0); + ptrace(PTRACE_CONT, NULL, NULL); + ptrace(PTRACE_DETACH, ppid, NULL, NULL); + rc = 0; + } else { + rc = 1; + } + _exit(rc); + } else { + waitpid(pid, &status, 0); + rc = WEXITSTATUS(status); + } + + return rc; } -LIBINPUT_ATTRIBUTE_PRINTF(3, 0) static void litest_log_handler(struct libinput *libinput, enum libinput_log_priority pri, const char *format, va_list args) { - static int is_tty = -1; const char *priority = NULL; - const char *color; - - if (is_tty == -1) - is_tty = isatty(STDERR_FILENO); switch(pri) { - case LIBINPUT_LOG_PRIORITY_INFO: - priority = "info "; - color = ANSI_HIGHLIGHT; - break; - case LIBINPUT_LOG_PRIORITY_ERROR: - priority = "error"; - color = ANSI_BRIGHT_RED; - break; - case LIBINPUT_LOG_PRIORITY_DEBUG: - priority = "debug"; - color = ANSI_NORMAL; - break; + case LIBINPUT_LOG_PRIORITY_INFO: priority = "info"; break; + case LIBINPUT_LOG_PRIORITY_ERROR: priority = "error"; break; + case LIBINPUT_LOG_PRIORITY_DEBUG: priority = "debug"; break; default: abort(); } - if (!is_tty) - color = ""; - else if (strstr(format, "tap state:")) - color = ANSI_BLUE; - else if (strstr(format, "thumb state:")) - color = ANSI_YELLOW; - else if (strstr(format, "button state:")) - color = ANSI_MAGENTA; - else if (strstr(format, "touch-size:") || - strstr(format, "pressure:")) - color = ANSI_GREEN; - else if (strstr(format, "palm:") || - strstr(format, "thumb:")) - color = ANSI_CYAN; - else if (strstr(format, "edge state:")) - color = ANSI_BRIGHT_GREEN; - - fprintf(stderr, "%slitest %s ", color, priority); + fprintf(stderr, "litest %s: ", priority); vfprintf(stderr, format, args); - if (is_tty) - fprintf(stderr, ANSI_NORMAL); if (strstr(format, "client bug: ") || - strstr(format, "libinput bug: ")) { - /* valgrind is too slow and some of our offsets are too - * short, don't abort if during a valgrind run we get a - * negative offset */ - if (!getenv("USING_VALGRIND") || - !strstr(format, "offset negative")) + strstr(format, "libinput bug: ")) litest_abort_msg("libinput bug triggered, aborting.\n"); - } -} - -static char * -litest_init_device_udev_rules(struct litest_test_device *dev); - -static void -litest_init_all_device_udev_rules(struct list *created_files) -{ - struct litest_test_device **dev = devices; - - while (*dev) { - char *udev_file; - - udev_file = litest_init_device_udev_rules(*dev); - if (udev_file) { - struct created_file *file = zalloc(sizeof(*file)); - file->path = udev_file; - list_insert(created_files, &file->link); - } - dev++; - } } static int @@ -731,51 +801,46 @@ .close_restricted = close_restricted, }; -static void -litest_signal(int sig) +static inline int +litest_run(int argc, char **argv) { - struct created_file *f, *tmp; + struct suite *s, *snext; + int failed; + SRunner *sr = NULL; - list_for_each_safe(f, tmp, &created_files_list, link) { - list_remove(&f->link); - unlink(f->path); - /* in the sighandler, we can't free */ + if (list_empty(&all_tests)) { + fprintf(stderr, + "Error: filters are too strict, no tests to run.\n"); + return 1; } - if (fork() == 0) { - /* child, we can run system() */ - litest_reload_udev_rules(); - exit(0); + if (in_debugger == -1) { + in_debugger = is_debugger_attached(); + if (in_debugger) + setenv("CK_FORK", "no", 0); } - exit(1); -} + list_for_each(s, &all_tests, node) { + if (!sr) + sr = srunner_create(s->suite); + else + srunner_add_suite(sr, s->suite); + } -static inline void -litest_setup_sighandler(int sig) -{ - struct sigaction act, oact; - int rc; + if (getenv("LITEST_VERBOSE")) + verbose = 1; - sigemptyset(&act.sa_mask); - sigaddset(&act.sa_mask, sig); - act.sa_flags = 0; - act.sa_handler = litest_signal; - rc = sigaction(sig, &act, &oact); - litest_assert_int_ne(rc, -1); -} + litest_init_udev_rules(); -static void -litest_free_test_list(struct list *tests) -{ - struct suite *s, *snext; + srunner_run_all(sr, CK_ENV); + failed = srunner_ntests_failed(sr); + srunner_free(sr); - list_for_each_safe(s, snext, tests, node) { + list_for_each_safe(s, snext, &all_tests, node) { struct test *t, *tnext; list_for_each_safe(t, tnext, &s->tests, node) { free(t->name); - free(t->devname); list_remove(&t->node); free(t); } @@ -784,246 +849,9 @@ free(s->name); free(s); } -} - -static int -litest_run_suite(struct list *tests, int which, int max, int error_fd) -{ - int failed = 0; - SRunner *sr = NULL; - struct suite *s; - struct test *t; - int count = -1; - struct name { - struct list node; - char *name; - }; - struct name *n, *tmp; - struct list testnames; - - /* Check just takes the suite/test name pointers but doesn't strdup - * them - we have to keep them around */ - list_init(&testnames); - - /* For each test, create one test suite with one test case, then - add it to the test runner. The only benefit suites give us in - check is that we can filter them, but our test runner has a - --filter-group anyway. */ - list_for_each(s, tests, node) { - list_for_each(t, &s->tests, node) { - Suite *suite; - TCase *tc; - char *sname, *tname; - - count = (count + 1) % max; - if (max != 1 && (count % max) != which) - continue; - - xasprintf(&sname, - "%s:%s:%s", - s->name, - t->name, - t->devname); - litest_assert(sname != NULL); - n = zalloc(sizeof(*n)); - n->name = sname; - list_insert(&testnames, &n->node); - - xasprintf(&tname, - "%s:%s", - t->name, - t->devname); - litest_assert(tname != NULL); - n = zalloc(sizeof(*n)); - n->name = tname; - list_insert(&testnames, &n->node); - - tc = tcase_create(tname); - tcase_add_checked_fixture(tc, - t->setup, - t->teardown); - if (t->range.upper != t->range.lower) - tcase_add_loop_test(tc, - t->func, - t->range.lower, - t->range.upper); - else - tcase_add_test(tc, t->func); - - suite = suite_create(sname); - suite_add_tcase(suite, tc); - - if (!sr) - sr = srunner_create(suite); - else - srunner_add_suite(sr, suite); - } - } - - if (!sr) - goto out; - - srunner_run_all(sr, CK_ENV); - failed = srunner_ntests_failed(sr); - if (failed) { - TestResult **trs; - - trs = srunner_failures(sr); - for (int i = 0; i < failed; i++) { - dprintf(error_fd, - ":: Failure: %s:%d:%s\n", - tr_lfile(trs[i]), - tr_lno(trs[i]), - tr_tcname(trs[i])); - } - free(trs); - } - srunner_free(sr); -out: - list_for_each_safe(n, tmp, &testnames, node) { - free(n->name); - free(n); - } - - return failed; -} - -static int -litest_fork_subtests(struct list *tests, int max_forks) -{ - int failed = 0; - int status; - pid_t pid; - int f; - int pipes[max_forks]; - - for (f = 0; f < max_forks; f++) { - int rc; - int pipefd[2]; - - rc = pipe2(pipefd, O_NONBLOCK|O_NONBLOCK); - assert(rc != -1); - - pid = fork(); - if (pid == 0) { - close(pipefd[0]); - failed = litest_run_suite(tests, - f, - max_forks, - pipefd[1]); - - litest_free_test_list(&all_tests); - exit(failed); - /* child always exits here */ - } else { - pipes[f] = pipefd[0]; - close(pipefd[1]); - } - } - - /* parent process only */ - while (wait(&status) != -1 && errno != ECHILD) { - if (WEXITSTATUS(status) != 0) - failed = 1; - } - - for (f = 0; f < max_forks; f++) { - char buf[1024] = {0}; - int rc; - - while ((rc = read(pipes[f], buf, sizeof(buf) - 1)) > 0) { - buf[rc] = '\0'; - fprintf(stderr, "%s", buf); - } - - close(pipes[f]); - } - - return failed; -} - -static inline int -inhibit(void) -{ - int lock_fd = -1; -#if HAVE_LIBSYSTEMD - sd_bus_error error = SD_BUS_ERROR_NULL; - sd_bus_message *m = NULL; - sd_bus *bus = NULL; - int rc; - - rc = sd_bus_open_system(&bus); - if (rc != 0) { - fprintf(stderr, "Warning: inhibit failed: %s\n", strerror(-rc)); - goto out; - } - - rc = sd_bus_call_method(bus, - "org.freedesktop.login1", - "/org/freedesktop/login1", - "org.freedesktop.login1.Manager", - "Inhibit", - &error, - &m, - "ssss", - "handle-lid-switch:handle-power-key:handle-suspend-key:handle-hibernate-key", - "libinput test-suite runner", - "testing in progress", - "block"); - if (rc < 0) { - fprintf(stderr, "Warning: inhibit failed: %s\n", error.message); - goto out; - } - - rc = sd_bus_message_read(m, "h", &lock_fd); - if (rc < 0) { - fprintf(stderr, "Warning: inhibit failed: %s\n", strerror(-rc)); - goto out; - } - - lock_fd = dup(lock_fd); -out: - sd_bus_error_free(&error); - sd_bus_message_unref(m); - sd_bus_close(bus); - sd_bus_unref(bus); -#endif - return lock_fd; -} - -static inline int -litest_run(int argc, char **argv) -{ - int failed = 0; - int inhibit_lock_fd; - - list_init(&created_files_list); - - if (list_empty(&all_tests)) { - fprintf(stderr, - "Error: filters are too strict, no tests to run.\n"); - return 1; - } - - if (getenv("LITEST_VERBOSE")) - verbose = 1; - - litest_init_udev_rules(&created_files_list); - - litest_setup_sighandler(SIGINT); - - inhibit_lock_fd = inhibit(); - - if (jobs == 1) - failed = litest_run_suite(&all_tests, 1, 1, STDERR_FILENO); - else - failed = litest_fork_subtests(&all_tests, jobs); - - close(inhibit_lock_fd); - litest_free_test_list(&all_tests); - - litest_remove_udev_rules(&created_files_list); + litest_remove_model_quirks(); + litest_reload_udev_rules(); return failed; } @@ -1039,7 +867,7 @@ if (!orig) return NULL; - abs = zalloc(sz * sizeof(*abs)); + abs = calloc(sz, sizeof(*abs)); litest_assert(abs != NULL); nelem = 0; @@ -1073,7 +901,7 @@ if (!orig) return NULL; - events = zalloc(sz * sizeof(int)); + events = calloc(sz, sizeof(int)); litest_assert(events != NULL); nelem = 0; @@ -1097,44 +925,27 @@ return events; } -static inline struct created_file * +static inline void litest_copy_file(const char *dest, const char *src, const char *header) { - int in, out, length; - struct created_file *file; - int suffixlen; - - file = zalloc(sizeof(*file)); - file->path = safe_strdup(dest); - - suffixlen = file->path + strlen(file->path) - rindex(file->path, '.'); - out = mkstemps(file->path, suffixlen); - if (out == -1) - litest_abort_msg("Failed to write to file %s (%s)\n", - file->path, - strerror(errno)); - litest_assert_int_ne(chmod(file->path, 0644), -1); - - if (header) { - length = strlen(header); - litest_assert_int_eq(write(out, header, length), length); - } + int in, out; + + out = open(dest, O_CREAT|O_WRONLY, 0644); + litest_assert_int_gt(out, -1); + + if (header) + write(out, header, strlen(header)); in = open(src, O_RDONLY); - if (in == -1) - litest_abort_msg("Failed to open file %s (%s)\n", - src, - strerror(errno)); + litest_assert_int_gt(in, -1); /* lazy, just check for error and empty file copy */ - litest_assert_int_gt(sendfile(out, in, NULL, 40960), 0); + litest_assert_int_gt(sendfile(out, in, NULL, 4096), 0); close(out); close(in); - - return file; } static inline void -litest_install_model_quirks(struct list *created_files_list) +litest_install_model_quirks(void) { const char *warning = "#################################################################\n" @@ -1144,76 +955,41 @@ "# running, remove this file and update your hwdb: \n" "# sudo udevadm hwdb --update\n" "#################################################################\n\n"; - struct created_file *file; - - file = litest_copy_file(UDEV_MODEL_QUIRKS_RULE_FILE, - LIBINPUT_MODEL_QUIRKS_UDEV_RULES_FILE, - warning); - list_insert(created_files_list, &file->link); - - file = litest_copy_file(UDEV_MODEL_QUIRKS_HWDB_FILE, - LIBINPUT_MODEL_QUIRKS_UDEV_HWDB_FILE, - warning); - list_insert(created_files_list, &file->link); - - file = litest_copy_file(UDEV_TEST_DEVICE_RULE_FILE, - LIBINPUT_TEST_DEVICE_RULES_FILE, - warning); - list_insert(created_files_list, &file->link); - - file = litest_copy_file(UDEV_DEVICE_GROUPS_FILE, - LIBINPUT_DEVICE_GROUPS_RULES_FILE, - warning); - list_insert(created_files_list, &file->link); + litest_copy_file(UDEV_MODEL_QUIRKS_RULE_FILE, + LIBINPUT_MODEL_QUIRKS_UDEV_RULES_FILE, + warning); + litest_copy_file(UDEV_MODEL_QUIRKS_HWDB_FILE, + LIBINPUT_MODEL_QUIRKS_UDEV_HWDB_FILE, + warning); + litest_copy_file(UDEV_TEST_DEVICE_RULE_FILE, + LIBINPUT_TEST_DEVICE_RULES_FILE, + warning); } static inline void -mkdir_p(const char *dir) -{ - char *path, *parent; - int rc; - - if (streq(dir, "/")) - return; - - path = strdup(dir); - parent = dirname(path); - - mkdir_p(parent); - rc = mkdir(dir, 0755); - - if (rc == -1 && errno != EEXIST) { - litest_abort_msg("Failed to create directory %s (%s)\n", - dir, - strerror(errno)); - } - - free(path); -} - -static void -litest_init_udev_rules(struct list *created_files) +litest_remove_model_quirks(void) { - mkdir_p(UDEV_RULES_D); - mkdir_p(UDEV_HWDB_D); - - litest_install_model_quirks(created_files); - litest_init_all_device_udev_rules(created_files); - litest_reload_udev_rules(); + unlink(UDEV_MODEL_QUIRKS_RULE_FILE); + unlink(UDEV_MODEL_QUIRKS_HWDB_FILE); + unlink(UDEV_TEST_DEVICE_RULE_FILE); } static void -litest_remove_udev_rules(struct list *created_files_list) +litest_init_udev_rules(void) { - struct created_file *f, *tmp; + int rc; - list_for_each_safe(f, tmp, created_files_list, link) { - list_remove(&f->link); - unlink(f->path); - free(f->path); - free(f); - } + rc = mkdir(UDEV_RULES_D, 0755); + if (rc == -1 && errno != EEXIST) + ck_abort_msg("Failed to create udev rules directory (%s)\n", + strerror(errno)); + + rc = mkdir(UDEV_HWDB_D, 0755); + if (rc == -1 && errno != EEXIST) + ck_abort_msg("Failed to create udev hwdb directory (%s)\n", + strerror(errno)); + litest_install_model_quirks(); litest_reload_udev_rules(); } @@ -1221,7 +997,6 @@ litest_init_device_udev_rules(struct litest_test_device *dev) { int rc; - int fd; FILE *f; char *path = NULL; @@ -1229,7 +1004,7 @@ return NULL; rc = xasprintf(&path, - "%s/%s%s-XXXXXX.rules", + "%s/%s%s.rules", UDEV_RULES_D, UDEV_RULE_PREFIX, dev->shortname); @@ -1237,22 +1012,18 @@ (int)( strlen(UDEV_RULES_D) + strlen(UDEV_RULE_PREFIX) + - strlen(dev->shortname) + 14)); - - fd = mkstemps(path, 6); - litest_assert_int_ne(fd, -1); - f = fdopen(fd, "w"); + strlen(dev->shortname) + 7)); + f = fopen(path, "w"); litest_assert_notnull(f); litest_assert_int_ge(fputs(dev->udev_rule, f), 0); fclose(f); + litest_reload_udev_rules(); + return path; } -/** - * Creates a uinput device but does not add it to a libinput context - */ -struct litest_device * +static struct litest_device * litest_create(enum litest_device_type which, const char *name_override, struct input_id *id_override, @@ -1264,9 +1035,8 @@ const char *name; const struct input_id *id; struct input_absinfo *abs; - int *events, *e; - const char *path; - int fd, rc; + int *events; + char *udev_file; dev = devices; while (*dev) { @@ -1279,47 +1049,35 @@ ck_abort_msg("Invalid device type %d\n", which); d = zalloc(sizeof(*d)); + litest_assert(d != NULL); + udev_file = litest_init_device_udev_rules(*dev); /* device has custom create method */ if ((*dev)->create) { (*dev)->create(d); if (abs_override || events_override) { + if (udev_file) + unlink(udev_file); litest_abort_msg("Custom create cannot be overridden"); } - } else { - abs = merge_absinfo((*dev)->absinfo, abs_override); - events = merge_events((*dev)->events, events_override); - name = name_override ? name_override : (*dev)->name; - id = id_override ? id_override : (*dev)->id; - - d->uinput = litest_create_uinput_device_from_description(name, - id, - abs, - events); - d->interface = (*dev)->interface; - - for (e = events; *e != -1; e += 2) { - unsigned int type = *e, - code = *(e + 1); - - if (type == INPUT_PROP_MAX && - code == INPUT_PROP_SEMI_MT) { - d->semi_mt.is_semi_mt = true; - break; - } - } - free(abs); - free(events); + d->udev_rule_file = udev_file; + return d; } - path = libevdev_uinput_get_devnode(d->uinput); - litest_assert(path != NULL); - fd = open(path, O_RDWR|O_NONBLOCK); - litest_assert_int_ne(fd, -1); - - rc = libevdev_new_from_fd(fd, &d->evdev); - litest_assert_int_eq(rc, 0); + abs = merge_absinfo((*dev)->absinfo, abs_override); + events = merge_events((*dev)->events, events_override); + name = name_override ? name_override : (*dev)->name; + id = id_override ? id_override : (*dev)->id; + + d->uinput = litest_create_uinput_device_from_description(name, + id, + abs, + events); + d->interface = (*dev)->interface; + d->udev_rule_file = udev_file; + free(abs); + free(events); return d; @@ -1349,28 +1107,6 @@ litest_restore_log_handler(struct libinput *libinput) { libinput_log_set_handler(libinput, litest_log_handler); - if (verbose) - libinput_log_set_priority(libinput, LIBINPUT_LOG_PRIORITY_DEBUG); -} - -LIBINPUT_ATTRIBUTE_PRINTF(3, 0) -static void -litest_bug_log_handler(struct libinput *libinput, - enum libinput_log_priority pri, - const char *format, - va_list args) -{ - if (strstr(format, "client bug: ") || - strstr(format, "libinput bug: ")) - return; - - litest_abort_msg("Expected bug statement in log msg, aborting.\n"); -} - -void -litest_set_log_handler_bug(struct libinput *libinput) -{ - libinput_log_set_handler(libinput, litest_bug_log_handler); } struct litest_device * @@ -1382,6 +1118,8 @@ const int *events_override) { struct litest_device *d; + int fd; + int rc; const char *path; d = litest_create(which, @@ -1392,6 +1130,11 @@ path = libevdev_uinput_get_devnode(d->uinput); litest_assert(path != NULL); + fd = open(path, O_RDWR|O_NONBLOCK); + litest_assert_int_ne(fd, -1); + + rc = libevdev_new_from_fd(fd, &d->evdev); + litest_assert_int_eq(rc, 0); d->libinput = libinput; d->libinput_device = libinput_path_add_device(d->libinput, path); @@ -1443,21 +1186,37 @@ return litest_create_device_with_overrides(which, NULL, NULL, NULL, NULL); } +int +litest_handle_events(struct litest_device *d) +{ + struct pollfd fd; + + fd.fd = libinput_get_fd(d->libinput); + fd.events = POLLIN; + + while (poll(&fd, 1, 1)) + libinput_dispatch(d->libinput); + + return 0; +} + void litest_delete_device(struct litest_device *d) { if (!d) return; - litest_assert_int_eq(d->skip_ev_syn, 0); - - if (d->libinput_device) { - libinput_path_remove_device(d->libinput_device); - libinput_device_unref(d->libinput_device); + if (d->udev_rule_file) { + unlink(d->udev_rule_file); + free(d->udev_rule_file); + d->udev_rule_file = NULL; + litest_reload_udev_rules(); } + + libinput_device_unref(d->libinput_device); + libinput_path_remove_device(d->libinput_device); if (d->owns_context) libinput_unref(d->libinput); - close(libevdev_get_fd(d->evdev)); libevdev_free(d->evdev); libevdev_uinput_destroy(d->uinput); free(d->private); @@ -1479,8 +1238,7 @@ } static bool -axis_replacement_value(struct litest_device *d, - struct axis_replacement *axes, +axis_replacement_value(struct axis_replacement *axes, int32_t evcode, int32_t *value) { @@ -1491,7 +1249,7 @@ while (axis->evcode != -1) { if (axis->evcode == evcode) { - *value = litest_scale(d, evcode, axis->value); + *value = axis->value; return true; } axis++; @@ -1532,7 +1290,8 @@ value = touching ? 0 : 1; break; default: - if (!axis_replacement_value(d, axes, ev->code, &value) && + value = -1; + if (!axis_replacement_value(axes, ev->code, &value) && d->interface->get_axis_default) d->interface->get_axis_default(d, ev->code, &value); break; @@ -1542,9 +1301,9 @@ } static void -send_btntool(struct litest_device *d, bool hover) +send_btntool(struct litest_device *d) { - litest_event(d, EV_KEY, BTN_TOUCH, d->ntouches_down != 0 && !hover); + litest_event(d, EV_KEY, BTN_TOUCH, d->ntouches_down != 0); litest_event(d, EV_KEY, BTN_TOOL_FINGER, d->ntouches_down == 1); litest_event(d, EV_KEY, BTN_TOOL_DOUBLETAP, d->ntouches_down == 2); litest_event(d, EV_KEY, BTN_TOOL_TRIPLETAP, d->ntouches_down == 3); @@ -1553,29 +1312,27 @@ } static void -slot_start(struct litest_device *d, - unsigned int slot, - double x, - double y, - struct axis_replacement *axes, - bool touching, - bool filter_abs_xy) +litest_slot_start(struct litest_device *d, + unsigned int slot, + double x, + double y, + struct axis_replacement *axes, + bool touching) { struct input_event *ev; - litest_assert(d->ntouches_down >= 0); + assert(d->ntouches_down >= 0); d->ntouches_down++; - send_btntool(d, !touching); + send_btntool(d); if (d->interface->touch_down) { d->interface->touch_down(d, slot, x, y); return; } - for (ev = d->interface->touch_down_events; - ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1; - ev++) { + ev = d->interface->touch_down_events; + while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { int value = litest_auto_assign_value(d, ev, slot, @@ -1583,64 +1340,38 @@ y, axes, touching); - if (value == LITEST_AUTO_ASSIGN) - continue; - - if (filter_abs_xy && ev->type == EV_ABS && - (ev->code == ABS_X || ev->code == ABS_Y)) - continue; litest_event(d, ev->type, ev->code, value); + ev++; } } -static void -slot_move(struct litest_device *d, - unsigned int slot, - double x, - double y, - struct axis_replacement *axes, - bool touching, - bool filter_abs_xy) +void +litest_touch_down(struct litest_device *d, + unsigned int slot, + double x, + double y) { - struct input_event *ev; - - if (d->interface->touch_move) { - d->interface->touch_move(d, slot, x, y); - return; - } - - for (ev = d->interface->touch_move_events; - ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1; - ev++) { - int value = litest_auto_assign_value(d, - ev, - slot, - x, - y, - axes, - touching); - if (value == LITEST_AUTO_ASSIGN) - continue; - - if (filter_abs_xy && ev->type == EV_ABS && - (ev->code == ABS_X || ev->code == ABS_Y)) - continue; + litest_slot_start(d, slot, x, y, NULL, true); +} - litest_event(d, ev->type, ev->code, value); - } +void +litest_touch_down_extended(struct litest_device *d, + unsigned int slot, + double x, + double y, + struct axis_replacement *axes) +{ + litest_slot_start(d, slot, x, y, axes, true); } -static void -touch_up(struct litest_device *d, unsigned int slot) +void +litest_touch_up(struct litest_device *d, unsigned int slot) { struct input_event *ev; struct input_event up[] = { { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = -1 }, - { .type = EV_ABS, .code = ABS_MT_PRESSURE, .value = 0 }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = 0 }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = 0 }, { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, { .type = -1, .code = -1 } }; @@ -1648,7 +1379,7 @@ litest_assert_int_gt(d->ntouches_down, 0); d->ntouches_down--; - send_btntool(d, false); + send_btntool(d); if (d->interface->touch_up) { d->interface->touch_up(d, slot); @@ -1658,9 +1389,7 @@ } else ev = up; - for ( /* */; - ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1; - ev++) { + while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { int value = litest_auto_assign_value(d, ev, slot, @@ -1669,78 +1398,11 @@ NULL, false); litest_event(d, ev->type, ev->code, value); + ev++; } } static void -litest_slot_start(struct litest_device *d, - unsigned int slot, - double x, - double y, - struct axis_replacement *axes, - bool touching) -{ - double t, l, r = 0, b = 0; /* top, left, right, bottom */ - bool filter_abs_xy = false; - - if (!d->semi_mt.is_semi_mt) { - slot_start(d, slot, x, y, axes, touching, filter_abs_xy); - return; - } - - if (d->ntouches_down >= 2 || slot > 1) - return; - - slot = d->ntouches_down; - - if (d->ntouches_down == 0) { - l = x; - t = y; - } else { - int other = (slot + 1) % 2; - l = min(x, d->semi_mt.touches[other].x); - t = min(y, d->semi_mt.touches[other].y); - r = max(x, d->semi_mt.touches[other].x); - b = max(y, d->semi_mt.touches[other].y); - } - - litest_push_event_frame(d); - if (d->ntouches_down == 0) - slot_start(d, 0, l, t, axes, touching, filter_abs_xy); - else - slot_move(d, 0, l, t, axes, touching, filter_abs_xy); - - if (slot == 1) { - filter_abs_xy = true; - slot_start(d, 1, r, b, axes, touching, filter_abs_xy); - } - - litest_pop_event_frame(d); - - d->semi_mt.touches[slot].x = x; - d->semi_mt.touches[slot].y = y; -} - -void -litest_touch_down(struct litest_device *d, - unsigned int slot, - double x, - double y) -{ - litest_slot_start(d, slot, x, y, NULL, true); -} - -void -litest_touch_down_extended(struct litest_device *d, - unsigned int slot, - double x, - double y, - struct axis_replacement *axes) -{ - litest_slot_start(d, slot, x, y, axes, true); -} - -static void litest_slot_move(struct litest_device *d, unsigned int slot, double x, @@ -1748,73 +1410,25 @@ struct axis_replacement *axes, bool touching) { - double t, l, r = 0, b = 0; /* top, left, right, bottom */ - bool filter_abs_xy = false; - - if (!d->semi_mt.is_semi_mt) { - slot_move(d, slot, x, y, axes, touching, filter_abs_xy); - return; - } - - if (d->ntouches_down > 2 || slot > 1) - return; - - if (d->ntouches_down == 1) { - l = x; - t = y; - } else { - int other = (slot + 1) % 2; - l = min(x, d->semi_mt.touches[other].x); - t = min(y, d->semi_mt.touches[other].y); - r = max(x, d->semi_mt.touches[other].x); - b = max(y, d->semi_mt.touches[other].y); - } - - litest_push_event_frame(d); - slot_move(d, 0, l, t, axes, touching, filter_abs_xy); - - if (d->ntouches_down == 2) { - filter_abs_xy = true; - slot_move(d, 1, r, b, axes, touching, filter_abs_xy); - } - - litest_pop_event_frame(d); - - d->semi_mt.touches[slot].x = x; - d->semi_mt.touches[slot].y = y; -} + struct input_event *ev; -void -litest_touch_up(struct litest_device *d, unsigned int slot) -{ - if (!d->semi_mt.is_semi_mt) { - touch_up(d, slot); + if (d->interface->touch_move) { + d->interface->touch_move(d, slot, x, y); return; } - if (d->ntouches_down > 2 || slot > 1) - return; - - litest_push_event_frame(d); - touch_up(d, d->ntouches_down - 1); - - /* if we have one finger left, send x/y coords for that finger left. - this is likely to happen with a real touchpad */ - if (d->ntouches_down == 1) { - bool touching = true; - bool filter_abs_xy = false; - - int other = (slot + 1) % 2; - slot_move(d, - 0, - d->semi_mt.touches[other].x, - d->semi_mt.touches[other].y, - NULL, - touching, - filter_abs_xy); + ev = d->interface->touch_move_events; + while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { + int value = litest_auto_assign_value(d, + ev, + slot, + x, + y, + axes, + touching); + litest_event(d, ev->type, ev->code, value); + ev++; } - - litest_pop_event_frame(d); } void @@ -1843,7 +1457,7 @@ double x_to, double y_to, int steps, int sleep_ms) { - for (int i = 1; i < steps; i++) { + for (int i = 0; i < steps - 1; i++) { litest_touch_move(d, slot, x_from + (x_to - x_from)/steps * i, y_from + (y_to - y_from)/steps * i); @@ -1857,127 +1471,25 @@ } void -litest_touch_move_to_extended(struct litest_device *d, - unsigned int slot, - double x_from, double y_from, - double x_to, double y_to, - struct axis_replacement *axes, - int steps, int sleep_ms) -{ - for (int i = 1; i < steps - 1; i++) { - litest_touch_move_extended(d, slot, - x_from + (x_to - x_from)/steps * i, - y_from + (y_to - y_from)/steps * i, - axes); - if (sleep_ms) { - libinput_dispatch(d->libinput); - msleep(sleep_ms); - libinput_dispatch(d->libinput); - } - } - litest_touch_move_extended(d, slot, x_to, y_to, axes); -} - -static int -auto_assign_tablet_value(struct litest_device *d, - const struct input_event *ev, - int x, int y, - struct axis_replacement *axes) -{ - int value = ev->value; - - if (value != LITEST_AUTO_ASSIGN || ev->type != EV_ABS) - return value; - - switch (ev->code) { - case ABS_X: - value = litest_scale(d, ABS_X, x); - break; - case ABS_Y: - value = litest_scale(d, ABS_Y, y); - break; - default: - if (!axis_replacement_value(d, axes, ev->code, &value) && - d->interface->get_axis_default) - d->interface->get_axis_default(d, ev->code, &value); - break; - } - - return value; -} - -static int -tablet_ignore_event(const struct input_event *ev, int value) -{ - return value == -1 && (ev->code == ABS_PRESSURE || ev->code == ABS_DISTANCE); -} - -void -litest_tablet_proximity_in(struct litest_device *d, int x, int y, struct axis_replacement *axes) -{ - struct input_event *ev; - - ev = d->interface->tablet_proximity_in_events; - while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { - int value = auto_assign_tablet_value(d, ev, x, y, axes); - if (!tablet_ignore_event(ev, value)) - litest_event(d, ev->type, ev->code, value); - ev++; - } -} - -void -litest_tablet_proximity_out(struct litest_device *d) -{ - struct input_event *ev; - - ev = d->interface->tablet_proximity_out_events; - while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { - int value = auto_assign_tablet_value(d, ev, -1, -1, NULL); - if (!tablet_ignore_event(ev, value)) - litest_event(d, ev->type, ev->code, value); - ev++; - } -} - -void -litest_tablet_motion(struct litest_device *d, int x, int y, struct axis_replacement *axes) -{ - struct input_event *ev; - - ev = d->interface->tablet_motion_events; - while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { - int value = auto_assign_tablet_value(d, ev, x, y, axes); - if (!tablet_ignore_event(ev, value)) - litest_event(d, ev->type, ev->code, value); - ev++; - } -} - -void litest_touch_move_two_touches(struct litest_device *d, double x0, double y0, double x1, double y1, double dx, double dy, int steps, int sleep_ms) { - for (int i = 1; i < steps; i++) { - litest_push_event_frame(d); + for (int i = 0; i < steps - 1; i++) { litest_touch_move(d, 0, x0 + dx / steps * i, y0 + dy / steps * i); litest_touch_move(d, 1, x1 + dx / steps * i, y1 + dy / steps * i); - litest_pop_event_frame(d); if (sleep_ms) { libinput_dispatch(d->libinput); msleep(sleep_ms); + libinput_dispatch(d->libinput); } - libinput_dispatch(d->libinput); } - litest_push_event_frame(d); litest_touch_move(d, 0, x0 + dx, y0 + dy); litest_touch_move(d, 1, x1 + dx, y1 + dy); - litest_pop_event_frame(d); } void @@ -2012,13 +1524,7 @@ double x, double y) { - struct axis_replacement axes[] = { - {ABS_MT_PRESSURE, 0 }, - {ABS_PRESSURE, 0 }, - {-1, -1 }, - }; - - litest_slot_start(d, slot, x, y, axes, 0); + litest_slot_start(d, slot, x, y, NULL, 0); } void @@ -2036,7 +1542,7 @@ litest_assert_int_gt(d->ntouches_down, 0); d->ntouches_down--; - send_btntool(d, true); + send_btntool(d); if (d->interface->touch_up) { d->interface->touch_up(d, slot); @@ -2057,13 +1563,7 @@ litest_hover_move(struct litest_device *d, unsigned int slot, double x, double y) { - struct axis_replacement axes[] = { - {ABS_MT_PRESSURE, 0 }, - {ABS_PRESSURE, 0 }, - {-1, -1 }, - }; - - litest_slot_move(d, slot, x, y, axes, false); + litest_slot_move(d, slot, x, y, NULL, false); } void @@ -2113,10 +1613,9 @@ } void -litest_button_click(struct litest_device *d, - unsigned int button, - bool is_press) +litest_button_click(struct litest_device *d, unsigned int button, bool is_press) { + struct input_event *ev; struct input_event click[] = { { .type = EV_KEY, .code = button, .value = is_press ? 1 : 0 }, @@ -2128,230 +1627,44 @@ } void -litest_button_click_debounced(struct litest_device *d, - struct libinput *li, - unsigned int button, - bool is_press) -{ - litest_button_click(d, button, is_press); - - libinput_dispatch(li); - litest_timeout_debounce(); - libinput_dispatch(li); -} - -void litest_button_scroll(struct litest_device *dev, unsigned int button, double dx, double dy) { struct libinput *li = dev->libinput; - litest_button_click_debounced(dev, li, button, 1); + litest_button_click(dev, button, 1); libinput_dispatch(li); litest_timeout_buttonscroll(); libinput_dispatch(li); - litest_event(dev, EV_REL, REL_X, dx); - litest_event(dev, EV_REL, REL_Y, dy); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_button_click_debounced(dev, li, button, 0); - - libinput_dispatch(li); -} - -void -litest_keyboard_key(struct litest_device *d, unsigned int key, bool is_press) -{ - struct input_event *ev; - struct input_event click[] = { - { .type = EV_KEY, .code = key, .value = is_press ? 1 : 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - }; - - ARRAY_FOR_EACH(click, ev) - litest_event(d, ev->type, ev->code, ev->value); -} - -void -litest_switch_action(struct litest_device *dev, - enum libinput_switch sw, - enum libinput_switch_state state) -{ - unsigned int code; - - switch (sw) { - case LIBINPUT_SWITCH_LID: - code = SW_LID; - break; - case LIBINPUT_SWITCH_TABLET_MODE: - code = SW_TABLET_MODE; - break; - default: - litest_abort_msg("Invalid switch %d", sw); - break; - } - litest_event(dev, EV_SW, code, state); - litest_event(dev, EV_SYN, SYN_REPORT, 0); -} - -static int -litest_scale_axis(const struct litest_device *d, - unsigned int axis, - double val) -{ - const struct input_absinfo *abs; - - litest_assert_double_ge(val, 0.0); - /* major/minor must be able to beyond 100% for large fingers */ - if (axis != ABS_MT_TOUCH_MAJOR && - axis != ABS_MT_TOUCH_MINOR) { - litest_assert_double_le(val, 100.0); - } - - abs = libevdev_get_abs_info(d->evdev, axis); - litest_assert_notnull(abs); - - return (abs->maximum - abs->minimum) * val/100.0 + abs->minimum; -} - -static inline int -litest_scale_range(int min, int max, double val) -{ - litest_assert_int_ge((int)val, 0); - litest_assert_int_le((int)val, 100); - - return (max - min) * val/100.0 + min; -} - -int -litest_scale(const struct litest_device *d, unsigned int axis, double val) -{ - int min, max; - - litest_assert_double_ge(val, 0.0); - /* major/minor must be able to beyond 100% for large fingers */ - if (axis != ABS_MT_TOUCH_MAJOR && - axis != ABS_MT_TOUCH_MINOR) - litest_assert_double_le(val, 100.0); - - if (axis <= ABS_Y) { - min = d->interface->min[axis]; - max = d->interface->max[axis]; - - return litest_scale_range(min, max, val); - } else { - return litest_scale_axis(d, axis, val); - } -} - -static inline int -auto_assign_pad_value(struct litest_device *dev, - struct input_event *ev, - double value) -{ - const struct input_absinfo *abs; - - if (ev->value != LITEST_AUTO_ASSIGN || - ev->type != EV_ABS) - return value; - - abs = libevdev_get_abs_info(dev->evdev, ev->code); - litest_assert_notnull(abs); - - if (ev->code == ABS_RX || ev->code == ABS_RY) { - double min = abs->minimum != 0 ? log2(abs->minimum) : 0, - max = abs->maximum != 0 ? log2(abs->maximum) : 0; - - /* Value 0 is reserved for finger up, so a value of 0% is - * actually 1 */ - if (value == 0.0) { - return 1; - } else { - value = litest_scale_range(min, max, value); - return pow(2, value); - } - } else { - return litest_scale_range(abs->minimum, abs->maximum, value); - } -} - -void -litest_pad_ring_start(struct litest_device *d, double value) -{ - struct input_event *ev; - - ev = d->interface->pad_ring_start_events; - while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { - value = auto_assign_pad_value(d, ev, value); - litest_event(d, ev->type, ev->code, value); - ev++; - } -} - -void -litest_pad_ring_change(struct litest_device *d, double value) -{ - struct input_event *ev; - - ev = d->interface->pad_ring_change_events; - while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { - value = auto_assign_pad_value(d, ev, value); - litest_event(d, ev->type, ev->code, value); - ev++; - } -} - -void -litest_pad_ring_end(struct litest_device *d) -{ - struct input_event *ev; - - ev = d->interface->pad_ring_end_events; - while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { - litest_event(d, ev->type, ev->code, ev->value); - ev++; - } -} - -void -litest_pad_strip_start(struct litest_device *d, double value) -{ - struct input_event *ev; + litest_event(dev, EV_REL, REL_X, dx); + litest_event(dev, EV_REL, REL_Y, dy); + litest_event(dev, EV_SYN, SYN_REPORT, 0); - ev = d->interface->pad_strip_start_events; - while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { - value = auto_assign_pad_value(d, ev, value); - litest_event(d, ev->type, ev->code, value); - ev++; - } + litest_button_click(dev, button, 0); + + libinput_dispatch(li); } void -litest_pad_strip_change(struct litest_device *d, double value) +litest_keyboard_key(struct litest_device *d, unsigned int key, bool is_press) { - struct input_event *ev; - - ev = d->interface->pad_strip_change_events; - while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { - value = auto_assign_pad_value(d, ev, value); - litest_event(d, ev->type, ev->code, value); - ev++; - } + litest_button_click(d, key, is_press); } -void -litest_pad_strip_end(struct litest_device *d) +int +litest_scale(const struct litest_device *d, unsigned int axis, double val) { - struct input_event *ev; + int min, max; + litest_assert_int_ge((int)val, 0); + litest_assert_int_le((int)val, 100); + litest_assert_int_le(axis, (unsigned int)ABS_Y); - ev = d->interface->pad_strip_end_events; - while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { - litest_event(d, ev->type, ev->code, ev->value); - ev++; - } + min = d->interface->min[axis]; + max = d->interface->max[axis]; + return (max - min) * val/100.0 + min; } void @@ -2372,8 +1685,8 @@ va_start(args, li); type = va_arg(args, int); while ((int)type != -1) { - litest_assert(type > 0); - litest_assert(ntypes < ARRAY_LENGTH(types)); + assert(type > 0); + assert(ntypes < ARRAY_LENGTH(types)); types[ntypes++] = type; type = va_arg(args, int); } @@ -2388,8 +1701,7 @@ struct libinput_event *event; while ((type = libinput_next_event_type(li)) == LIBINPUT_EVENT_NONE) { - int rc = poll(&fds, 1, 2000); - litest_assert_int_gt(rc, 0); + poll(&fds, 1, -1); libinput_dispatch(li); } @@ -2420,11 +1732,11 @@ } static const char * -litest_event_type_str(enum libinput_event_type type) +litest_event_type_str(struct libinput_event *event) { const char *str = NULL; - switch (type) { + switch (libinput_event_get_type(event)) { case LIBINPUT_EVENT_NONE: abort(); case LIBINPUT_EVENT_DEVICE_ADDED: @@ -2481,46 +1793,14 @@ case LIBINPUT_EVENT_GESTURE_PINCH_END: str = "GESTURE PINCH END"; break; - case LIBINPUT_EVENT_TABLET_TOOL_AXIS: - str = "TABLET TOOL AXIS"; - break; - case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: - str = "TABLET TOOL PROX"; - break; - case LIBINPUT_EVENT_TABLET_TOOL_TIP: - str = "TABLET TOOL TIP"; - break; - case LIBINPUT_EVENT_TABLET_TOOL_BUTTON: - str = "TABLET TOOL BUTTON"; - break; - case LIBINPUT_EVENT_TABLET_PAD_BUTTON: - str = "TABLET PAD BUTTON"; - break; - case LIBINPUT_EVENT_TABLET_PAD_RING: - str = "TABLET PAD RING"; - break; - case LIBINPUT_EVENT_TABLET_PAD_STRIP: - str = "TABLET PAD STRIP"; - break; - case LIBINPUT_EVENT_SWITCH_TOGGLE: - str = "SWITCH TOGGLE"; - break; } return str; } -static const char * -litest_event_get_type_str(struct libinput_event *event) -{ - return litest_event_type_str(libinput_event_get_type(event)); -} - static void litest_print_event(struct libinput_event *event) { struct libinput_event_pointer *p; - struct libinput_event_tablet_tool *t; - struct libinput_event_tablet_pad *pad; struct libinput_device *dev; enum libinput_event_type type; double x, y; @@ -2531,7 +1811,7 @@ fprintf(stderr, "device %s type %s ", libinput_device_get_sysname(dev), - litest_event_get_type_str(event)); + litest_event_type_str(event)); switch (type) { case LIBINPUT_EVENT_POINTER_MOTION: p = libinput_event_get_pointer_event(event); @@ -2554,53 +1834,12 @@ break; case LIBINPUT_EVENT_POINTER_AXIS: p = libinput_event_get_pointer_event(event); - x = 0.0; - y = 0.0; - if (libinput_event_pointer_has_axis(p, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) - y = libinput_event_pointer_get_axis_value(p, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); - if (libinput_event_pointer_has_axis(p, - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) - x = libinput_event_pointer_get_axis_value(p, - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL); - fprintf(stderr, "vert %.f horiz %.2f", y, x); - break; - case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: - t = libinput_event_get_tablet_tool_event(event); - fprintf(stderr, "proximity %d", - libinput_event_tablet_tool_get_proximity_state(t)); - break; - case LIBINPUT_EVENT_TABLET_TOOL_TIP: - t = libinput_event_get_tablet_tool_event(event); - fprintf(stderr, "tip %d", - libinput_event_tablet_tool_get_tip_state(t)); - break; - case LIBINPUT_EVENT_TABLET_TOOL_BUTTON: - t = libinput_event_get_tablet_tool_event(event); - fprintf(stderr, "button %d state %d", - libinput_event_tablet_tool_get_button(t), - libinput_event_tablet_tool_get_button_state(t)); - break; - case LIBINPUT_EVENT_TABLET_PAD_BUTTON: - pad = libinput_event_get_tablet_pad_event(event); - fprintf(stderr, "button %d state %d", - libinput_event_tablet_pad_get_button_number(pad), - libinput_event_tablet_pad_get_button_state(pad)); - break; - case LIBINPUT_EVENT_TABLET_PAD_RING: - pad = libinput_event_get_tablet_pad_event(event); - fprintf(stderr, "ring %d position %.2f source %d", - libinput_event_tablet_pad_get_ring_number(pad), - libinput_event_tablet_pad_get_ring_position(pad), - libinput_event_tablet_pad_get_ring_source(pad)); - break; - case LIBINPUT_EVENT_TABLET_PAD_STRIP: - pad = libinput_event_get_tablet_pad_event(event); - fprintf(stderr, "strip %d position %.2f source %d", - libinput_event_tablet_pad_get_ring_number(pad), - libinput_event_tablet_pad_get_ring_position(pad), - libinput_event_tablet_pad_get_ring_source(pad)); + fprintf(stderr, + "vert %.f horiz %.2f", + libinput_event_pointer_get_axis_value(p, + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL), + libinput_event_pointer_get_axis_value(p, + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)); break; default: break; @@ -2610,23 +1849,6 @@ } void -litest_assert_event_type(struct libinput_event *event, - enum libinput_event_type want) -{ - if (libinput_event_get_type(event) == want) - return; - - fprintf(stderr, - "FAILED EVENT TYPE: have %s (%d) but want %s (%d)\n", - litest_event_get_type_str(event), - libinput_event_get_type(event), - litest_event_type_str(want), - want); - litest_backtrace(); - abort(); -} - -void litest_assert_empty_queue(struct libinput *li) { bool empty_queue = true; @@ -2659,7 +1881,7 @@ const struct input_absinfo default_abs = { .value = 0, .minimum = 0, - .maximum = 100, + .maximum = 0xffff, .fuzz = 0, .flat = 0, .resolution = 100 @@ -2681,12 +1903,8 @@ abs = abs_info; while (abs && abs->value != -1) { - struct input_absinfo a = *abs; - - /* abs_info->value is used for the code and may be outside - of [min, max] */ - a.value = abs->minimum; - rc = libevdev_enable_event_code(dev, EV_ABS, abs->value, &a); + rc = libevdev_enable_event_code(dev, EV_ABS, + abs->value, abs); litest_assert_int_eq(rc, 0); abs++; } @@ -2710,7 +1928,7 @@ http://cgit.freedesktop.org/libevdev/commit/?id=debe9b030c8069cdf78307888ef3b65830b25122 */ if (rc == -EBADF) rc = -EACCES; - litest_assert_msg(rc == 0, "Failed to create uinput device: %s\n", strerror(-rc)); + litest_assert_msg(rc == 0, "Failed to create uinput device: %s", strerror(-rc)); libevdev_free(dev); @@ -2721,21 +1939,13 @@ rc = libevdev_new_from_fd(fd, &dev); litest_assert_int_eq(rc, 0); - /* uinput before kernel 4.5 + libevdev 1.5.0 does not support - * setting the resolution, so we set it afterwards. This is of - * course racy as hell but the way we _generally_ use this function - * by the time libinput uses the device, we're finished here. - * - * If you have kernel 4.5 and libevdev 1.5.0 or later, this code - * just keeps the room warm. - */ + /* uinput does not yet support setting the resolution, so we set it + * afterwards. This is of course racy as hell but the way we + * _generally_ use this function by the time libinput uses the + * device, we're finished here */ abs = abs_info; while (abs && abs->value != -1) { if (abs->resolution != 0) { - if (libevdev_get_abs_resolution(dev, abs->value) == - abs->resolution) - break; - rc = libevdev_kernel_set_abs_info(dev, abs->value, abs); @@ -2757,7 +1967,6 @@ { struct libevdev_uinput *uinput; const char *syspath; - char path[PATH_MAX]; struct udev *udev; struct udev_monitor *udev_monitor; @@ -2781,10 +1990,9 @@ uinput = litest_create_uinput(name, id, abs_info, events); syspath = libevdev_uinput_get_syspath(uinput); - snprintf(path, sizeof(path), "%s/event", syspath); /* blocking, we don't want to continue until udev is ready */ - while (1) { + do { udev_device = udev_monitor_receive_device(udev_monitor); litest_assert_notnull(udev_device); udev_action = udev_device_get_action(udev_device); @@ -2794,11 +2002,7 @@ } udev_syspath = udev_device_get_syspath(udev_device); - if (udev_syspath && strneq(udev_syspath, path, strlen(path))) - break; - - udev_device_unref(udev_device); - } + } while (!udev_syspath || strcmp(udev_syspath, syspath) != 0); litest_assert(udev_device_get_property_value(udev_device, "ID_INPUT")); @@ -2871,7 +2075,7 @@ enum libinput_event_type type = LIBINPUT_EVENT_POINTER_BUTTON; litest_assert(event != NULL); - litest_assert_event_type(event, type); + litest_assert_int_eq(libinput_event_get_type(event), type); ptrev = libinput_event_get_pointer_event(event); litest_assert_int_eq(libinput_event_pointer_get_button(ptrev), button); @@ -2890,7 +2094,7 @@ enum libinput_event_type type = LIBINPUT_EVENT_POINTER_AXIS; litest_assert(event != NULL); - litest_assert_event_type(event, type); + litest_assert_int_eq(libinput_event_get_type(event), type); ptrev = libinput_event_get_pointer_event(event); litest_assert(libinput_event_pointer_has_axis(ptrev, axis)); @@ -2909,7 +2113,7 @@ double x, y, ux, uy; litest_assert(event != NULL); - litest_assert_event_type(event, type); + litest_assert_int_eq(libinput_event_get_type(event), type); ptrev = libinput_event_get_pointer_event(event); x = libinput_event_pointer_get_dx(ptrev); @@ -2925,20 +2129,6 @@ } void -litest_assert_key_event(struct libinput *li, unsigned int key, - enum libinput_key_state state) -{ - struct libinput_event *event; - - litest_wait_for_event(li); - event = libinput_get_event(li); - - litest_is_keyboard_event(event, key, state); - - libinput_event_destroy(event); -} - -void litest_assert_button_event(struct libinput *li, unsigned int button, enum libinput_button_state state) { @@ -2968,7 +2158,7 @@ case LIBINPUT_EVENT_TOUCH_UP: case LIBINPUT_EVENT_TOUCH_MOTION: case LIBINPUT_EVENT_TOUCH_FRAME: - litest_assert_event_type(event, type); + litest_assert_int_eq(libinput_event_get_type(event), type); break; default: ck_abort_msg("%s: invalid touch type %d\n", __func__, type); @@ -2988,7 +2178,7 @@ enum libinput_event_type type = LIBINPUT_EVENT_KEYBOARD_KEY; litest_assert(event != NULL); - litest_assert_event_type(event, type); + litest_assert_int_eq(libinput_event_get_type(event), type); kevent = libinput_event_get_keyboard_event(event); litest_assert(kevent != NULL); @@ -3007,7 +2197,7 @@ struct libinput_event_gesture *gevent; litest_assert(event != NULL); - litest_assert_event_type(event, type); + litest_assert_int_eq(libinput_event_get_type(event), type); gevent = libinput_event_get_gesture_event(event); litest_assert(gevent != NULL); @@ -3018,156 +2208,6 @@ return gevent; } -struct libinput_event_tablet_tool * -litest_is_tablet_event(struct libinput_event *event, - enum libinput_event_type type) -{ - struct libinput_event_tablet_tool *tevent; - - litest_assert(event != NULL); - litest_assert_event_type(event, type); - - tevent = libinput_event_get_tablet_tool_event(event); - litest_assert(tevent != NULL); - - return tevent; -} - -void -litest_assert_tablet_button_event(struct libinput *li, unsigned int button, - enum libinput_button_state state) -{ - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - enum libinput_event_type type = LIBINPUT_EVENT_TABLET_TOOL_BUTTON; - - litest_wait_for_event(li); - event = libinput_get_event(li); - - litest_assert_notnull(event); - litest_assert_event_type(event, type); - tev = libinput_event_get_tablet_tool_event(event); - litest_assert_int_eq(libinput_event_tablet_tool_get_button(tev), - button); - litest_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev), - state); - libinput_event_destroy(event); -} - -void litest_assert_tablet_proximity_event(struct libinput *li, - enum libinput_tablet_tool_proximity_state state) -{ - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - enum libinput_event_type type = LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY; - - litest_wait_for_event(li); - event = libinput_get_event(li); - - litest_assert_notnull(event); - litest_assert_event_type(event, type); - tev = libinput_event_get_tablet_tool_event(event); - litest_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(tev), - state); - libinput_event_destroy(event); -} - -struct libinput_event_tablet_pad * -litest_is_pad_button_event(struct libinput_event *event, - unsigned int button, - enum libinput_button_state state) -{ - struct libinput_event_tablet_pad *p; - enum libinput_event_type type = LIBINPUT_EVENT_TABLET_PAD_BUTTON; - - litest_assert(event != NULL); - litest_assert_event_type(event, type); - - p = libinput_event_get_tablet_pad_event(event); - litest_assert(p != NULL); - - litest_assert_int_eq(libinput_event_tablet_pad_get_button_number(p), - button); - litest_assert_int_eq(libinput_event_tablet_pad_get_button_state(p), - state); - - return p; -} - -struct libinput_event_tablet_pad * -litest_is_pad_ring_event(struct libinput_event *event, - unsigned int number, - enum libinput_tablet_pad_ring_axis_source source) -{ - struct libinput_event_tablet_pad *p; - enum libinput_event_type type = LIBINPUT_EVENT_TABLET_PAD_RING; - - litest_assert(event != NULL); - litest_assert_event_type(event, type); - p = libinput_event_get_tablet_pad_event(event); - - litest_assert_int_eq(libinput_event_tablet_pad_get_ring_number(p), - number); - litest_assert_int_eq(libinput_event_tablet_pad_get_ring_source(p), - source); - - return p; -} - -struct libinput_event_tablet_pad * -litest_is_pad_strip_event(struct libinput_event *event, - unsigned int number, - enum libinput_tablet_pad_strip_axis_source source) -{ - struct libinput_event_tablet_pad *p; - enum libinput_event_type type = LIBINPUT_EVENT_TABLET_PAD_STRIP; - - litest_assert(event != NULL); - litest_assert_event_type(event, type); - p = libinput_event_get_tablet_pad_event(event); - - litest_assert_int_eq(libinput_event_tablet_pad_get_strip_number(p), - number); - litest_assert_int_eq(libinput_event_tablet_pad_get_strip_source(p), - source); - - return p; -} - -struct libinput_event_switch * -litest_is_switch_event(struct libinput_event *event, - enum libinput_switch sw, - enum libinput_switch_state state) -{ - struct libinput_event_switch *swev; - enum libinput_event_type type = LIBINPUT_EVENT_SWITCH_TOGGLE; - - litest_assert_notnull(event); - litest_assert_event_type(event, type); - swev = libinput_event_get_switch_event(event); - - litest_assert_int_eq(libinput_event_switch_get_switch(swev), sw); - litest_assert_int_eq(libinput_event_switch_get_switch_state(swev), - state); - - return swev; -} - -void -litest_assert_pad_button_event(struct libinput *li, - unsigned int button, - enum libinput_button_state state) -{ - struct libinput_event *event; - struct libinput_event_tablet_pad *pev; - - litest_wait_for_event(li); - event = libinput_get_event(li); - - pev = litest_is_pad_button_event(event, button, state); - libinput_event_destroy(libinput_event_tablet_pad_get_base_event(pev)); -} - void litest_assert_scroll(struct libinput *li, enum libinput_pointer_axis axis, @@ -3176,7 +2216,6 @@ struct libinput_event *event, *next_event; struct libinput_event_pointer *ptrev; int value; - int nevents = 0; event = libinput_get_event(li); next_event = libinput_get_event(li); @@ -3184,26 +2223,16 @@ while (event) { ptrev = litest_is_axis_event(event, axis, 0); - nevents++; if (next_event) { - int min = minimum_movement; - value = libinput_event_pointer_get_axis_value(ptrev, axis); - /* Due to how the hysteresis works on touchpad - * events, the first event is reduced by the - * hysteresis margin that can cause the first event - * go under the minimum we expect for all other - * events */ - if (nevents == 1) - min = minimum_movement/2; - /* Normal scroll event, check dir */ - if (minimum_movement > 0) - litest_assert_int_ge(value, min); - else - litest_assert_int_le(value, min); + if (minimum_movement > 0) { + litest_assert_int_ge(value, minimum_movement); + } else { + litest_assert_int_le(value, minimum_movement); + } } else { /* Last scroll event, must be 0 */ ck_assert_double_eq( @@ -3222,7 +2251,7 @@ { struct libinput_event *event; - litest_assert(type != LIBINPUT_EVENT_NONE); + assert(type != LIBINPUT_EVENT_NONE); libinput_dispatch(li); event = libinput_get_event(li); @@ -3238,39 +2267,6 @@ } void -litest_assert_touch_sequence(struct libinput *li) -{ - struct libinput_event *event; - - event = libinput_get_event(li); - litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_DOWN); - libinput_event_destroy(event); - - event = libinput_get_event(li); - litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_FRAME); - libinput_event_destroy(event); - - event = libinput_get_event(li); - do { - litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_MOTION); - libinput_event_destroy(event); - - event = libinput_get_event(li); - litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_FRAME); - libinput_event_destroy(event); - - event = libinput_get_event(li); - litest_assert_notnull(event); - } while (libinput_event_get_type(event) != LIBINPUT_EVENT_TOUCH_UP); - - litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_UP); - libinput_event_destroy(event); - event = libinput_get_event(li); - litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_FRAME); - libinput_event_destroy(event); -} - -void litest_timeout_tap(void) { msleep(200); @@ -3283,12 +2279,6 @@ } void -litest_timeout_debounce(void) -{ - msleep(30); -} - -void litest_timeout_softbuttons(void) { msleep(300); @@ -3337,63 +2327,18 @@ } void -litest_timeout_gesture_scroll(void) -{ - msleep(180); -} - -void -litest_timeout_trackpoint(void) -{ - msleep(320); -} - -void -litest_timeout_tablet_proxout(void) -{ - msleep(70); -} - -void -litest_timeout_hysteresis(void) -{ - msleep(90); -} - -void litest_push_event_frame(struct litest_device *dev) { - litest_assert(dev->skip_ev_syn >= 0); - dev->skip_ev_syn++; + assert(!dev->skip_ev_syn); + dev->skip_ev_syn = true; } void litest_pop_event_frame(struct litest_device *dev) { - litest_assert(dev->skip_ev_syn > 0); - dev->skip_ev_syn--; - if (dev->skip_ev_syn == 0) - litest_event(dev, EV_SYN, SYN_REPORT, 0); -} - -void -litest_filter_event(struct litest_device *dev, - unsigned int type, - unsigned int code) -{ - libevdev_disable_event_code(dev->evdev, type, code); -} - -void -litest_unfilter_event(struct litest_device *dev, - unsigned int type, - unsigned int code) -{ - /* would need an non-NULL argument for re-enabling, so simply abort - * until we need to be more sophisticated */ - litest_assert(type != EV_ABS); - - libevdev_enable_event_code(dev->evdev, type, code, NULL); + assert(dev->skip_ev_syn); + dev->skip_ev_syn = false; + litest_event(dev, EV_SYN, SYN_REPORT, 0); } static void @@ -3550,7 +2495,6 @@ OPT_FILTER_TEST, OPT_FILTER_DEVICE, OPT_FILTER_GROUP, - OPT_JOBS, OPT_LIST, OPT_VERBOSE, }; @@ -3558,48 +2502,27 @@ { "filter-test", 1, 0, OPT_FILTER_TEST }, { "filter-device", 1, 0, OPT_FILTER_DEVICE }, { "filter-group", 1, 0, OPT_FILTER_GROUP }, - { "jobs", 1, 0, OPT_JOBS }, { "list", 0, 0, OPT_LIST }, { "verbose", 0, 0, OPT_VERBOSE }, { 0, 0, 0, 0} }; - enum { - JOBS_DEFAULT, - JOBS_SINGLE, - JOBS_CUSTOM - } want_jobs = JOBS_DEFAULT; - - if (in_debugger) - want_jobs = JOBS_SINGLE; - while(1) { int c; int option_index = 0; - c = getopt_long(argc, argv, "j:", opts, &option_index); + c = getopt_long(argc, argv, "", opts, &option_index); if (c == -1) break; switch(c) { case OPT_FILTER_TEST: filter_test = optarg; - if (want_jobs == JOBS_DEFAULT) - want_jobs = JOBS_SINGLE; break; case OPT_FILTER_DEVICE: filter_device = optarg; - if (want_jobs == JOBS_DEFAULT) - want_jobs = JOBS_SINGLE; break; case OPT_FILTER_GROUP: filter_group = optarg; - if (want_jobs == JOBS_DEFAULT) - want_jobs = JOBS_SINGLE; - break; - case 'j': - case OPT_JOBS: - jobs = atoi(optarg); - want_jobs = JOBS_CUSTOM; break; case OPT_LIST: return LITEST_MODE_LIST; @@ -3612,149 +2535,45 @@ } } - if (want_jobs == JOBS_SINGLE) - jobs = 1; - return LITEST_MODE_TEST; } #ifndef LITEST_NO_MAIN -static int -is_debugger_attached(void) -{ - int status; - int rc; - int pid = fork(); - - if (pid == -1) - return 0; - - if (pid == 0) { - int ppid = getppid(); - if (ptrace(PTRACE_ATTACH, ppid, NULL, NULL) == 0) { - waitpid(ppid, NULL, 0); - ptrace(PTRACE_CONT, NULL, NULL); - ptrace(PTRACE_DETACH, ppid, NULL, NULL); - rc = 0; - } else { - rc = 1; - } - _exit(rc); - } else { - waitpid(pid, &status, 0); - rc = WEXITSTATUS(status); - } - - return rc; -} - static void litest_list_tests(struct list *tests) { struct suite *s; - const char *last_test_name = NULL; list_for_each(s, tests, node) { struct test *t; printf("%s:\n", s->name); list_for_each(t, &s->tests, node) { - if (!last_test_name || - !streq(last_test_name, t->name)) - printf(" %s:\n", t->name); - - last_test_name = t->name; - - printf(" %s\n", t->devname); + printf(" %s\n", t->name); } } } -extern const struct test_device __start_test_section, __stop_test_section; - -static void -litest_init_test_devices(void) -{ - const struct test_device *t; - size_t ndevices = 0; - - for (ndevices = 1, - t = &__start_test_section; - t < &__stop_test_section; - ndevices++, t++) - ; /* loopdeeloop */ - - ndevices++; - devices = zalloc(ndevices * sizeof(*devices)); - - for (ndevices = 0, - t = &__start_test_section; - t < &__stop_test_section; - t++, ndevices++) { - devices[ndevices] = t->device; - } -} - int main(int argc, char **argv) { - const struct rlimit corelimit = { 0, 0 }; enum litest_mode mode; - if (getuid() != 0) { - fprintf(stderr, - "%s must be run as root.\n", - program_invocation_short_name); - return 77; - } - - if (access("/dev/uinput", F_OK) == -1 && - access("/dev/input/uinput", F_OK) == -1) { - fprintf(stderr, - "uinput device is missing, skipping tests.\n"); - return 77; - } - - litest_init_test_devices(); - list_init(&all_tests); - setenv("CK_DEFAULT_TIMEOUT", "30", 0); + setenv("CK_DEFAULT_TIMEOUT", "10", 0); setenv("LIBINPUT_RUNNING_TEST_SUITE", "1", 1); - in_debugger = is_debugger_attached(); - if (in_debugger) - setenv("CK_FORK", "no", 0); - mode = litest_parse_argv(argc, argv); if (mode == LITEST_MODE_ERROR) return EXIT_FAILURE; - litest_setup_tests_udev(); - litest_setup_tests_path(); - litest_setup_tests_pointer(); - litest_setup_tests_touch(); - litest_setup_tests_log(); - litest_setup_tests_tablet(); - litest_setup_tests_pad(); - litest_setup_tests_touchpad(); - litest_setup_tests_touchpad_tap(); - litest_setup_tests_touchpad_buttons(); - litest_setup_tests_trackpoint(); - litest_setup_tests_trackball(); - litest_setup_tests_misc(); - litest_setup_tests_keyboard(); - litest_setup_tests_device(); - litest_setup_tests_gestures(); - litest_setup_tests_lid(); + litest_setup_tests(); if (mode == LITEST_MODE_LIST) { litest_list_tests(&all_tests); return EXIT_SUCCESS; } - if (setrlimit(RLIMIT_CORE, &corelimit) != 0) - perror("WARNING: Core dumps not disabled. Reason"); - return litest_run(argc, argv); } #endif diff -Nru libinput-1.10.3/test/litest-device-acer-hawaii-keyboard.c libinput-0.21.0/test/litest-device-acer-hawaii-keyboard.c --- libinput-1.10.3/test/litest-device-acer-hawaii-keyboard.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-acer-hawaii-keyboard.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,200 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x4f2, - .product = 0x1558, -}; - -static int events[] = { - EV_KEY, KEY_ESC, - EV_KEY, KEY_1, - EV_KEY, KEY_2, - EV_KEY, KEY_3, - EV_KEY, KEY_4, - EV_KEY, KEY_5, - EV_KEY, KEY_6, - EV_KEY, KEY_7, - EV_KEY, KEY_8, - EV_KEY, KEY_9, - EV_KEY, KEY_0, - EV_KEY, KEY_MINUS, - EV_KEY, KEY_EQUAL, - EV_KEY, KEY_BACKSPACE, - EV_KEY, KEY_TAB, - EV_KEY, KEY_Q, - EV_KEY, KEY_W, - EV_KEY, KEY_E, - EV_KEY, KEY_R, - EV_KEY, KEY_T, - EV_KEY, KEY_Y, - EV_KEY, KEY_U, - EV_KEY, KEY_I, - EV_KEY, KEY_O, - EV_KEY, KEY_P, - EV_KEY, KEY_LEFTBRACE, - EV_KEY, KEY_RIGHTBRACE, - EV_KEY, KEY_ENTER, - EV_KEY, KEY_LEFTCTRL, - EV_KEY, KEY_A, - EV_KEY, KEY_S, - EV_KEY, KEY_D, - EV_KEY, KEY_F, - EV_KEY, KEY_G, - EV_KEY, KEY_H, - EV_KEY, KEY_J, - EV_KEY, KEY_K, - EV_KEY, KEY_L, - EV_KEY, KEY_SEMICOLON, - EV_KEY, KEY_APOSTROPHE, - EV_KEY, KEY_GRAVE, - EV_KEY, KEY_LEFTSHIFT, - EV_KEY, KEY_BACKSLASH, - EV_KEY, KEY_Z, - EV_KEY, KEY_X, - EV_KEY, KEY_C, - EV_KEY, KEY_V, - EV_KEY, KEY_B, - EV_KEY, KEY_N, - EV_KEY, KEY_M, - EV_KEY, KEY_COMMA, - EV_KEY, KEY_DOT, - EV_KEY, KEY_SLASH, - EV_KEY, KEY_RIGHTSHIFT, - EV_KEY, KEY_KPASTERISK, - EV_KEY, KEY_LEFTALT, - EV_KEY, KEY_SPACE, - EV_KEY, KEY_CAPSLOCK, - EV_KEY, KEY_F1, - EV_KEY, KEY_F2, - EV_KEY, KEY_F3, - EV_KEY, KEY_F4, - EV_KEY, KEY_F5, - EV_KEY, KEY_F6, - EV_KEY, KEY_F7, - EV_KEY, KEY_F8, - EV_KEY, KEY_F9, - EV_KEY, KEY_F10, - EV_KEY, KEY_NUMLOCK, - EV_KEY, KEY_SCROLLLOCK, - EV_KEY, KEY_KP7, - EV_KEY, KEY_KP8, - EV_KEY, KEY_KP9, - EV_KEY, KEY_KPMINUS, - EV_KEY, KEY_KP4, - EV_KEY, KEY_KP5, - EV_KEY, KEY_KP6, - EV_KEY, KEY_KPPLUS, - EV_KEY, KEY_KP1, - EV_KEY, KEY_KP2, - EV_KEY, KEY_KP3, - EV_KEY, KEY_KP0, - EV_KEY, KEY_KPDOT, - EV_KEY, KEY_ZENKAKUHANKAKU, - EV_KEY, KEY_102ND, - EV_KEY, KEY_F11, - EV_KEY, KEY_F12, - EV_KEY, KEY_RO, - EV_KEY, KEY_KATAKANA, - EV_KEY, KEY_HIRAGANA, - EV_KEY, KEY_HENKAN, - EV_KEY, KEY_KATAKANAHIRAGANA, - EV_KEY, KEY_MUHENKAN, - EV_KEY, KEY_KPJPCOMMA, - EV_KEY, KEY_KPENTER, - EV_KEY, KEY_RIGHTCTRL, - EV_KEY, KEY_KPSLASH, - EV_KEY, KEY_SYSRQ, - EV_KEY, KEY_RIGHTALT, - EV_KEY, KEY_LINEFEED, - EV_KEY, KEY_HOME, - EV_KEY, KEY_UP, - EV_KEY, KEY_PAGEUP, - EV_KEY, KEY_LEFT, - EV_KEY, KEY_RIGHT, - EV_KEY, KEY_END, - EV_KEY, KEY_DOWN, - EV_KEY, KEY_PAGEDOWN, - EV_KEY, KEY_INSERT, - EV_KEY, KEY_DELETE, - EV_KEY, KEY_MACRO, - EV_KEY, KEY_MUTE, - EV_KEY, KEY_VOLUMEDOWN, - EV_KEY, KEY_VOLUMEUP, - EV_KEY, KEY_POWER, - EV_KEY, KEY_KPEQUAL, - EV_KEY, KEY_KPPLUSMINUS, - EV_KEY, KEY_PAUSE, - /* EV_KEY, KEY_SCALE, */ - EV_KEY, KEY_KPCOMMA, - EV_KEY, KEY_HANGEUL, - EV_KEY, KEY_HANJA, - EV_KEY, KEY_YEN, - EV_KEY, KEY_LEFTMETA, - EV_KEY, KEY_RIGHTMETA, - EV_KEY, KEY_COMPOSE, - EV_KEY, KEY_STOP, - - EV_KEY, KEY_MENU, - EV_KEY, KEY_CALC, - EV_KEY, KEY_SETUP, - EV_KEY, KEY_SLEEP, - EV_KEY, KEY_WAKEUP, - EV_KEY, KEY_SCREENLOCK, - EV_KEY, KEY_DIRECTION, - EV_KEY, KEY_CYCLEWINDOWS, - EV_KEY, KEY_MAIL, - EV_KEY, KEY_BOOKMARKS, - EV_KEY, KEY_COMPUTER, - EV_KEY, KEY_BACK, - EV_KEY, KEY_FORWARD, - EV_KEY, KEY_NEXTSONG, - EV_KEY, KEY_PLAYPAUSE, - EV_KEY, KEY_PREVIOUSSONG, - EV_KEY, KEY_STOPCD, - EV_KEY, KEY_HOMEPAGE, - EV_KEY, KEY_REFRESH, - EV_KEY, KEY_F14, - EV_KEY, KEY_F15, - EV_KEY, KEY_SEARCH, - EV_KEY, KEY_MEDIA, - EV_KEY, KEY_FN, - -1, -1, -}; - -TEST_DEVICE("hawaii-keyboard", - .type = LITEST_ACER_HAWAII_KEYBOARD, - .features = LITEST_KEYS, - .interface = NULL, - - .name = "Chicony ACER Hawaii Keyboard", - .id = &input_id, - .events = events, - .absinfo = NULL, -) diff -Nru libinput-1.10.3/test/litest-device-acer-hawaii-touchpad.c libinput-0.21.0/test/litest-device-acer-hawaii-touchpad.c --- libinput-1.10.3/test/litest-device-acer-hawaii-touchpad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-acer-hawaii-touchpad.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x4f2, - .product = 0x1558, -}; - -static int events[] = { - EV_KEY, BTN_LEFT, - EV_KEY, BTN_TOOL_FINGER, - EV_KEY, BTN_TOOL_QUINTTAP, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_TOOL_DOUBLETAP, - EV_KEY, BTN_TOOL_TRIPLETAP, - EV_KEY, BTN_TOOL_QUADTAP, - INPUT_PROP_MAX, INPUT_PROP_POINTER, - INPUT_PROP_MAX, INPUT_PROP_BUTTONPAD, - -1, -1, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 1151, 0, 0, 12 }, - { ABS_Y, 0, 738, 0, 0, 14 }, - { ABS_MT_SLOT, 0, 14, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 1151, 0, 0, 12 }, - { ABS_MT_POSITION_Y, 0, 738, 0, 0, 14 }, - { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, - { .value = -1 } -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"touchpad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"touchpad_end\"\n" -"ENV{ID_INPUT_TOUCHPAD}==\"\", GOTO=\"touchpad_end\"\n" -"\n" -"ATTRS{name}==\"litest Chicony ACER Hawaii Keyboard Touchpad\"," -" ENV{ID_INPUT_TOUCHPAD_INTEGRATION}=\"external\"\n" -"\n" -"LABEL=\"touchpad_end\""; - -TEST_DEVICE("hawaii-touchpad", - .type = LITEST_ACER_HAWAII_TOUCHPAD, - .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON, - .interface = &interface, - - .name = "Chicony ACER Hawaii Keyboard Touchpad", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-alps-dualpoint.c libinput-0.21.0/test/litest-device-alps-dualpoint.c --- libinput-1.10.3/test/litest-device-alps-dualpoint.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-alps-dualpoint.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,7 +21,9 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include @@ -30,46 +32,43 @@ #include "litest.h" #include "litest-int.h" -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; +static void alps_dualpoint_create(struct litest_device *d); -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; +static void +litest_alps_dualpoint_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_ALPS_DUALPOINT); + litest_set_current_device(d); +} -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) +static void +alps_dualpoint_touch_down(struct litest_device *d, unsigned int slot, double x, double y) { - switch (evcode) { - case ABS_PRESSURE: - case ABS_MT_PRESSURE: - *value = 30; - return 0; - } - return 1; + struct litest_semi_mt *semi_mt = d->private; + + litest_semi_mt_touch_down(d, semi_mt, slot, x, y); } -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, +static void +alps_dualpoint_touch_move(struct litest_device *d, unsigned int slot, double x, double y) +{ + struct litest_semi_mt *semi_mt = d->private; + + litest_semi_mt_touch_move(d, semi_mt, slot, x, y); +} + +static void +alps_dualpoint_touch_up(struct litest_device *d, unsigned int slot) +{ + struct litest_semi_mt *semi_mt = d->private; - .get_axis_default = get_axis_default, + litest_semi_mt_touch_up(d, semi_mt, slot); +} + +static struct litest_device_interface interface = { + .touch_down = alps_dualpoint_touch_down, + .touch_move = alps_dualpoint_touch_move, + .touch_up = alps_dualpoint_touch_up, }; static struct input_id input_id = { @@ -103,24 +102,31 @@ { .value = -1 } }; -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"touchpad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"touchpad_end\"\n" -"ENV{ID_INPUT_TOUCHPAD}==\"\", GOTO=\"touchpad_end\"\n" -"\n" -"ATTRS{name}==\"litest AlpsPS/2 ALPS DualPoint TouchPad\"," -" ENV{LIBINPUT_MODEL_TOUCHPAD_VISIBLE_MARKER}=\"1\"\n" -"\n" -"LABEL=\"touchpad_end\""; - -TEST_DEVICE("alps-dualpoint", +struct litest_test_device litest_alps_dualpoint_device = { .type = LITEST_ALPS_DUALPOINT, .features = LITEST_TOUCHPAD | LITEST_BUTTON | LITEST_SEMI_MT, + .shortname = "alps dualpoint", + .setup = litest_alps_dualpoint_setup, .interface = &interface, + .create = alps_dualpoint_create, .name = "AlpsPS/2 ALPS DualPoint TouchPad", .id = &input_id, .events = events, .absinfo = absinfo, - .udev_rule = udev_rule, -) +}; + +static void +alps_dualpoint_create(struct litest_device *d) +{ + struct litest_semi_mt *semi_mt = zalloc(sizeof(*semi_mt)); + assert(semi_mt); + + d->private = semi_mt; + + d->uinput = litest_create_uinput_device_from_description(litest_alps_dualpoint_device.name, + litest_alps_dualpoint_device.id, + absinfo, + events); + d->interface = &interface; +} diff -Nru libinput-1.10.3/test/litest-device-alps-semi-mt.c libinput-0.21.0/test/litest-device-alps-semi-mt.c --- libinput-1.10.3/test/litest-device-alps-semi-mt.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-alps-semi-mt.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,7 +21,9 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include @@ -30,46 +32,43 @@ #include "litest.h" #include "litest-int.h" -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; +static void alps_create(struct litest_device *d); -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; +static void +litest_alps_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_ALPS_SEMI_MT); + litest_set_current_device(d); +} + +static void +alps_touch_down(struct litest_device *d, unsigned int slot, double x, double y) +{ + struct litest_semi_mt *semi_mt = d->private; + + litest_semi_mt_touch_down(d, semi_mt, slot, x, y); +} -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) +static void +alps_touch_move(struct litest_device *d, unsigned int slot, double x, double y) { - switch (evcode) { - case ABS_PRESSURE: - case ABS_MT_PRESSURE: - *value = 30; - return 0; - } - return 1; + struct litest_semi_mt *semi_mt = d->private; + + litest_semi_mt_touch_move(d, semi_mt, slot, x, y); } -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, +static void +alps_touch_up(struct litest_device *d, unsigned int slot) +{ + struct litest_semi_mt *semi_mt = d->private; + + litest_semi_mt_touch_up(d, semi_mt, slot); +} - .get_axis_default = get_axis_default, +static struct litest_device_interface interface = { + .touch_down = alps_touch_down, + .touch_move = alps_touch_move, + .touch_up = alps_touch_up, }; static struct input_id input_id = { @@ -103,13 +102,31 @@ { .value = -1 } }; -TEST_DEVICE("alps-semi-mt", +struct litest_test_device litest_alps_device = { .type = LITEST_ALPS_SEMI_MT, .features = LITEST_TOUCHPAD | LITEST_BUTTON | LITEST_SEMI_MT, + .shortname = "alps semi-mt", + .setup = litest_alps_setup, .interface = &interface, + .create = alps_create, .name = "AlpsPS/2 ALPS GlidePoint", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; + +static void +alps_create(struct litest_device *d) +{ + struct litest_semi_mt *semi_mt = zalloc(sizeof(*semi_mt)); + assert(semi_mt); + + d->private = semi_mt; + + d->uinput = litest_create_uinput_device_from_description(litest_alps_device.name, + litest_alps_device.id, + absinfo, + events); + d->interface = &interface; +} diff -Nru libinput-1.10.3/test/litest-device-anker-mouse-kbd.c libinput-0.21.0/test/litest-device-anker-mouse-kbd.c --- libinput-1.10.3/test/litest-device-anker-mouse-kbd.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-anker-mouse-kbd.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,215 +0,0 @@ -/* - * Copyright © 2015 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -/* Recording from https://bugs.freedesktop.org/show_bug.cgi?id=93474 - * This is the keyboard device for this mouse. - */ - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x4d9, - .product = 0xfa50, -}; - -static int events[] = { - EV_REL, REL_HWHEEL, - EV_KEY, KEY_ESC, - EV_KEY, KEY_KPMINUS, - EV_KEY, KEY_KPPLUS, - EV_KEY, KEY_UP, - EV_KEY, KEY_PAGEUP, - EV_KEY, KEY_LEFT, - EV_KEY, KEY_RIGHT, - EV_KEY, KEY_END, - EV_KEY, KEY_DOWN, - EV_KEY, KEY_PAGEDOWN, - EV_KEY, KEY_INSERT, - EV_KEY, KEY_DELETE, - EV_KEY, KEY_MUTE, - EV_KEY, KEY_VOLUMEDOWN, - EV_KEY, KEY_VOLUMEUP, - EV_KEY, KEY_POWER, - EV_KEY, KEY_PAUSE, - EV_KEY, KEY_STOP, - EV_KEY, KEY_PROPS, - EV_KEY, KEY_UNDO, - EV_KEY, KEY_COPY, - EV_KEY, KEY_OPEN, - EV_KEY, KEY_PASTE, - EV_KEY, KEY_FIND, - EV_KEY, KEY_CUT, - EV_KEY, KEY_HELP, - EV_KEY, KEY_MENU, - EV_KEY, KEY_CALC, - EV_KEY, KEY_SLEEP, - EV_KEY, KEY_WAKEUP, - EV_KEY, KEY_FILE, - EV_KEY, KEY_WWW, - EV_KEY, KEY_COFFEE, - EV_KEY, KEY_MAIL, - EV_KEY, KEY_BOOKMARKS, - EV_KEY, KEY_BACK, - EV_KEY, KEY_FORWARD, - EV_KEY, KEY_EJECTCD, - EV_KEY, KEY_NEXTSONG, - EV_KEY, KEY_PLAYPAUSE, - EV_KEY, KEY_PREVIOUSSONG, - EV_KEY, KEY_STOPCD, - EV_KEY, KEY_RECORD, - EV_KEY, KEY_REWIND, - EV_KEY, KEY_PHONE, - EV_KEY, KEY_CONFIG, - EV_KEY, KEY_HOMEPAGE, - EV_KEY, KEY_REFRESH, - EV_KEY, KEY_EXIT, - EV_KEY, KEY_EDIT, - EV_KEY, KEY_SCROLLUP, - EV_KEY, KEY_SCROLLDOWN, - EV_KEY, KEY_NEW, - EV_KEY, KEY_REDO, - EV_KEY, KEY_CLOSE, - EV_KEY, KEY_PLAY, - EV_KEY, KEY_FASTFORWARD, - EV_KEY, KEY_BASSBOOST, - EV_KEY, KEY_PRINT, - EV_KEY, KEY_CAMERA, - EV_KEY, KEY_CHAT, - EV_KEY, KEY_SEARCH, - EV_KEY, KEY_FINANCE, - EV_KEY, KEY_BRIGHTNESSDOWN, - EV_KEY, KEY_BRIGHTNESSUP, - EV_KEY, KEY_KBDILLUMTOGGLE, - EV_KEY, KEY_SAVE, - EV_KEY, KEY_DOCUMENTS, - EV_KEY, KEY_UNKNOWN, - EV_KEY, KEY_VIDEO_NEXT, - EV_KEY, KEY_BRIGHTNESS_AUTO, - EV_KEY, BTN_0, - EV_KEY, KEY_SELECT, - EV_KEY, KEY_GOTO, - EV_KEY, KEY_INFO, - EV_KEY, KEY_PROGRAM, - EV_KEY, KEY_PVR, - EV_KEY, KEY_SUBTITLE, - EV_KEY, KEY_ZOOM, - EV_KEY, KEY_KEYBOARD, - EV_KEY, KEY_PC, - EV_KEY, KEY_TV, - EV_KEY, KEY_TV2, - EV_KEY, KEY_VCR, - EV_KEY, KEY_VCR2, - EV_KEY, KEY_SAT, - EV_KEY, KEY_CD, - EV_KEY, KEY_TAPE, - EV_KEY, KEY_TUNER, - EV_KEY, KEY_PLAYER, - EV_KEY, KEY_DVD, - EV_KEY, KEY_AUDIO, - EV_KEY, KEY_VIDEO, - EV_KEY, KEY_MEMO, - EV_KEY, KEY_CALENDAR, - EV_KEY, KEY_RED, - EV_KEY, KEY_GREEN, - EV_KEY, KEY_YELLOW, - EV_KEY, KEY_BLUE, - EV_KEY, KEY_CHANNELUP, - EV_KEY, KEY_CHANNELDOWN, - EV_KEY, KEY_LAST, - EV_KEY, KEY_NEXT, - EV_KEY, KEY_RESTART, - EV_KEY, KEY_SLOW, - EV_KEY, KEY_SHUFFLE, - EV_KEY, KEY_PREVIOUS, - EV_KEY, KEY_VIDEOPHONE, - EV_KEY, KEY_GAMES, - EV_KEY, KEY_ZOOMIN, - EV_KEY, KEY_ZOOMOUT, - EV_KEY, KEY_ZOOMRESET, - EV_KEY, KEY_WORDPROCESSOR, - EV_KEY, KEY_EDITOR, - EV_KEY, KEY_SPREADSHEET, - EV_KEY, KEY_GRAPHICSEDITOR, - EV_KEY, KEY_PRESENTATION, - EV_KEY, KEY_DATABASE, - EV_KEY, KEY_NEWS, - EV_KEY, KEY_VOICEMAIL, - EV_KEY, KEY_ADDRESSBOOK, - EV_KEY, KEY_MESSENGER, - EV_KEY, KEY_DISPLAYTOGGLE, - EV_KEY, KEY_SPELLCHECK, - EV_KEY, KEY_LOGOFF, - EV_KEY, KEY_MEDIA_REPEAT, - EV_KEY, KEY_IMAGES, - EV_KEY, KEY_BUTTONCONFIG, - EV_KEY, KEY_TASKMANAGER, - EV_KEY, KEY_JOURNAL, - EV_KEY, KEY_CONTROLPANEL, - EV_KEY, KEY_APPSELECT, - EV_KEY, KEY_SCREENSAVER, - EV_KEY, KEY_VOICECOMMAND, - EV_KEY, KEY_BRIGHTNESS_MIN, - EV_KEY, KEY_BRIGHTNESS_MAX, - EV_KEY, KEY_KBDINPUTASSIST_PREV, - EV_KEY, KEY_KBDINPUTASSIST_NEXT, - EV_KEY, KEY_KBDINPUTASSIST_PREVGROUP, - EV_KEY, KEY_KBDINPUTASSIST_NEXTGROUP, - EV_KEY, KEY_KBDINPUTASSIST_ACCEPT, - EV_KEY, KEY_KBDINPUTASSIST_CANCEL, - EV_MSC, MSC_SCAN, - -1 , -1, -}; - -static struct input_absinfo absinfo[] = { - { ABS_VOLUME, 0, 4096, 0, 0, 0 }, - { ABS_MISC, 0, 255, 0, 0, 0 }, - { 0x29, 0, 255, 0, 0, 0 }, - { 0x2a, 0, 255, 0, 0, 0 }, - { 0x2b, 0, 255, 0, 0, 0 }, - { 0x2c, 0, 255, 0, 0, 0 }, - { 0x2d, 0, 255, 0, 0, 0 }, - { 0x2e, 0, 255, 0, 0, 0 }, - { ABS_MT_SLOT, 0, 255, 0, 0, 0 }, - { ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0, 0 }, - { ABS_MT_TOUCH_MINOR, 0, 255, 0, 0, 0 }, - { ABS_MT_WIDTH_MINOR, 0, 255, 0, 0, 0 }, - { ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0, 0 }, - { ABS_MT_ORIENTATION, 0, 255, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 255, 0, 0, 0 }, - { .value = -1 }, -}; - -TEST_DEVICE("anker-kbd", - .type = LITEST_ANKER_MOUSE_KBD, - .features = LITEST_KEYS | LITEST_WHEEL, - .interface = NULL, - - .name = "USB Laser Game Mouse", - .id = &input_id, - .absinfo = absinfo, - .events = events, -) diff -Nru libinput-1.10.3/test/litest-device-apple-appletouch.c libinput-0.21.0/test/litest-device-apple-appletouch.c --- libinput-1.10.3/test/litest-device-apple-appletouch.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-apple-appletouch.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_PRESSURE: - case ABS_MT_PRESSURE: - *value = 70; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, - - .get_axis_default = get_axis_default, -}; - -static struct input_id input_id = { - .bustype = 0x03, - .vendor = 0x5ac, - .product = 0x21a, -}; - -static int events[] = { - EV_KEY, BTN_LEFT, - EV_KEY, BTN_TOOL_FINGER, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_TOOL_DOUBLETAP, - EV_KEY, BTN_TOOL_TRIPLETAP, - -1, -1, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 1215, 0, 0, 0 }, - { ABS_Y, 0, 588, 0, 0, 0 }, - { ABS_PRESSURE, 0, 300, 0, 0, 0 }, - { .value = -1 } -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"touchpad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"touchpad_end\"\n" -"ENV{ID_INPUT_TOUCHPAD}==\"\", GOTO=\"touchpad_end\"\n" -"\n" -"ATTRS{name}==\"litest appletouch\"," -" ENV{LIBINPUT_MODEL_APPLE_TOUCHPAD_ONEBUTTON}=\"1\"\n" -"\n" -"LABEL=\"touchpad_end\""; - -TEST_DEVICE("appletouch", - .type = LITEST_APPLETOUCH, - .features = LITEST_TOUCHPAD | LITEST_BUTTON | LITEST_SINGLE_TOUCH, - .interface = &interface, - - .name = "appletouch", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-apple-internal-keyboard.c libinput-0.21.0/test/litest-device-apple-internal-keyboard.c --- libinput-1.10.3/test/litest-device-apple-internal-keyboard.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-apple-internal-keyboard.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,229 +0,0 @@ -/* - * Copyright © 2015 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x5ac, - .product = 0x273, -}; - -static int events[] = { - EV_KEY, KEY_ESC, - EV_KEY, KEY_1, - EV_KEY, KEY_2, - EV_KEY, KEY_3, - EV_KEY, KEY_4, - EV_KEY, KEY_5, - EV_KEY, KEY_6, - EV_KEY, KEY_7, - EV_KEY, KEY_8, - EV_KEY, KEY_9, - EV_KEY, KEY_0, - EV_KEY, KEY_MINUS, - EV_KEY, KEY_EQUAL, - EV_KEY, KEY_BACKSPACE, - EV_KEY, KEY_TAB, - EV_KEY, KEY_Q, - EV_KEY, KEY_W, - EV_KEY, KEY_E, - EV_KEY, KEY_R, - EV_KEY, KEY_T, - EV_KEY, KEY_Y, - EV_KEY, KEY_U, - EV_KEY, KEY_I, - EV_KEY, KEY_O, - EV_KEY, KEY_P, - EV_KEY, KEY_LEFTBRACE, - EV_KEY, KEY_RIGHTBRACE, - EV_KEY, KEY_ENTER, - EV_KEY, KEY_LEFTCTRL, - EV_KEY, KEY_A, - EV_KEY, KEY_S, - EV_KEY, KEY_D, - EV_KEY, KEY_F, - EV_KEY, KEY_G, - EV_KEY, KEY_H, - EV_KEY, KEY_J, - EV_KEY, KEY_K, - EV_KEY, KEY_L, - EV_KEY, KEY_SEMICOLON, - EV_KEY, KEY_APOSTROPHE, - EV_KEY, KEY_GRAVE, - EV_KEY, KEY_LEFTSHIFT, - EV_KEY, KEY_BACKSLASH, - EV_KEY, KEY_Z, - EV_KEY, KEY_X, - EV_KEY, KEY_C, - EV_KEY, KEY_V, - EV_KEY, KEY_B, - EV_KEY, KEY_N, - EV_KEY, KEY_M, - EV_KEY, KEY_COMMA, - EV_KEY, KEY_DOT, - EV_KEY, KEY_SLASH, - EV_KEY, KEY_RIGHTSHIFT, - EV_KEY, KEY_KPASTERISK, - EV_KEY, KEY_LEFTALT, - EV_KEY, KEY_SPACE, - EV_KEY, KEY_CAPSLOCK, - EV_KEY, KEY_F1, - EV_KEY, KEY_F2, - EV_KEY, KEY_F3, - EV_KEY, KEY_F4, - EV_KEY, KEY_F5, - EV_KEY, KEY_F6, - EV_KEY, KEY_F7, - EV_KEY, KEY_F8, - EV_KEY, KEY_F9, - EV_KEY, KEY_F10, - EV_KEY, KEY_NUMLOCK, - EV_KEY, KEY_SCROLLLOCK, - EV_KEY, KEY_KP7, - EV_KEY, KEY_KP8, - EV_KEY, KEY_KP9, - EV_KEY, KEY_KPMINUS, - EV_KEY, KEY_KP4, - EV_KEY, KEY_KP5, - EV_KEY, KEY_KP6, - EV_KEY, KEY_KPPLUS, - EV_KEY, KEY_KP1, - EV_KEY, KEY_KP2, - EV_KEY, KEY_KP3, - EV_KEY, KEY_KP0, - EV_KEY, KEY_KPDOT, - EV_KEY, KEY_ZENKAKUHANKAKU, - EV_KEY, KEY_102ND, - EV_KEY, KEY_F11, - EV_KEY, KEY_F12, - EV_KEY, KEY_RO, - EV_KEY, KEY_KATAKANA, - EV_KEY, KEY_HIRAGANA, - EV_KEY, KEY_HENKAN, - EV_KEY, KEY_KATAKANAHIRAGANA, - EV_KEY, KEY_MUHENKAN, - EV_KEY, KEY_KPJPCOMMA, - EV_KEY, KEY_KPENTER, - EV_KEY, KEY_RIGHTCTRL, - EV_KEY, KEY_KPSLASH, - EV_KEY, KEY_SYSRQ, - EV_KEY, KEY_RIGHTALT, - EV_KEY, KEY_HOME, - EV_KEY, KEY_UP, - EV_KEY, KEY_PAGEUP, - EV_KEY, KEY_LEFT, - EV_KEY, KEY_RIGHT, - EV_KEY, KEY_END, - EV_KEY, KEY_DOWN, - EV_KEY, KEY_PAGEDOWN, - EV_KEY, KEY_INSERT, - EV_KEY, KEY_DELETE, - EV_KEY, KEY_MUTE, - EV_KEY, KEY_VOLUMEDOWN, - EV_KEY, KEY_VOLUMEUP, - EV_KEY, KEY_POWER, - EV_KEY, KEY_KPEQUAL, - EV_KEY, KEY_PAUSE, - EV_KEY, KEY_SCALE, - EV_KEY, KEY_KPCOMMA, - EV_KEY, KEY_HANGEUL, - EV_KEY, KEY_HANJA, - EV_KEY, KEY_YEN, - EV_KEY, KEY_LEFTMETA, - EV_KEY, KEY_RIGHTMETA, - EV_KEY, KEY_COMPOSE, - EV_KEY, KEY_STOP, - EV_KEY, KEY_AGAIN, - EV_KEY, KEY_PROPS, - EV_KEY, KEY_UNDO, - EV_KEY, KEY_FRONT, - EV_KEY, KEY_COPY, - EV_KEY, KEY_OPEN, - EV_KEY, KEY_PASTE, - EV_KEY, KEY_FIND, - EV_KEY, KEY_CUT, - EV_KEY, KEY_HELP, - EV_KEY, KEY_CALC, - EV_KEY, KEY_SLEEP, - EV_KEY, KEY_WWW, - EV_KEY, KEY_COFFEE, - EV_KEY, KEY_BACK, - EV_KEY, KEY_FORWARD, - EV_KEY, KEY_EJECTCD, - EV_KEY, KEY_NEXTSONG, - EV_KEY, KEY_PLAYPAUSE, - EV_KEY, KEY_PREVIOUSSONG, - EV_KEY, KEY_STOPCD, - EV_KEY, KEY_REWIND, - EV_KEY, KEY_REFRESH, - EV_KEY, KEY_EDIT, - EV_KEY, KEY_SCROLLUP, - EV_KEY, KEY_SCROLLDOWN, - EV_KEY, KEY_KPLEFTPAREN, - EV_KEY, KEY_KPRIGHTPAREN, - EV_KEY, KEY_F13, - EV_KEY, KEY_F14, - EV_KEY, KEY_F15, - EV_KEY, KEY_F16, - EV_KEY, KEY_F17, - EV_KEY, KEY_F18, - EV_KEY, KEY_F19, - EV_KEY, KEY_F20, - EV_KEY, KEY_F21, - EV_KEY, KEY_F22, - EV_KEY, KEY_F23, - EV_KEY, KEY_F24, - EV_KEY, KEY_DASHBOARD, - EV_KEY, KEY_FASTFORWARD, - EV_KEY, KEY_BRIGHTNESSDOWN, - EV_KEY, KEY_BRIGHTNESSUP, - EV_KEY, KEY_SWITCHVIDEOMODE, - EV_KEY, KEY_KBDILLUMTOGGLE, - EV_KEY, KEY_KBDILLUMDOWN, - EV_KEY, KEY_KBDILLUMUP, - EV_KEY, KEY_UNKNOWN, - EV_KEY, KEY_FN, - EV_MSC, MSC_SCAN, - - EV_LED, LED_NUML, - EV_LED, LED_CAPSL, - EV_LED, LED_SCROLLL, - EV_LED, LED_COMPOSE, - EV_LED, LED_KANA, - -1, -1 -}; - -TEST_DEVICE("apple-keyboard", - .type = LITEST_APPLE_KEYBOARD, - .features = LITEST_KEYS, - .interface = NULL, - - .name = "Apple Inc. Apple Internal Keyboard / Trackpad", - .id = &input_id, - .events = events, - .absinfo = NULL, -) diff -Nru libinput-1.10.3/test/litest-device-apple-magicmouse.c libinput-0.21.0/test/litest-device-apple-magicmouse.c --- libinput-1.10.3/test/litest-device-apple-magicmouse.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-apple-magicmouse.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = 272 }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = 400 }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = 272 }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = 400 }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, -}; - -static struct input_id input_id = { - .bustype = 0x5, - .vendor = 0x5ac, - .product = 0x30d, -}; - -static int events[] = { - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_KEY, BTN_MIDDLE, - EV_REL, REL_X, - EV_REL, REL_Y, - EV_REL, REL_WHEEL, - EV_REL, REL_HWHEEL, - -1 , -1, -}; - -static struct input_absinfo absinfo[] = { - { ABS_MT_SLOT, 0, 15, 0, 0, 0 }, - { ABS_MT_TOUCH_MAJOR, 0, 1020, 0, 0, 0 }, - { ABS_MT_TOUCH_MINOR, 0, 1020, 0, 0, 0 }, - { ABS_MT_ORIENTATION, -31, 32, 1, 0, 0 }, - { ABS_MT_POSITION_X, -1100, 1258, 4, 0, 26 }, - { ABS_MT_POSITION_Y, -1589, 2047, 4, 0, 26 }, - { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, - { .value = -1 } -}; - -/* Force MOUSE_DPI to the empty string. As of systemd commit f013e99e160f - * ID_BUS=bluetooth now triggers the hwdb entry for this device. This causes - * test case failures because deltas change. Detecting old vs new systemd is - * hard, and because our rules are 99-prefixed we can't set ID_BUS ourselves - * on older systemd. - * So let's go the easy way and unset MOUSE_DPI so we can continue to use - * the current tests. - */ -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"mouse_end\"\n" -"KERNEL!=\"event*\", GOTO=\"mouse_end\"\n" -"ENV{ID_INPUT_MOUSE}==\"\", GOTO=\"mouse_end\"\n" -"\n" -"ATTRS{name}==\"litest Apple Magic Mouse\"," -" ENV{MOUSE_DPI}=\"\"" -"\n" -"LABEL=\"mouse_end\""; - -TEST_DEVICE("magicmouse", - .type = LITEST_MAGICMOUSE, - .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL, - .interface = &interface, - - .name = "Apple Magic Mouse", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-asus-rog-gladius.c libinput-0.21.0/test/litest-device-asus-rog-gladius.c --- libinput-1.10.3/test/litest-device-asus-rog-gladius.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-asus-rog-gladius.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,324 +0,0 @@ -/* - * Copyright © 2015 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -/* Note: this is the second event node of this mouse only, the first event - * node is just a normal mouse */ - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x0b05, - .product = 0x181a, -}; - -static int events[] = { - EV_REL, REL_X, - EV_REL, REL_Y, - EV_REL, REL_HWHEEL, - EV_KEY, KEY_ESC, - EV_KEY, KEY_1, - EV_KEY, KEY_2, - EV_KEY, KEY_3, - EV_KEY, KEY_4, - EV_KEY, KEY_5, - EV_KEY, KEY_6, - EV_KEY, KEY_7, - EV_KEY, KEY_8, - EV_KEY, KEY_9, - EV_KEY, KEY_0, - EV_KEY, KEY_MINUS, - EV_KEY, KEY_EQUAL, - EV_KEY, KEY_BACKSPACE, - EV_KEY, KEY_TAB, - EV_KEY, KEY_Q, - EV_KEY, KEY_W, - EV_KEY, KEY_E, - EV_KEY, KEY_R, - EV_KEY, KEY_T, - EV_KEY, KEY_Y, - EV_KEY, KEY_U, - EV_KEY, KEY_I, - EV_KEY, KEY_O, - EV_KEY, KEY_P, - EV_KEY, KEY_LEFTBRACE, - EV_KEY, KEY_RIGHTBRACE, - EV_KEY, KEY_ENTER, - EV_KEY, KEY_LEFTCTRL, - EV_KEY, KEY_A, - EV_KEY, KEY_S, - EV_KEY, KEY_D, - EV_KEY, KEY_F, - EV_KEY, KEY_G, - EV_KEY, KEY_H, - EV_KEY, KEY_J, - EV_KEY, KEY_K, - EV_KEY, KEY_L, - EV_KEY, KEY_SEMICOLON, - EV_KEY, KEY_APOSTROPHE, - EV_KEY, KEY_GRAVE, - EV_KEY, KEY_LEFTSHIFT, - EV_KEY, KEY_BACKSLASH, - EV_KEY, KEY_Z, - EV_KEY, KEY_X, - EV_KEY, KEY_C, - EV_KEY, KEY_V, - EV_KEY, KEY_B, - EV_KEY, KEY_N, - EV_KEY, KEY_M, - EV_KEY, KEY_COMMA, - EV_KEY, KEY_DOT, - EV_KEY, KEY_SLASH, - EV_KEY, KEY_RIGHTSHIFT, - EV_KEY, KEY_KPASTERISK, - EV_KEY, KEY_LEFTALT, - EV_KEY, KEY_SPACE, - EV_KEY, KEY_CAPSLOCK, - EV_KEY, KEY_F1, - EV_KEY, KEY_F2, - EV_KEY, KEY_F3, - EV_KEY, KEY_F4, - EV_KEY, KEY_F5, - EV_KEY, KEY_F6, - EV_KEY, KEY_F7, - EV_KEY, KEY_F8, - EV_KEY, KEY_F9, - EV_KEY, KEY_F10, - EV_KEY, KEY_NUMLOCK, - EV_KEY, KEY_SCROLLLOCK, - EV_KEY, KEY_KP7, - EV_KEY, KEY_KP8, - EV_KEY, KEY_KP9, - EV_KEY, KEY_KPMINUS, - EV_KEY, KEY_KP4, - EV_KEY, KEY_KP5, - EV_KEY, KEY_KP6, - EV_KEY, KEY_KPPLUS, - EV_KEY, KEY_KP1, - EV_KEY, KEY_KP2, - EV_KEY, KEY_KP3, - EV_KEY, KEY_KP0, - EV_KEY, KEY_KPDOT, - EV_KEY, KEY_ZENKAKUHANKAKU, - EV_KEY, KEY_102ND, - EV_KEY, KEY_F11, - EV_KEY, KEY_F12, - EV_KEY, KEY_RO, - EV_KEY, KEY_KATAKANA, - EV_KEY, KEY_HIRAGANA, - EV_KEY, KEY_HENKAN, - EV_KEY, KEY_KATAKANAHIRAGANA, - EV_KEY, KEY_MUHENKAN, - EV_KEY, KEY_KPJPCOMMA, - EV_KEY, KEY_KPENTER, - EV_KEY, KEY_RIGHTCTRL, - EV_KEY, KEY_KPSLASH, - EV_KEY, KEY_SYSRQ, - EV_KEY, KEY_RIGHTALT, - EV_KEY, KEY_HOME, - EV_KEY, KEY_UP, - EV_KEY, KEY_PAGEUP, - EV_KEY, KEY_LEFT, - EV_KEY, KEY_RIGHT, - EV_KEY, KEY_END, - EV_KEY, KEY_DOWN, - EV_KEY, KEY_PAGEDOWN, - EV_KEY, KEY_INSERT, - EV_KEY, KEY_DELETE, - EV_KEY, KEY_MUTE, - EV_KEY, KEY_VOLUMEDOWN, - EV_KEY, KEY_VOLUMEUP, - EV_KEY, KEY_POWER, - EV_KEY, KEY_KPEQUAL, - EV_KEY, KEY_PAUSE, - EV_KEY, KEY_KPCOMMA, - EV_KEY, KEY_HANGEUL, - EV_KEY, KEY_HANJA, - EV_KEY, KEY_YEN, - EV_KEY, KEY_LEFTMETA, - EV_KEY, KEY_RIGHTMETA, - EV_KEY, KEY_COMPOSE, - EV_KEY, KEY_STOP, - EV_KEY, KEY_AGAIN, - EV_KEY, KEY_PROPS, - EV_KEY, KEY_UNDO, - EV_KEY, KEY_FRONT, - EV_KEY, KEY_COPY, - EV_KEY, KEY_OPEN, - EV_KEY, KEY_PASTE, - EV_KEY, KEY_FIND, - EV_KEY, KEY_CUT, - EV_KEY, KEY_HELP, - EV_KEY, KEY_MENU, - EV_KEY, KEY_CALC, - EV_KEY, KEY_SLEEP, - EV_KEY, KEY_FILE, - EV_KEY, KEY_WWW, - EV_KEY, KEY_COFFEE, - EV_KEY, KEY_MAIL, - EV_KEY, KEY_BOOKMARKS, - EV_KEY, KEY_BACK, - EV_KEY, KEY_FORWARD, - EV_KEY, KEY_EJECTCD, - EV_KEY, KEY_NEXTSONG, - EV_KEY, KEY_PLAYPAUSE, - EV_KEY, KEY_PREVIOUSSONG, - EV_KEY, KEY_STOPCD, - EV_KEY, KEY_RECORD, - EV_KEY, KEY_REWIND, - EV_KEY, KEY_PHONE, - EV_KEY, KEY_CONFIG, - EV_KEY, KEY_HOMEPAGE, - EV_KEY, KEY_REFRESH, - EV_KEY, KEY_EXIT, - EV_KEY, KEY_EDIT, - EV_KEY, KEY_SCROLLUP, - EV_KEY, KEY_SCROLLDOWN, - EV_KEY, KEY_KPLEFTPAREN, - EV_KEY, KEY_KPRIGHTPAREN, - EV_KEY, KEY_NEW, - EV_KEY, KEY_REDO, - EV_KEY, KEY_F13, - EV_KEY, KEY_F14, - EV_KEY, KEY_F15, - EV_KEY, KEY_F16, - EV_KEY, KEY_F17, - EV_KEY, KEY_F18, - EV_KEY, KEY_F19, - EV_KEY, KEY_F20, - EV_KEY, KEY_F21, - EV_KEY, KEY_F22, - EV_KEY, KEY_F23, - EV_KEY, KEY_F24, - EV_KEY, KEY_CLOSE, - EV_KEY, KEY_PLAY, - EV_KEY, KEY_FASTFORWARD, - EV_KEY, KEY_BASSBOOST, - EV_KEY, KEY_PRINT, - EV_KEY, KEY_CAMERA, - EV_KEY, KEY_CHAT, - EV_KEY, KEY_SEARCH, - EV_KEY, KEY_FINANCE, - EV_KEY, KEY_CANCEL, - EV_KEY, KEY_BRIGHTNESSDOWN, - EV_KEY, KEY_BRIGHTNESSUP, - EV_KEY, KEY_KBDILLUMTOGGLE, - EV_KEY, KEY_SEND, - EV_KEY, KEY_REPLY, - EV_KEY, KEY_FORWARDMAIL, - EV_KEY, KEY_SAVE, - EV_KEY, KEY_DOCUMENTS, - EV_KEY, KEY_UNKNOWN, - EV_KEY, KEY_VIDEO_NEXT, - EV_KEY, KEY_BRIGHTNESS_AUTO, - EV_KEY, BTN_0, - EV_KEY, KEY_SELECT, - EV_KEY, KEY_GOTO, - EV_KEY, KEY_INFO, - EV_KEY, KEY_PROGRAM, - EV_KEY, KEY_PVR, - EV_KEY, KEY_SUBTITLE, - EV_KEY, KEY_ZOOM, - EV_KEY, KEY_KEYBOARD, - EV_KEY, KEY_PC, - EV_KEY, KEY_TV, - EV_KEY, KEY_TV2, - EV_KEY, KEY_VCR, - EV_KEY, KEY_VCR2, - EV_KEY, KEY_SAT, - EV_KEY, KEY_CD, - EV_KEY, KEY_TAPE, - EV_KEY, KEY_TUNER, - EV_KEY, KEY_PLAYER, - EV_KEY, KEY_DVD, - EV_KEY, KEY_AUDIO, - EV_KEY, KEY_VIDEO, - EV_KEY, KEY_MEMO, - EV_KEY, KEY_CALENDAR, - EV_KEY, KEY_RED, - EV_KEY, KEY_GREEN, - EV_KEY, KEY_YELLOW, - EV_KEY, KEY_BLUE, - EV_KEY, KEY_CHANNELUP, - EV_KEY, KEY_CHANNELDOWN, - EV_KEY, KEY_LAST, - EV_KEY, KEY_NEXT, - EV_KEY, KEY_RESTART, - EV_KEY, KEY_SLOW, - EV_KEY, KEY_SHUFFLE, - EV_KEY, KEY_PREVIOUS, - EV_KEY, KEY_VIDEOPHONE, - EV_KEY, KEY_GAMES, - EV_KEY, KEY_ZOOMIN, - EV_KEY, KEY_ZOOMOUT, - EV_KEY, KEY_ZOOMRESET, - EV_KEY, KEY_WORDPROCESSOR, - EV_KEY, KEY_EDITOR, - EV_KEY, KEY_SPREADSHEET, - EV_KEY, KEY_GRAPHICSEDITOR, - EV_KEY, KEY_PRESENTATION, - EV_KEY, KEY_DATABASE, - EV_KEY, KEY_NEWS, - EV_KEY, KEY_VOICEMAIL, - EV_KEY, KEY_ADDRESSBOOK, - EV_KEY, KEY_MESSENGER, - EV_KEY, KEY_DISPLAYTOGGLE, - EV_KEY, KEY_SPELLCHECK, - EV_KEY, KEY_LOGOFF, - EV_KEY, KEY_MEDIA_REPEAT, - EV_KEY, KEY_IMAGES, - EV_KEY, KEY_BUTTONCONFIG, - EV_KEY, KEY_TASKMANAGER, - EV_KEY, KEY_JOURNAL, - EV_KEY, KEY_CONTROLPANEL, - EV_KEY, KEY_APPSELECT, - EV_KEY, KEY_SCREENSAVER, - EV_KEY, KEY_VOICECOMMAND, - EV_KEY, KEY_BRIGHTNESS_MIN, - EV_KEY, KEY_BRIGHTNESS_MAX, - EV_LED, LED_NUML, - EV_LED, LED_CAPSL, - EV_LED, LED_SCROLLL, - EV_LED, LED_COMPOSE, - EV_LED, LED_KANA, - -1 , -1, -}; - -static struct input_absinfo absinfo[] = { - { ABS_VOLUME, 0, 668, 0, 0, 0 }, - { .value = -1 } -}; - -TEST_DEVICE("mouse-gladius", - .type = LITEST_MOUSE_GLADIUS, - .features = LITEST_RELATIVE | LITEST_WHEEL | LITEST_KEYS, - .interface = NULL, - - .name = "ASUS ROG GLADIUS", - .id = &input_id, - .absinfo = absinfo, - .events = events, -) diff -Nru libinput-1.10.3/test/litest-device-atmel-hover.c libinput-0.21.0/test/litest-device-atmel-hover.c --- libinput-1.10.3/test/litest-device-atmel-hover.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-atmel-hover.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,7 +21,9 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include @@ -30,6 +32,16 @@ #include "litest.h" #include "litest-int.h" +static void +atmel_hover_create(struct litest_device *d); + +static void +litest_atmel_hover_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_ATMEL_HOVER); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, @@ -66,24 +78,10 @@ { .type = -1, .code = -1 }, }; -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_PRESSURE: - case ABS_MT_PRESSURE: - *value = 30; - return 0; - } - return 1; -} - static struct litest_device_interface interface = { .touch_down_events = down, .touch_move_events = move, .touch_up_events = up, - - .get_axis_default = get_axis_default, }; static struct input_id input_id = { @@ -121,13 +119,32 @@ { .value = -1 } }; -TEST_DEVICE("atmel-hover", +struct litest_test_device litest_atmel_hover_device = { .type = LITEST_ATMEL_HOVER, .features = LITEST_TOUCHPAD | LITEST_BUTTON | LITEST_CLICKPAD | LITEST_HOVER, + .shortname = "atmel hover", + .setup = litest_atmel_hover_setup, .interface = &interface, + .create = atmel_hover_create, .name = "Atmel maXTouch Touchpad", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; + +static void +atmel_hover_create(struct litest_device *d) +{ + struct litest_semi_mt *semi_mt = zalloc(sizeof(*semi_mt)); + assert(semi_mt); + + d->private = semi_mt; + + d->uinput = litest_create_uinput_device_from_description( + litest_atmel_hover_device.name, + litest_atmel_hover_device.id, + absinfo, + events); + d->interface = &interface; +} diff -Nru libinput-1.10.3/test/litest-device-bcm5974.c libinput-0.21.0/test/litest-device-bcm5974.c --- libinput-1.10.3/test/litest-device-bcm5974.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-bcm5974.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,19 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void litest_bcm5974_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_BCM5974); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, @@ -34,9 +42,7 @@ { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_PRESSURE, .value = LITEST_AUTO_ASSIGN }, { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, { .type = -1, .code = -1 }, }; @@ -48,9 +54,7 @@ { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_PRESSURE, .value = LITEST_AUTO_ASSIGN }, { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, { .type = -1, .code = -1 }, }; @@ -63,12 +67,6 @@ case ABS_MT_PRESSURE: *value = 30; return 0; - case ABS_MT_TOUCH_MAJOR: - case ABS_MT_TOUCH_MINOR: - *value = 200; - return 0; - case ABS_MT_ORIENTATION: - return 0; } return 1; } @@ -94,6 +92,7 @@ { ABS_MT_WIDTH_MAJOR, 0, 2048, 81, 0, 0 }, { ABS_MT_WIDTH_MINOR, 0, 2048, 81, 0, 0 }, { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, + { ABS_MT_PRESSURE, 0, 255, 0, 0, 0 }, { .value = -1 }, }; @@ -115,14 +114,16 @@ -1, -1 }; -TEST_DEVICE("bcm5974", +struct litest_test_device litest_bcm5974_device = { .type = LITEST_BCM5974, .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON | LITEST_APPLE_CLICKPAD, + .shortname = "bcm5974", + .setup = litest_bcm5974_setup, .interface = &interface, .name = "bcm5974", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-calibrated-touchscreen.c libinput-0.21.0/test/litest-device-calibrated-touchscreen.c --- libinput-1.10.3/test/litest-device-calibrated-touchscreen.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-calibrated-touchscreen.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 1500, 0, 0, 0 }, - { ABS_Y, 0, 2500, 0, 0, 0 }, - { ABS_MT_SLOT, 0, 9, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 1500, 0, 0, 0 }, - { ABS_MT_POSITION_Y, 0, 2500, 0, 0, 0 }, - { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x11, - .vendor = 0x22, - .product = 0x33, -}; - -static int events[] = { - EV_KEY, BTN_TOUCH, - INPUT_PROP_MAX, INPUT_PROP_DIRECT, - -1, -1 -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"calibrated_touchscreen_end\"\n" -"KERNEL!=\"event*\", GOTO=\"calibrated_touchscreen_end\"\n" -"\n" -"ATTRS{name}==\"litest Calibrated Touchscreen*\",\\\n" -" ENV{LIBINPUT_CALIBRATION_MATRIX}=\"1.2 3.4 5.6 7.8 9.10 11.12\",\\\n" -" ENV{WL_OUTPUT}=\"myOutput\"\n" -"\n" -"LABEL=\"calibrated_touchscreen_end\""; - -TEST_DEVICE("calibrated-touchscreen", - .type = LITEST_CALIBRATED_TOUCHSCREEN, - .features = LITEST_TOUCH, - .interface = &interface, - - .name = "Calibrated Touchscreen", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-cyborg-rat-5.c libinput-0.21.0/test/litest-device-cyborg-rat-5.c --- libinput-1.10.3/test/litest-device-cyborg-rat-5.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-cyborg-rat-5.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/* - * Copyright © 2013 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x6a3, - .product = 0xcd5, -}; - -static int events[] = { - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_KEY, BTN_MIDDLE, - EV_KEY, BTN_SIDE, - EV_KEY, BTN_EXTRA, - EV_KEY, BTN_FORWARD, - EV_KEY, BTN_TASK, - EV_KEY, 0x118, - EV_KEY, 0x119, - EV_KEY, 0x11a, - EV_REL, REL_X, - EV_REL, REL_Y, - EV_REL, REL_WHEEL, - -1 , -1, -}; - -TEST_DEVICE("cyborg-rat", - .type = LITEST_CYBORG_RAT, - .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL, - .interface = NULL, - - .name = "Saitek Cyborg R.A.T.5 Mouse", - .id = &input_id, - .absinfo = NULL, - .events = events, -) diff -Nru libinput-1.10.3/test/litest-device-elantech-touchpad.c libinput-0.21.0/test/litest-device-elantech-touchpad.c --- libinput-1.10.3/test/litest-device-elantech-touchpad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-elantech-touchpad.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,20 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void +litest_elantech_touchpad_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_ELANTECH_TOUCHPAD); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, @@ -98,13 +107,15 @@ { .value = -1 } }; -TEST_DEVICE("elantech", +struct litest_test_device litest_elantech_touchpad_device = { .type = LITEST_ELANTECH_TOUCHPAD, .features = LITEST_TOUCHPAD | LITEST_BUTTON, + .shortname = "elantech", + .setup = litest_elantech_touchpad_setup, .interface = &interface, .name = "ETPS/2 Elantech Touchpad", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-generic-singletouch.c libinput-0.21.0/test/litest-device-generic-singletouch.c --- libinput-1.10.3/test/litest-device-generic-singletouch.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-generic-singletouch.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,20 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void +litest_generic_singletouch_touch_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_GENERIC_SINGLETOUCH); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, @@ -35,6 +44,7 @@ }; static struct input_event move[] = { + { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 }, @@ -65,13 +75,15 @@ -1, -1, }; -TEST_DEVICE("generic-singletouch", +struct litest_test_device litest_generic_singletouch_device = { .type = LITEST_GENERIC_SINGLETOUCH, .features = LITEST_SINGLE_TOUCH, + .shortname = "generic-singletouch", + .setup = litest_generic_singletouch_touch_setup, .interface = &interface, .name = "generic_singletouch", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-gpio-keys.c libinput-0.21.0/test/litest-device-gpio-keys.c --- libinput-1.10.3/test/litest-device-gpio-keys.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-gpio-keys.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x19, - .vendor = 0x1, - .product = 0x1, -}; - -static int events[] = { - EV_SW, SW_LID, - EV_SW, SW_TABLET_MODE, - EV_KEY, KEY_POWER, - EV_KEY, KEY_VOLUMEUP, - EV_KEY, KEY_VOLUMEDOWN, - EV_KEY, KEY_POWER, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"switch_end\"\n" -"KERNEL!=\"event*\", GOTO=\"switch_end\"\n" -"\n" -"ATTRS{name}==\"litest gpio-keys*\",\\\n" -" ENV{ID_INPUT_SWITCH}=\"1\",\\\n" -" ENV{LIBINPUT_ATTR_gpio_keys_RELIABILITY}=\"reliable\"\n" -"\n" -"LABEL=\"switch_end\""; - -TEST_DEVICE("gpio-keys", - .type = LITEST_GPIO_KEYS, - .features = LITEST_SWITCH, - .interface = NULL, - - .name = "gpio-keys", - .id = &input_id, - .events = events, - .absinfo = NULL, - - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-hp-wmi-hotkeys.c libinput-0.21.0/test/litest-device-hp-wmi-hotkeys.c --- libinput-1.10.3/test/litest-device-hp-wmi-hotkeys.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-hp-wmi-hotkeys.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x19, - .vendor = 0x000, - .product = 0x000, -}; - -static int events[] = { - EV_KEY, KEY_HELP, - EV_KEY, KEY_SETUP, - EV_KEY, KEY_PROG1, - EV_KEY, KEY_ROTATE_DISPLAY, - EV_KEY, KEY_BRIGHTNESSDOWN, - EV_KEY, KEY_BRIGHTNESSUP, - EV_KEY, KEY_MEDIA, - EV_KEY, KEY_UNKNOWN, - EV_KEY, KEY_INFO, - EV_SW, SW_TABLET_MODE, - EV_SW, SW_DOCK, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"switch_end\"\n" -"KERNEL!=\"event*\", GOTO=\"switch_end\"\n" -"\n" -"ATTRS{name}==\"litest HP WMI Hotkeys*\",\\\n" -" ENV{ID_INPUT_SWITCH}=\"1\"\n" -"\n" -"LABEL=\"switch_end\""; - -TEST_DEVICE("wmi-hotkeys", - .type = LITEST_HP_WMI_HOTKEYS, - .features = LITEST_SWITCH, - .interface = NULL, - - .name = "HP WMI hotkeys", - .id = &input_id, - .events = events, - .absinfo = NULL, - - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-huion-pentablet.c libinput-0.21.0/test/litest-device-huion-pentablet.c --- libinput-1.10.3/test/litest-device-huion-pentablet.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-huion-pentablet.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -/* - * Copyright © 2015 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event proximity_in[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event proximity_out[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event motion[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_PRESSURE: - *value = 100; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .tablet_proximity_in_events = proximity_in, - .tablet_proximity_out_events = proximity_out, - .tablet_motion_events = motion, - - .get_axis_default = get_axis_default, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 40000, 0, 0, 157 }, - { ABS_Y, 0, 25000, 0, 0, 157 }, - { ABS_PRESSURE, 0, 2047, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x256c, - .product = 0x6e, -}; - -static int events[] = { - EV_KEY, BTN_TOOL_PEN, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_STYLUS, - EV_KEY, BTN_STYLUS2, - EV_MSC, MSC_SCAN, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"huion_end\"\n" -"KERNEL!=\"event*\", GOTO=\"huion_end\"\n" -"ENV{ID_INPUT_TABLET}==\"\", GOTO=\"huion_end\"\n" -"\n" -"ATTRS{name}==\"litest HUION PenTablet Pen\"," -" ENV{LIBINPUT_MODEL_TABLET_NO_PROXIMITY_OUT}=\"1\"\n" -"\n" -"LABEL=\"huion_end\""; - -TEST_DEVICE("huion-tablet", - .type = LITEST_HUION_TABLET, - .features = LITEST_TABLET, - .interface = &interface, - - .name = "HUION PenTablet Pen", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-ignored-mouse.c libinput-0.21.0/test/litest-device-ignored-mouse.c --- libinput-1.10.3/test/litest-device-ignored-mouse.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-ignored-mouse.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x17ef, - .product = 0x6019, -}; - -static int events[] = { - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_KEY, BTN_MIDDLE, - EV_REL, REL_X, - EV_REL, REL_Y, - EV_REL, REL_WHEEL, - -1 , -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"mouse_end\"\n" -"KERNEL!=\"event*\", GOTO=\"mouse_end\"\n" -"ENV{ID_INPUT_MOUSE}==\"\", GOTO=\"mouse_end\"\n" -"\n" -"ATTRS{name}==\"litest Ignored Mouse*\",\\\n" -" ENV{LIBINPUT_IGNORE_DEVICE}=\"1\"\n" -"\n" -"LABEL=\"mouse_end\""; - -TEST_DEVICE("ignored-mouse", - .type = LITEST_IGNORED_MOUSE, - .features = LITEST_IGNORED | LITEST_BUTTON | LITEST_RELATIVE, - .interface = NULL, - - .name = "Ignored Mouse", - .id = &input_id, - .absinfo = NULL, - .events = events, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-keyboard-all-codes.c libinput-0.21.0/test/litest-device-keyboard-all-codes.c --- libinput-1.10.3/test/litest-device-keyboard-all-codes.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-keyboard-all-codes.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright © 2013 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -#define NAME "All event codes keyboard" - -static void all_codes_create(struct litest_device *d); - -static struct input_id input_id = { - .bustype = 0x11, - .vendor = 0x1, - .product = 0x1, -}; - -TEST_DEVICE("keyboard-all-codes", - .type = LITEST_KEYBOARD_ALL_CODES, - .features = LITEST_KEYS, - .interface = NULL, - .create = all_codes_create, - - .name = NAME, - .id = &input_id, - .events = NULL, - .absinfo = NULL, -) - -static void -all_codes_create(struct litest_device *d) -{ - int events[KEY_MAX * 2 + 2]; - int code, idx; - - for (idx = 0, code = 0; code < KEY_MAX; code++) { - const char *name = libevdev_event_code_get_name(EV_KEY, code); - - if (name && strneq(name, "BTN_", 4)) - continue; - - events[idx++] = EV_KEY; - events[idx++] = code; - } - events[idx++] = -1; - events[idx++] = -1; - - d->uinput = litest_create_uinput_device_from_description(NAME, - &input_id, - NULL, - events); -} diff -Nru libinput-1.10.3/test/litest-device-keyboard.c libinput-0.21.0/test/litest-device-keyboard.c --- libinput-1.10.3/test/litest-device-keyboard.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-keyboard.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,19 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void litest_keyboard_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_KEYBOARD); + litest_set_current_device(d); +} + static struct input_id input_id = { .bustype = 0x11, .vendor = 0x1, @@ -185,19 +193,18 @@ EV_KEY, KEY_SEARCH, EV_KEY, KEY_MEDIA, EV_KEY, KEY_FN, - EV_LED, LED_NUML, - EV_LED, LED_CAPSL, - EV_LED, LED_SCROLLL, -1, -1, }; -TEST_DEVICE("default-keyboard", +struct litest_test_device litest_keyboard_device = { .type = LITEST_KEYBOARD, .features = LITEST_KEYS, + .shortname = "default keyboard", + .setup = litest_keyboard_setup, .interface = NULL, .name = "AT Translated Set 2 keyboard", .id = &input_id, .events = events, .absinfo = NULL, -) +}; diff -Nru libinput-1.10.3/test/litest-device-keyboard-razer-blackwidow.c libinput-0.21.0/test/litest-device-keyboard-razer-blackwidow.c --- libinput-1.10.3/test/litest-device-keyboard-razer-blackwidow.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-keyboard-razer-blackwidow.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,7 +21,9 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" @@ -32,6 +34,12 @@ * file. */ +static void litest_blackwidow_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_KEYBOARD_BLACKWIDOW); + litest_set_current_device(d); +} + static struct input_id input_id = { .bustype = 0x3, .vendor = 0x1532, @@ -329,13 +337,15 @@ { .value = -1 }, }; -TEST_DEVICE("blackwidow", +struct litest_test_device litest_keyboard_blackwidow_device = { .type = LITEST_KEYBOARD_BLACKWIDOW, .features = LITEST_KEYS | LITEST_WHEEL, + .shortname = "blackwidow", + .setup = litest_blackwidow_setup, .interface = NULL, .name = "Razer Razer BlackWidow 2013", .id = &input_id, .absinfo = absinfo, .events = events, -) +}; diff -Nru libinput-1.10.3/test/litest-device-keyboard-razer-blade-stealth.c libinput-0.21.0/test/litest-device-keyboard-razer-blade-stealth.c --- libinput-1.10.3/test/litest-device-keyboard-razer-blade-stealth.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-keyboard-razer-blade-stealth.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,339 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -/* Recording from https://bugs.freedesktop.org/show_bug.cgi?id=102039 - * This is the 'normal keyboard' of 2 devices exported by this keyboard. - */ - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x1532, - .product = 0x220, -}; - -static int events[] = { - EV_REL, REL_HWHEEL, - EV_KEY, BTN_0, - EV_KEY, KEY_ESC, - EV_KEY, KEY_1, - EV_KEY, KEY_2, - EV_KEY, KEY_3, - EV_KEY, KEY_4, - EV_KEY, KEY_5, - EV_KEY, KEY_6, - EV_KEY, KEY_7, - EV_KEY, KEY_8, - EV_KEY, KEY_9, - EV_KEY, KEY_0, - EV_KEY, KEY_MINUS, - EV_KEY, KEY_EQUAL, - EV_KEY, KEY_BACKSPACE, - EV_KEY, KEY_TAB, - EV_KEY, KEY_Q, - EV_KEY, KEY_W, - EV_KEY, KEY_E, - EV_KEY, KEY_R, - EV_KEY, KEY_T, - EV_KEY, KEY_Y, - EV_KEY, KEY_U, - EV_KEY, KEY_I, - EV_KEY, KEY_O, - EV_KEY, KEY_P, - EV_KEY, KEY_LEFTBRACE, - EV_KEY, KEY_RIGHTBRACE, - EV_KEY, KEY_ENTER, - EV_KEY, KEY_LEFTCTRL, - EV_KEY, KEY_A, - EV_KEY, KEY_S, - EV_KEY, KEY_D, - EV_KEY, KEY_F, - EV_KEY, KEY_G, - EV_KEY, KEY_H, - EV_KEY, KEY_J, - EV_KEY, KEY_K, - EV_KEY, KEY_L, - EV_KEY, KEY_SEMICOLON, - EV_KEY, KEY_APOSTROPHE, - EV_KEY, KEY_GRAVE, - EV_KEY, KEY_LEFTSHIFT, - EV_KEY, KEY_BACKSLASH, - EV_KEY, KEY_Z, - EV_KEY, KEY_X, - EV_KEY, KEY_C, - EV_KEY, KEY_V, - EV_KEY, KEY_B, - EV_KEY, KEY_N, - EV_KEY, KEY_M, - EV_KEY, KEY_COMMA, - EV_KEY, KEY_DOT, - EV_KEY, KEY_SLASH, - EV_KEY, KEY_RIGHTSHIFT, - EV_KEY, KEY_KPASTERISK, - EV_KEY, KEY_LEFTALT, - EV_KEY, KEY_SPACE, - EV_KEY, KEY_CAPSLOCK, - EV_KEY, KEY_F1, - EV_KEY, KEY_F2, - EV_KEY, KEY_F3, - EV_KEY, KEY_F4, - EV_KEY, KEY_F5, - EV_KEY, KEY_F6, - EV_KEY, KEY_F7, - EV_KEY, KEY_F8, - EV_KEY, KEY_F9, - EV_KEY, KEY_F10, - EV_KEY, KEY_NUMLOCK, - EV_KEY, KEY_SCROLLLOCK, - EV_KEY, KEY_KP7, - EV_KEY, KEY_KP8, - EV_KEY, KEY_KP9, - EV_KEY, KEY_KPMINUS, - EV_KEY, KEY_KP4, - EV_KEY, KEY_KP5, - EV_KEY, KEY_KP6, - EV_KEY, KEY_KPPLUS, - EV_KEY, KEY_KP1, - EV_KEY, KEY_KP2, - EV_KEY, KEY_KP3, - EV_KEY, KEY_KP0, - EV_KEY, KEY_KPDOT, - EV_KEY, KEY_ZENKAKUHANKAKU, - EV_KEY, KEY_102ND, - EV_KEY, KEY_F11, - EV_KEY, KEY_F12, - EV_KEY, KEY_RO, - EV_KEY, KEY_KATAKANA, - EV_KEY, KEY_HIRAGANA, - EV_KEY, KEY_HENKAN, - EV_KEY, KEY_KATAKANAHIRAGANA, - EV_KEY, KEY_MUHENKAN, - EV_KEY, KEY_KPJPCOMMA, - EV_KEY, KEY_KPENTER, - EV_KEY, KEY_RIGHTCTRL, - EV_KEY, KEY_KPSLASH, - EV_KEY, KEY_SYSRQ, - EV_KEY, KEY_RIGHTALT, - EV_KEY, KEY_HOME, - EV_KEY, KEY_UP, - EV_KEY, KEY_PAGEUP, - EV_KEY, KEY_LEFT, - EV_KEY, KEY_RIGHT, - EV_KEY, KEY_END, - EV_KEY, KEY_DOWN, - EV_KEY, KEY_PAGEDOWN, - EV_KEY, KEY_INSERT, - EV_KEY, KEY_DELETE, - EV_KEY, KEY_MUTE, - EV_KEY, KEY_VOLUMEDOWN, - EV_KEY, KEY_VOLUMEUP, - EV_KEY, KEY_POWER, - EV_KEY, KEY_KPEQUAL, - EV_KEY, KEY_PAUSE, - EV_KEY, KEY_KPCOMMA, - EV_KEY, KEY_HANGEUL, - EV_KEY, KEY_HANJA, - EV_KEY, KEY_YEN, - EV_KEY, KEY_LEFTMETA, - EV_KEY, KEY_RIGHTMETA, - EV_KEY, KEY_COMPOSE, - EV_KEY, KEY_STOP, - EV_KEY, KEY_AGAIN, - EV_KEY, KEY_PROPS, - EV_KEY, KEY_UNDO, - EV_KEY, KEY_FRONT, - EV_KEY, KEY_COPY, - EV_KEY, KEY_OPEN, - EV_KEY, KEY_PASTE, - EV_KEY, KEY_FIND, - EV_KEY, KEY_CUT, - EV_KEY, KEY_HELP, - EV_KEY, KEY_MENU, - EV_KEY, KEY_CALC, - EV_KEY, KEY_SLEEP, - EV_KEY, KEY_WAKEUP, - EV_KEY, KEY_FILE, - EV_KEY, KEY_WWW, - EV_KEY, KEY_COFFEE, - EV_KEY, KEY_MAIL, - EV_KEY, KEY_BOOKMARKS, - EV_KEY, KEY_BACK, - EV_KEY, KEY_FORWARD, - EV_KEY, KEY_EJECTCD, - EV_KEY, KEY_NEXTSONG, - EV_KEY, KEY_PLAYPAUSE, - EV_KEY, KEY_PREVIOUSSONG, - EV_KEY, KEY_STOPCD, - EV_KEY, KEY_RECORD, - EV_KEY, KEY_REWIND, - EV_KEY, KEY_PHONE, - EV_KEY, KEY_CONFIG, - EV_KEY, KEY_HOMEPAGE, - EV_KEY, KEY_REFRESH, - EV_KEY, KEY_EXIT, - EV_KEY, KEY_EDIT, - EV_KEY, KEY_SCROLLUP, - EV_KEY, KEY_SCROLLDOWN, - EV_KEY, KEY_KPLEFTPAREN, - EV_KEY, KEY_KPRIGHTPAREN, - EV_KEY, KEY_NEW, - EV_KEY, KEY_F13, - EV_KEY, KEY_F14, - EV_KEY, KEY_F15, - EV_KEY, KEY_F16, - EV_KEY, KEY_F17, - EV_KEY, KEY_F18, - EV_KEY, KEY_F19, - EV_KEY, KEY_F20, - EV_KEY, KEY_F21, - EV_KEY, KEY_F22, - EV_KEY, KEY_F23, - EV_KEY, KEY_F24, - EV_KEY, KEY_CLOSE, - EV_KEY, KEY_PLAY, - EV_KEY, KEY_FASTFORWARD, - EV_KEY, KEY_BASSBOOST, - EV_KEY, KEY_PRINT, - EV_KEY, KEY_CAMERA, - EV_KEY, KEY_CHAT, - EV_KEY, KEY_SEARCH, - EV_KEY, KEY_FINANCE, - EV_KEY, KEY_BRIGHTNESSDOWN, - EV_KEY, KEY_BRIGHTNESSUP, - EV_KEY, KEY_KBDILLUMTOGGLE, - EV_KEY, KEY_SAVE, - EV_KEY, KEY_DOCUMENTS, - EV_KEY, KEY_UNKNOWN, - EV_KEY, KEY_VIDEO_NEXT, - EV_KEY, KEY_BRIGHTNESS_AUTO, - EV_KEY, KEY_SELECT, - EV_KEY, KEY_GOTO, - EV_KEY, KEY_INFO, - EV_KEY, KEY_PROGRAM, - EV_KEY, KEY_PVR, - EV_KEY, KEY_SUBTITLE, - EV_KEY, KEY_ZOOM, - EV_KEY, KEY_KEYBOARD, - EV_KEY, KEY_PC, - EV_KEY, KEY_TV, - EV_KEY, KEY_TV2, - EV_KEY, KEY_VCR, - EV_KEY, KEY_VCR2, - EV_KEY, KEY_SAT, - EV_KEY, KEY_CD, - EV_KEY, KEY_TAPE, - EV_KEY, KEY_TUNER, - EV_KEY, KEY_PLAYER, - EV_KEY, KEY_DVD, - EV_KEY, KEY_AUDIO, - EV_KEY, KEY_VIDEO, - EV_KEY, KEY_MEMO, - EV_KEY, KEY_CALENDAR, - EV_KEY, KEY_RED, - EV_KEY, KEY_GREEN, - EV_KEY, KEY_YELLOW, - EV_KEY, KEY_BLUE, - EV_KEY, KEY_CHANNELUP, - EV_KEY, KEY_CHANNELDOWN, - EV_KEY, KEY_LAST, - EV_KEY, KEY_NEXT, - EV_KEY, KEY_RESTART, - EV_KEY, KEY_SLOW, - EV_KEY, KEY_SHUFFLE, - EV_KEY, KEY_PREVIOUS, - EV_KEY, KEY_VIDEOPHONE, - EV_KEY, KEY_GAMES, - EV_KEY, KEY_ZOOMIN, - EV_KEY, KEY_ZOOMOUT, - EV_KEY, KEY_ZOOMRESET, - EV_KEY, KEY_WORDPROCESSOR, - EV_KEY, KEY_EDITOR, - EV_KEY, KEY_SPREADSHEET, - EV_KEY, KEY_GRAPHICSEDITOR, - EV_KEY, KEY_PRESENTATION, - EV_KEY, KEY_DATABASE, - EV_KEY, KEY_NEWS, - EV_KEY, KEY_VOICEMAIL, - EV_KEY, KEY_ADDRESSBOOK, - EV_KEY, KEY_MESSENGER, - EV_KEY, KEY_DISPLAYTOGGLE, - EV_KEY, KEY_SPELLCHECK, - EV_KEY, KEY_LOGOFF, - EV_KEY, KEY_MEDIA_REPEAT, - EV_KEY, KEY_IMAGES, - EV_KEY, KEY_BUTTONCONFIG, - EV_KEY, KEY_TASKMANAGER, - EV_KEY, KEY_JOURNAL, - EV_KEY, KEY_CONTROLPANEL, - EV_KEY, KEY_APPSELECT, - EV_KEY, KEY_SCREENSAVER, - EV_KEY, KEY_VOICECOMMAND, - EV_KEY, KEY_BRIGHTNESS_MIN, - EV_KEY, KEY_BRIGHTNESS_MAX, - EV_MSC, MSC_SCAN, - -1 , -1, -}; - -static struct input_absinfo absinfo[] = { - { ABS_VOLUME, 0, 572, 0, 0, 0 }, - { ABS_MISC, 0, 255, 0, 0, 0 }, - { 0x29, 0, 255, 0, 0, 0 }, - { 0x2a, 0, 255, 0, 0, 0 }, - { 0x2b, 0, 255, 0, 0, 0 }, - { 0x2c, 0, 255, 0, 0, 0 }, - { 0x2d, 0, 255, 0, 0, 0 }, - { 0x2e, 0, 255, 0, 0, 0 }, - { 0x2f, 0, 255, 0, 0, 0 }, - { 0x30, 0, 255, 0, 0, 0 }, - { 0x31, 0, 255, 0, 0, 0 }, - { 0x32, 0, 255, 0, 0, 0 }, - { 0x33, 0, 255, 0, 0, 0 }, - { 0x34, 0, 255, 0, 0, 0 }, - { 0x35, 0, 255, 0, 0, 0 }, - { 0x36, 0, 255, 0, 0, 0 }, - { 0x37, 0, 255, 0, 0, 0 }, - { 0x38, 0, 255, 0, 0, 0 }, - { 0x39, 0, 255, 0, 0, 0 }, - { 0x3a, 0, 255, 0, 0, 0 }, - { 0x3b, 0, 255, 0, 0, 0 }, - { 0x3c, 0, 255, 0, 0, 0 }, - { 0x3d, 0, 255, 0, 0, 0 }, - { 0x3e, 0, 255, 0, 0, 0 }, - { 0x3f, 0, 255, 0, 0, 0 }, - { .value = -1 }, -}; - -TEST_DEVICE("blade-stealth", - .type = LITEST_KEYBOARD_BLADE_STEALTH, - .features = LITEST_KEYS | LITEST_WHEEL, - .interface = NULL, - - .name = "Razer Razer Blade Stealth", - .id = &input_id, - .absinfo = absinfo, - .events = events, -) diff -Nru libinput-1.10.3/test/litest-device-keyboard-razer-blade-stealth-videoswitch.c libinput-0.21.0/test/litest-device-keyboard-razer-blade-stealth-videoswitch.c --- libinput-1.10.3/test/litest-device-keyboard-razer-blade-stealth-videoswitch.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-keyboard-razer-blade-stealth-videoswitch.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,218 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -/* Recording from https://bugs.freedesktop.org/show_bug.cgi?id=102039 - * This is the 'video switch' of 2 devices exported by this keyboard. - */ - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x1532, - .product = 0x220, -}; - -static int events[] = { - EV_KEY, KEY_ESC, - EV_KEY, KEY_1, - EV_KEY, KEY_2, - EV_KEY, KEY_3, - EV_KEY, KEY_4, - EV_KEY, KEY_5, - EV_KEY, KEY_6, - EV_KEY, KEY_7, - EV_KEY, KEY_8, - EV_KEY, KEY_9, - EV_KEY, KEY_0, - EV_KEY, KEY_MINUS, - EV_KEY, KEY_EQUAL, - EV_KEY, KEY_BACKSPACE, - EV_KEY, KEY_TAB, - EV_KEY, KEY_Q, - EV_KEY, KEY_W, - EV_KEY, KEY_E, - EV_KEY, KEY_R, - EV_KEY, KEY_T, - EV_KEY, KEY_Y, - EV_KEY, KEY_U, - EV_KEY, KEY_I, - EV_KEY, KEY_O, - EV_KEY, KEY_P, - EV_KEY, KEY_LEFTBRACE, - EV_KEY, KEY_RIGHTBRACE, - EV_KEY, KEY_ENTER, - EV_KEY, KEY_LEFTCTRL, - EV_KEY, KEY_A, - EV_KEY, KEY_S, - EV_KEY, KEY_D, - EV_KEY, KEY_F, - EV_KEY, KEY_G, - EV_KEY, KEY_H, - EV_KEY, KEY_J, - EV_KEY, KEY_K, - EV_KEY, KEY_L, - EV_KEY, KEY_SEMICOLON, - EV_KEY, KEY_APOSTROPHE, - EV_KEY, KEY_GRAVE, - EV_KEY, KEY_LEFTSHIFT, - EV_KEY, KEY_BACKSLASH, - EV_KEY, KEY_Z, - EV_KEY, KEY_X, - EV_KEY, KEY_C, - EV_KEY, KEY_V, - EV_KEY, KEY_B, - EV_KEY, KEY_N, - EV_KEY, KEY_M, - EV_KEY, KEY_COMMA, - EV_KEY, KEY_DOT, - EV_KEY, KEY_SLASH, - EV_KEY, KEY_RIGHTSHIFT, - EV_KEY, KEY_KPASTERISK, - EV_KEY, KEY_LEFTALT, - EV_KEY, KEY_SPACE, - EV_KEY, KEY_CAPSLOCK, - EV_KEY, KEY_F1, - EV_KEY, KEY_F2, - EV_KEY, KEY_F3, - EV_KEY, KEY_F4, - EV_KEY, KEY_F5, - EV_KEY, KEY_F6, - EV_KEY, KEY_F7, - EV_KEY, KEY_F8, - EV_KEY, KEY_F9, - EV_KEY, KEY_F10, - EV_KEY, KEY_NUMLOCK, - EV_KEY, KEY_SCROLLLOCK, - EV_KEY, KEY_KP7, - EV_KEY, KEY_KP8, - EV_KEY, KEY_KP9, - EV_KEY, KEY_KPMINUS, - EV_KEY, KEY_KP4, - EV_KEY, KEY_KP5, - EV_KEY, KEY_KP6, - EV_KEY, KEY_KPPLUS, - EV_KEY, KEY_KP1, - EV_KEY, KEY_KP2, - EV_KEY, KEY_KP3, - EV_KEY, KEY_KP0, - EV_KEY, KEY_KPDOT, - EV_KEY, KEY_ZENKAKUHANKAKU, - EV_KEY, KEY_102ND, - EV_KEY, KEY_F11, - EV_KEY, KEY_F12, - EV_KEY, KEY_RO, - EV_KEY, KEY_KATAKANA, - EV_KEY, KEY_HIRAGANA, - EV_KEY, KEY_HENKAN, - EV_KEY, KEY_KATAKANAHIRAGANA, - EV_KEY, KEY_MUHENKAN, - EV_KEY, KEY_KPJPCOMMA, - EV_KEY, KEY_KPENTER, - EV_KEY, KEY_RIGHTCTRL, - EV_KEY, KEY_KPSLASH, - EV_KEY, KEY_SYSRQ, - EV_KEY, KEY_RIGHTALT, - EV_KEY, KEY_HOME, - EV_KEY, KEY_UP, - EV_KEY, KEY_PAGEUP, - EV_KEY, KEY_LEFT, - EV_KEY, KEY_RIGHT, - EV_KEY, KEY_END, - EV_KEY, KEY_DOWN, - EV_KEY, KEY_PAGEDOWN, - EV_KEY, KEY_INSERT, - EV_KEY, KEY_DELETE, - EV_KEY, KEY_MUTE, - EV_KEY, KEY_VOLUMEDOWN, - EV_KEY, KEY_VOLUMEUP, - EV_KEY, KEY_POWER, - EV_KEY, KEY_KPEQUAL, - EV_KEY, KEY_PAUSE, - EV_KEY, KEY_KPCOMMA, - EV_KEY, KEY_HANGEUL, - EV_KEY, KEY_HANJA, - EV_KEY, KEY_YEN, - EV_KEY, KEY_LEFTMETA, - EV_KEY, KEY_RIGHTMETA, - EV_KEY, KEY_COMPOSE, - EV_KEY, KEY_STOP, - EV_KEY, KEY_AGAIN, - EV_KEY, KEY_PROPS, - EV_KEY, KEY_UNDO, - EV_KEY, KEY_FRONT, - EV_KEY, KEY_COPY, - EV_KEY, KEY_OPEN, - EV_KEY, KEY_PASTE, - EV_KEY, KEY_FIND, - EV_KEY, KEY_CUT, - EV_KEY, KEY_HELP, - EV_KEY, KEY_CALC, - EV_KEY, KEY_SLEEP, - EV_KEY, KEY_WWW, - EV_KEY, KEY_COFFEE, - EV_KEY, KEY_BACK, - EV_KEY, KEY_FORWARD, - EV_KEY, KEY_EJECTCD, - EV_KEY, KEY_NEXTSONG, - EV_KEY, KEY_PLAYPAUSE, - EV_KEY, KEY_PREVIOUSSONG, - EV_KEY, KEY_STOPCD, - EV_KEY, KEY_REFRESH, - EV_KEY, KEY_EDIT, - EV_KEY, KEY_SCROLLUP, - EV_KEY, KEY_SCROLLDOWN, - EV_KEY, KEY_KPLEFTPAREN, - EV_KEY, KEY_KPRIGHTPAREN, - EV_KEY, KEY_F13, - EV_KEY, KEY_F14, - EV_KEY, KEY_F15, - EV_KEY, KEY_F16, - EV_KEY, KEY_F17, - EV_KEY, KEY_F18, - EV_KEY, KEY_F19, - EV_KEY, KEY_F20, - EV_KEY, KEY_F21, - EV_KEY, KEY_F22, - EV_KEY, KEY_F23, - EV_KEY, KEY_F24, - EV_KEY, KEY_UNKNOWN, - EV_LED, LED_NUML, - EV_LED, LED_CAPSL, - EV_LED, LED_SCROLLL, - EV_MSC, MSC_SCAN, - -1 , -1, -}; - -TEST_DEVICE("blade-stealth-video-switch", - .type = LITEST_KEYBOARD_BLADE_STEALTH_VIDEOSWITCH, - .features = LITEST_KEYS, - .interface = NULL, - - .name = "Razer Razer Blade Stealth", - .id = &input_id, - .events = events, -) diff -Nru libinput-1.10.3/test/litest-device-lid-switch.c libinput-0.21.0/test/litest-device-lid-switch.c --- libinput-1.10.3/test/litest-device-lid-switch.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-lid-switch.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/* - * Copyright © 2017 James Ye - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x19, - .vendor = 0x0, - .product = 0x5, -}; - -static int events[] = { - EV_SW, SW_LID, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"switch_end\"\n" -"KERNEL!=\"event*\", GOTO=\"switch_end\"\n" -"\n" -"ATTRS{name}==\"litest Lid Switch*\",\\\n" -" ENV{ID_INPUT_SWITCH}=\"1\",\\\n" -" ENV{LIBINPUT_ATTR_LID_SWITCH_RELIABILITY}=\"reliable\"\n" -"\n" -"LABEL=\"switch_end\""; - -TEST_DEVICE("lid-switch", - .type = LITEST_LID_SWITCH, - .features = LITEST_SWITCH, - .interface = NULL, - - .name = "Lid Switch", - .id = &input_id, - .events = events, - .absinfo = NULL, - - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-lid-switch-surface3.c libinput-0.21.0/test/litest-device-lid-switch-surface3.c --- libinput-1.10.3/test/litest-device-lid-switch-surface3.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-lid-switch-surface3.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright © 2017 James Ye - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x19, - .vendor = 0x0, - .product = 0x5, -}; - -static int events[] = { - EV_SW, SW_LID, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"switch_end\"\n" -"KERNEL!=\"event*\", GOTO=\"switch_end\"\n" -"\n" -"ATTRS{name}==\"litest Lid Switch Surface3*\",\\\n" -" ENV{ID_INPUT_SWITCH}=\"1\",\\\n" -" ENV{LIBINPUT_ATTR_LID_SWITCH_RELIABILITY}=\"write_open\"\n" -"\n" -"LABEL=\"switch_end\""; - -TEST_DEVICE("lid-switch-surface3", - .type = LITEST_LID_SWITCH_SURFACE3, - .features = LITEST_SWITCH, - .interface = NULL, - - .name = "Lid Switch Surface3", - .id = &input_id, - .events = events, - .absinfo = NULL, - - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-logitech-trackball.c libinput-0.21.0/test/litest-device-logitech-trackball.c --- libinput-1.10.3/test/litest-device-logitech-trackball.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-logitech-trackball.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,19 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void litest_logitech_trackball_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_LOGITECH_TRACKBALL); + litest_set_current_device(d); +} + static struct input_id input_id = { .bustype = 0x3, .vendor = 0x46d, @@ -43,13 +51,15 @@ -1 , -1, }; -TEST_DEVICE("logitech-trackball", +struct litest_test_device litest_logitech_trackball_device = { .type = LITEST_LOGITECH_TRACKBALL, - .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_TRACKBALL, + .features = LITEST_RELATIVE | LITEST_BUTTON, + .shortname = "logitech trackball", + .setup = litest_logitech_trackball_setup, .interface = NULL, .name = "Logitech USB Trackball", .id = &input_id, .absinfo = NULL, .events = events, -) +}; diff -Nru libinput-1.10.3/test/litest-device-magic-trackpad.c libinput-0.21.0/test/litest-device-magic-trackpad.c --- libinput-1.10.3/test/litest-device-magic-trackpad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-magic-trackpad.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,21 +21,28 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void litest_magicpad_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_MAGIC_TRACKPAD); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = 272 }, + { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = 400 }, { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = LITEST_AUTO_ASSIGN }, { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, { .type = -1, .code = -1 }, }; @@ -44,34 +51,17 @@ { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = 272 }, + { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = 400 }, { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = LITEST_AUTO_ASSIGN }, { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, { .type = -1, .code = -1 }, }; -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_MT_TOUCH_MAJOR: - case ABS_MT_TOUCH_MINOR: - *value = 200; - return 0; - case ABS_MT_ORIENTATION: - return 0; - } - return 1; -} - static struct litest_device_interface interface = { .touch_down_events = down, .touch_move_events = move, - - .get_axis_default = get_axis_default, }; static struct input_absinfo absinfo[] = { @@ -105,25 +95,16 @@ -1, -1 }; -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"touchpad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"touchpad_end\"\n" -"ENV{ID_INPUT_TOUCHPAD}==\"\", GOTO=\"touchpad_end\"\n" -"\n" -"ATTRS{name}==\"litest Apple Wireless Trackpad\"," -" ENV{ID_INPUT_TOUCHPAD_INTEGRATION}=\"external\"\n" -"\n" -"LABEL=\"touchpad_end\""; - -TEST_DEVICE("magic-trackpad", +struct litest_test_device litest_magicpad_device = { .type = LITEST_MAGIC_TRACKPAD, .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON | LITEST_APPLE_CLICKPAD, + .shortname = "magic trackpad", + .setup = litest_magicpad_setup, .interface = &interface, .name = "Apple Wireless Trackpad", .id = &input_id, .events = events, .absinfo = absinfo, - .udev_rule = udev_rule, -) +}; diff -Nru libinput-1.10.3/test/litest-device-mouse.c libinput-0.21.0/test/litest-device-mouse.c --- libinput-1.10.3/test/litest-device-mouse.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-mouse.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,19 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void litest_mouse_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_MOUSE); + litest_set_current_device(d); +} + static struct input_id input_id = { .bustype = 0x3, .vendor = 0x17ef, @@ -42,13 +50,15 @@ -1 , -1, }; -TEST_DEVICE("mouse", +struct litest_test_device litest_mouse_device = { .type = LITEST_MOUSE, .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL, + .shortname = "mouse", + .setup = litest_mouse_setup, .interface = NULL, .name = "Lenovo Optical USB Mouse", .id = &input_id, .absinfo = NULL, .events = events, -) +}; diff -Nru libinput-1.10.3/test/litest-device-mouse-low-dpi.c libinput-0.21.0/test/litest-device-mouse-low-dpi.c --- libinput-1.10.3/test/litest-device-mouse-low-dpi.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-mouse-low-dpi.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,19 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void litest_mouse_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_MOUSE_LOW_DPI); + litest_set_current_device(d); +} + static struct input_id input_id = { .bustype = 0x3, .vendor = 0x1, @@ -52,9 +60,11 @@ "\n" "LABEL=\"touchpad_end\""; -TEST_DEVICE("low-dpi-mouse", +struct litest_test_device litest_mouse_low_dpi_device = { .type = LITEST_MOUSE_LOW_DPI, .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL, + .shortname = "low-dpi mouse", + .setup = litest_mouse_setup, .interface = NULL, .name = "Low DPI Mouse", @@ -62,4 +72,4 @@ .absinfo = NULL, .events = events, .udev_rule = udev_rule, -) +}; diff -Nru libinput-1.10.3/test/litest-device-mouse-roccat.c libinput-0.21.0/test/litest-device-mouse-roccat.c --- libinput-1.10.3/test/litest-device-mouse-roccat.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-mouse-roccat.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,19 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void litest_mouse_roccat_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_MOUSE_ROCCAT); + litest_set_current_device(d); +} + static struct input_id input_id = { .bustype = 0x3, .vendor = 0x1e7d, @@ -184,13 +192,15 @@ { .value = -1 } }; -TEST_DEVICE("mouse-roccat", +struct litest_test_device litest_mouse_roccat_device = { .type = LITEST_MOUSE_ROCCAT, .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL | LITEST_KEYS, + .shortname = "mouse_roccat", + .setup = litest_mouse_roccat_setup, .interface = NULL, .name = "ROCCAT ROCCAT Kone XTD", .id = &input_id, .absinfo = absinfo, .events = events, -) +}; diff -Nru libinput-1.10.3/test/litest-device-mouse-wheel-click-angle.c libinput-0.21.0/test/litest-device-mouse-wheel-click-angle.c --- libinput-1.10.3/test/litest-device-mouse-wheel-click-angle.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-mouse-wheel-click-angle.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright © 2015 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x1234, - .product = 0x5678, -}; - -static int events[] = { - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_KEY, BTN_MIDDLE, - EV_REL, REL_X, - EV_REL, REL_Y, - EV_REL, REL_WHEEL, - -1 , -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"wheel_click_angle_end\"\n" -"KERNEL!=\"event*\", GOTO=\"wheel_click_angle_end\"\n" -"\n" -"ATTRS{name}==\"litest Wheel Click Angle Mouse*\",\\\n" -" ENV{MOUSE_WHEEL_CLICK_ANGLE}=\"-7\",\\\n" -" ENV{MOUSE_WHEEL_CLICK_ANGLE_HORIZONTAL}=\"13\"\n" -"\n" -"LABEL=\"wheel_click_angle_end\""; - -TEST_DEVICE("mouse-wheelclickangle", - .type = LITEST_MOUSE_WHEEL_CLICK_ANGLE, - .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL, - .interface = NULL, - - .name = "Wheel Click Angle Mouse", - .id = &input_id, - .absinfo = NULL, - .events = events, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-mouse-wheel-click-count.c libinput-0.21.0/test/litest-device-mouse-wheel-click-count.c --- libinput-1.10.3/test/litest-device-mouse-wheel-click-count.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-mouse-wheel-click-count.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x1234, - .product = 0x5678, -}; - -static int events[] = { - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_KEY, BTN_MIDDLE, - EV_REL, REL_X, - EV_REL, REL_Y, - EV_REL, REL_WHEEL, - -1 , -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"wheel_click_count_end\"\n" -"KERNEL!=\"event*\", GOTO=\"wheel_click_count_end\"\n" -"\n" -"ATTRS{name}==\"litest Wheel Click Count Mouse*\",\\\n" -" ENV{MOUSE_WHEEL_CLICK_ANGLE}=\"-15\",\\\n" -" ENV{MOUSE_WHEEL_CLICK_ANGLE_HORIZONTAL}=\"13\",\\\n" -" ENV{MOUSE_WHEEL_CLICK_COUNT}=\"-14\",\\\n" -" ENV{MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL}=\"27\"\\\n" -"\n" -"LABEL=\"wheel_click_count_end\""; - -TEST_DEVICE("mouse-wheelclickcount", - .type = LITEST_MOUSE_WHEEL_CLICK_COUNT, - .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL, - .interface = NULL, - - .name = "Wheel Click Count Mouse", - .id = &input_id, - .absinfo = NULL, - .events = events, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-mouse-wheel-tilt.c libinput-0.21.0/test/litest-device-mouse-wheel-tilt.c --- libinput-1.10.3/test/litest-device-mouse-wheel-tilt.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-mouse-wheel-tilt.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x17ef, - .product = 0x6019, -}; - -static int events[] = { - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_KEY, BTN_MIDDLE, - EV_REL, REL_X, - EV_REL, REL_Y, - EV_REL, REL_WHEEL, - EV_REL, REL_HWHEEL, - -1 , -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"wheel_wheel_tilt_end\"\n" -"KERNEL!=\"event*\", GOTO=\"wheel_wheel_tilt_end\"\n" -"\n" -"ATTRS{name}==\"litest Wheel Tilt Mouse*\",\\\n" -" ENV{MOUSE_WHEEL_TILT_HORIZONTAL}=\"1\",\\\n" -" ENV{MOUSE_WHEEL_TILT_VERTICAL}=\"1\"\n" -"\n" -"LABEL=\"wheel_wheel_tilt_end\""; - -TEST_DEVICE("mouse-wheel-tilt", - .type = LITEST_MOUSE_WHEEL_TILT, - .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL, - .interface = NULL, - - .name = "Wheel Tilt Mouse", - .id = &input_id, - .absinfo = NULL, - .events = events, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-ms-nano-transceiver-mouse.c libinput-0.21.0/test/litest-device-ms-nano-transceiver-mouse.c --- libinput-1.10.3/test/litest-device-ms-nano-transceiver-mouse.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-ms-nano-transceiver-mouse.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright © 2018 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x045e, - .product = 0x0800, -}; - -static int events[] = { - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_KEY, BTN_MIDDLE, - EV_KEY, BTN_SIDE, - EV_KEY, BTN_EXTRA, - EV_REL, REL_X, - EV_REL, REL_Y, - EV_REL, REL_WHEEL, - EV_REL, REL_DIAL, - EV_REL, REL_HWHEEL, - -1 , -1, -}; - -TEST_DEVICE("ms-nano-mouse", - .type = LITEST_MS_NANO_TRANSCEIVER_MOUSE, - .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL | LITEST_NO_DEBOUNCE, - .interface = NULL, - - .name = "Microsoft Microsoft® Nano Transceiver v2.0", - .id = &input_id, - .absinfo = NULL, - .events = events, -) - diff -Nru libinput-1.10.3/test/litest-device-ms-surface-cover.c libinput-0.21.0/test/litest-device-ms-surface-cover.c --- libinput-1.10.3/test/litest-device-ms-surface-cover.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-ms-surface-cover.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,20 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void +litest_ms_surface_cover_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_MS_SURFACE_COVER); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, @@ -367,13 +376,15 @@ -1, -1, }; -TEST_DEVICE("ms-surface-cover", +struct litest_test_device litest_ms_surface_cover_device = { .type = LITEST_MS_SURFACE_COVER, .features = LITEST_KEYS | LITEST_ABSOLUTE | LITEST_RELATIVE | LITEST_FAKE_MT | LITEST_BUTTON | LITEST_WHEEL, + .shortname = "MS surface cover", + .setup = litest_ms_surface_cover_setup, .interface = &interface, .name = "Microsoft Surface Type Cover", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-nexus4-touch-screen.c libinput-0.21.0/test/litest-device-nexus4-touch-screen.c --- libinput-1.10.3/test/litest-device-nexus4-touch-screen.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-nexus4-touch-screen.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,20 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void litest_nexus4_setup(void) +{ + struct litest_device *d = + litest_create_device(LITEST_NEXUS4_TOUCH_SCREEN); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, @@ -76,13 +85,15 @@ -1, -1 }; -TEST_DEVICE("nexus4", +struct litest_test_device litest_nexus4_device = { .type = LITEST_NEXUS4_TOUCH_SCREEN, .features = LITEST_TOUCH|LITEST_ELLIPSE, + .shortname = "nexus4", + .setup = litest_nexus4_setup, .interface = &interface, .name = "Nexus 4 touch screen", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-protocol-a-touch-screen.c libinput-0.21.0/test/litest-device-protocol-a-touch-screen.c --- libinput-1.10.3/test/litest-device-protocol-a-touch-screen.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-protocol-a-touch-screen.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,20 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void +litest_protocol_a_touch_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_PROTOCOL_A_SCREEN); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, @@ -75,13 +84,15 @@ -1, -1, }; -TEST_DEVICE("protocol-a", +struct litest_test_device litest_protocol_a_screen = { .type = LITEST_PROTOCOL_A_SCREEN, .features = LITEST_PROTOCOL_A, + .shortname = "protocol A", + .setup = litest_protocol_a_touch_setup, .interface = &interface, .name = "Protocol A touch screen", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-qemu-usb-tablet.c libinput-0.21.0/test/litest-device-qemu-usb-tablet.c --- libinput-1.10.3/test/litest-device-qemu-usb-tablet.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-qemu-usb-tablet.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,12 +21,21 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" #include +static void +litest_qemu_tablet_touch_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_QEMU_TABLET); + litest_set_current_device(d); +} + static void touch_down(struct litest_device *d, unsigned int slot, double x, double y) { @@ -79,13 +88,15 @@ -1, -1, }; -TEST_DEVICE("qemu-tablet", +struct litest_test_device litest_qemu_tablet_device = { .type = LITEST_QEMU_TABLET, .features = LITEST_WHEEL | LITEST_BUTTON | LITEST_ABSOLUTE, + .shortname = "qemu tablet", + .setup = litest_qemu_tablet_touch_setup, .interface = &interface, .name = "QEMU 0.12.1 QEMU USB Tablet", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-synaptics.c libinput-0.21.0/test/litest-device-synaptics.c --- libinput-1.10.3/test/litest-device-synaptics.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-synaptics.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,20 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void +litest_synaptics_clickpad_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_SYNAPTICS_CLICKPAD); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, @@ -102,13 +111,15 @@ { .value = -1 } }; -TEST_DEVICE("synaptics", - .type = LITEST_SYNAPTICS_CLICKPAD_X220, +struct litest_test_device litest_synaptics_clickpad_device = { + .type = LITEST_SYNAPTICS_CLICKPAD, .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON, + .shortname = "synaptics", + .setup = litest_synaptics_clickpad_setup, .interface = &interface, .name = "SynPS/2 Synaptics TouchPad", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-synaptics-hover.c libinput-0.21.0/test/litest-device-synaptics-hover.c --- libinput-1.10.3/test/litest-device-synaptics-hover.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-synaptics-hover.c 2015-08-03 03:44:04.000000000 +0000 @@ -21,7 +21,9 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include @@ -30,46 +32,44 @@ #include "litest.h" #include "litest-int.h" -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; +static void +synaptics_hover_create(struct litest_device *d); -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; +static void +litest_synaptics_hover_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_SYNAPTICS_HOVER_SEMI_MT); + litest_set_current_device(d); +} + +static void +synaptics_hover_touch_down(struct litest_device *d, unsigned int slot, double x, double y) +{ + struct litest_semi_mt *semi_mt = d->private; + + litest_semi_mt_touch_down(d, semi_mt, slot, x, y); +} -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) +static void +synaptics_hover_touch_move(struct litest_device *d, unsigned int slot, double x, double y) { - switch (evcode) { - case ABS_PRESSURE: - case ABS_MT_PRESSURE: - *value = 30; - return 0; - } - return 1; + struct litest_semi_mt *semi_mt = d->private; + + litest_semi_mt_touch_move(d, semi_mt, slot, x, y); } -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, +static void +synaptics_hover_touch_up(struct litest_device *d, unsigned int slot) +{ + struct litest_semi_mt *semi_mt = d->private; + + litest_semi_mt_touch_up(d, semi_mt, slot); +} - .get_axis_default = get_axis_default, +static struct litest_device_interface interface = { + .touch_down = synaptics_hover_touch_down, + .touch_move = synaptics_hover_touch_move, + .touch_up = synaptics_hover_touch_up, }; static struct input_id input_id = { @@ -106,19 +106,38 @@ "ACTION==\"remove\", GOTO=\"synaptics_semi_mt_end\"\n" "KERNEL!=\"event*\", GOTO=\"synaptics_semi_mt_end\"\n" "\n" -"ATTRS{name}==\"SynPS/2 Synaptics TouchPad\",\\\n" +"ATTRS{name}==\"SynPS/2 Synaptics TouchPad\",\n" " ENV{LIBINPUT_MODEL_JUMPING_SEMI_MT}=\"1\"\n" "\n" "LABEL=\"synaptics_semi_mt_end\""; -TEST_DEVICE("synaptics-hover", +struct litest_test_device litest_synaptics_hover_device = { .type = LITEST_SYNAPTICS_HOVER_SEMI_MT, .features = LITEST_TOUCHPAD | LITEST_SEMI_MT | LITEST_BUTTON, + .shortname = "synaptics hover", + .setup = litest_synaptics_hover_setup, .interface = &interface, + .create = synaptics_hover_create, .name = "SynPS/2 Synaptics TouchPad", .id = &input_id, .events = events, .absinfo = absinfo, .udev_rule = udev_rule, -) +}; + +static void +synaptics_hover_create(struct litest_device *d) +{ + struct litest_semi_mt *semi_mt = zalloc(sizeof(*semi_mt)); + assert(semi_mt); + + d->private = semi_mt; + + d->uinput = litest_create_uinput_device_from_description( + litest_synaptics_hover_device.name, + litest_synaptics_hover_device.id, + absinfo, + events); + d->interface = &interface; +} diff -Nru libinput-1.10.3/test/litest-device-synaptics-i2c.c libinput-0.21.0/test/litest-device-synaptics-i2c.c --- libinput-1.10.3/test/litest-device-synaptics-i2c.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-synaptics-i2c.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,102 +0,0 @@ -/* - * Copyright © 2015 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, -}; - -static struct input_id input_id = { - .bustype = 0x18, - .vendor = 0x6cb, - .product = 0x76ad, -}; - -static int events[] = { - EV_KEY, BTN_LEFT, - EV_KEY, BTN_TOOL_FINGER, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_TOOL_DOUBLETAP, - EV_KEY, BTN_TOOL_TRIPLETAP, - INPUT_PROP_MAX, INPUT_PROP_POINTER, - INPUT_PROP_MAX, INPUT_PROP_BUTTONPAD, - -1, -1, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 1216, 0, 0, 12 }, - { ABS_Y, 0, 680, 0, 0, 12 }, - { ABS_MT_SLOT, 0, 1, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 1216, 0, 0, 12 }, - { ABS_MT_POSITION_Y, 0, 680, 0, 0, 12 }, - { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, - { .value = -1 } -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"touchpad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"touchpad_end\"\n" -"ENV{ID_INPUT_TOUCHPAD}==\"\", GOTO=\"touchpad_end\"\n" -"\n" -"ATTRS{name}==\"litest DLL0704:01 06CB:76AD Touchpad\"," -" ENV{LIBINPUT_MODEL_TOUCHPAD_VISIBLE_MARKER}=\"1\"\n" -"\n" -"LABEL=\"touchpad_end\""; - -TEST_DEVICE("synaptics-i2c", - .type = LITEST_SYNAPTICS_I2C, - .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON, - .interface = &interface, - - .name = "DLL0704:01 06CB:76AD Touchpad", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-synaptics-rmi4.c libinput-0.21.0/test/litest-device-synaptics-rmi4.c --- libinput-1.10.3/test/litest-device-synaptics-rmi4.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-synaptics-rmi4.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,123 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = 0 }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = 2 }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = 2 }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = 0 }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MAJOR, .value = 2 }, - { .type = EV_ABS, .code = ABS_MT_TOUCH_MINOR, .value = 2 }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_PRESSURE: - case ABS_MT_PRESSURE: - *value = 30; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, - - .get_axis_default = get_axis_default, -}; - -static struct input_id input_id = { - .bustype = 0x1d, - .vendor = 0x6cb, - .product = 0x0, -}; - -static int events[] = { - EV_KEY, BTN_LEFT, - EV_KEY, BTN_TOOL_FINGER, - EV_KEY, BTN_TOOL_QUINTTAP, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_TOOL_DOUBLETAP, - EV_KEY, BTN_TOOL_TRIPLETAP, - EV_KEY, BTN_TOOL_QUADTAP, - INPUT_PROP_MAX, INPUT_PROP_POINTER, - INPUT_PROP_MAX, INPUT_PROP_BUTTONPAD, - -1, -1, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 1940, 0, 0, 20 }, - { ABS_Y, 0, 1062, 0, 0, 20 }, - { ABS_PRESSURE, 0, 255, 0, 0, 0 }, - { ABS_MT_SLOT, 0, 4, 0, 0, 0 }, - { ABS_MT_TOUCH_MAJOR, 0, 15, 0, 0, 0 }, - { ABS_MT_TOUCH_MINOR, 0, 15, 0, 0, 0 }, - { ABS_MT_ORIENTATION, 0, 1, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 1940, 0, 0, 20 }, - { ABS_MT_POSITION_Y, 0, 1062, 0, 0, 20 }, - { ABS_MT_TOOL_TYPE, 0, 2, 0, 0, 0 }, - { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, - { ABS_MT_PRESSURE, 0, 255, 0, 0, 0 }, - { .value = -1 } -}; - -TEST_DEVICE("synaptics-rmi4", - .type = LITEST_SYNAPTICS_RMI4, - .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON, - .interface = &interface, - - .name = "Synaptics TM3053-004", - .id = &input_id, - .events = events, - .absinfo = absinfo, -) diff -Nru libinput-1.10.3/test/litest-device-synaptics-st.c libinput-0.21.0/test/litest-device-synaptics-st.c --- libinput-1.10.3/test/litest-device-synaptics-st.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-synaptics-st.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,15 +21,24 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void +litest_synaptics_touchpad_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_SYNAPTICS_TOUCHPAD); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_PRESSURE, .value = 30 }, { .type = EV_ABS, .code = ABS_TOOL_WIDTH, .value = 7 }, { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, { .type = -1, .code = -1 }, @@ -47,23 +56,10 @@ { .type = -1, .code = -1 }, }; -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_PRESSURE: - *value = 30; - return 0; - } - return 1; -} - static struct litest_device_interface interface = { .touch_down_events = down, .touch_move_events = move, .touch_up_events = up, - - .get_axis_default = get_axis_default, }; static struct input_absinfo absinfo[] = { @@ -88,13 +84,15 @@ -1, -1, }; -TEST_DEVICE("synaptics-st", +struct litest_test_device litest_synaptics_touchpad_device = { .type = LITEST_SYNAPTICS_TOUCHPAD, .features = LITEST_TOUCHPAD | LITEST_BUTTON | LITEST_SINGLE_TOUCH, + .shortname = "synaptics ST", + .setup = litest_synaptics_touchpad_setup, .interface = &interface, .name = "SynPS/2 Synaptics TouchPad", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-synaptics-t440.c libinput-0.21.0/test/litest-device-synaptics-t440.c --- libinput-1.10.3/test/litest-device-synaptics-t440.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-synaptics-t440.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,20 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void +litest_synaptics_t440_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_SYNAPTICS_TOPBUTTONPAD); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, @@ -103,13 +112,15 @@ { .value = -1 } }; -TEST_DEVICE("synaptics-t440", +struct litest_test_device litest_synaptics_t440_device = { .type = LITEST_SYNAPTICS_TOPBUTTONPAD, .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON | LITEST_TOPBUTTONPAD, + .shortname = "synaptics t440", + .setup = litest_synaptics_t440_setup, .interface = &interface, .name = "SynPS/2 Synaptics TouchPad", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-synaptics-x1-carbon-3rd.c libinput-0.21.0/test/litest-device-synaptics-x1-carbon-3rd.c --- libinput-1.10.3/test/litest-device-synaptics-x1-carbon-3rd.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-synaptics-x1-carbon-3rd.c 2015-07-31 01:50:42.000000000 +0000 @@ -21,11 +21,20 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void +litest_synaptics_carbon3rd_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, @@ -105,24 +114,15 @@ { .value = -1 } }; -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"touchpad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"touchpad_end\"\n" -"ENV{ID_INPUT_TOUCHPAD}==\"\", GOTO=\"touchpad_end\"\n" -"\n" -"ATTRS{name}==\"litest SynPS/2 Synaptics TouchPad X1C3rd\"," -" ENV{LIBINPUT_MODEL_LENOVO_T450_TOUCHPAD}=\"1\"\n" -"\n" -"LABEL=\"touchpad_end\""; - -TEST_DEVICE("synaptics-carbon3rd", +struct litest_test_device litest_synaptics_carbon3rd_device = { .type = LITEST_SYNAPTICS_TRACKPOINT_BUTTONS, .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON, + .shortname = "synaptics carbon3rd", + .setup = litest_synaptics_carbon3rd_setup, .interface = &interface, .name = "SynPS/2 Synaptics TouchPad X1C3rd", .id = &input_id, .events = events, .absinfo = absinfo, - .udev_rule = udev_rule, -) +}; diff -Nru libinput-1.10.3/test/litest-device-thinkpad-extrabuttons.c libinput-0.21.0/test/litest-device-thinkpad-extrabuttons.c --- libinput-1.10.3/test/litest-device-thinkpad-extrabuttons.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-thinkpad-extrabuttons.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x19, - .vendor = 0x17aa, - .product = 0x5054, -}; - -static int events[] = { - EV_KEY, KEY_MUTE, - EV_KEY, KEY_VOLUMEUP, - EV_KEY, KEY_VOLUMEDOWN, - EV_KEY, KEY_SCALE, - EV_KEY, KEY_SLEEP, - EV_KEY, KEY_FILE, - EV_KEY, KEY_PROG1, - EV_KEY, KEY_COFFEE, - EV_KEY, KEY_BACK, - EV_KEY, KEY_CONFIG, - EV_KEY, KEY_REFRESH, - EV_KEY, KEY_F20, - EV_KEY, KEY_F21, - EV_KEY, KEY_F24, - EV_KEY, KEY_SUSPEND, - EV_KEY, KEY_CAMERA, - EV_KEY, KEY_SEARCH, - EV_KEY, KEY_BRIGHTNESSDOWN, - EV_KEY, KEY_BRIGHTNESSUP, - EV_KEY, KEY_SWITCHVIDEOMODE, - EV_KEY, KEY_KBDILLUMTOGGLE, - EV_KEY, KEY_BATTERY, - EV_KEY, KEY_WLAN, - EV_KEY, KEY_UNKNOWN, - EV_KEY, KEY_ZOOM, - EV_KEY, KEY_FN_F1, - EV_KEY, KEY_FN_F10, - EV_KEY, KEY_FN_F11, - EV_KEY, KEY_VOICECOMMAND, - EV_KEY, KEY_BRIGHTNESS_MIN, - - EV_SW, SW_RFKILL_ALL, - EV_SW, SW_TABLET_MODE, - - -1, -1, -}; - -TEST_DEVICE("thinkpad-extrabuttons", - .type = LITEST_THINKPAD_EXTRABUTTONS, - .features = LITEST_KEYS | LITEST_SWITCH, - .interface = NULL, - - .name = "ThinkPad Extra Buttons", - .id = &input_id, - .events = events, - .absinfo = NULL, -) diff -Nru libinput-1.10.3/test/litest-device-touch-screen.c libinput-0.21.0/test/litest-device-touch-screen.c --- libinput-1.10.3/test/litest-device-touch-screen.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-touch-screen.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,20 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void litest_generic_mt_setup(void) +{ + struct litest_device *d = + litest_create_device(LITEST_GENERIC_MULTITOUCH_SCREEN); + litest_set_current_device(d); +} + static struct input_event down[] = { { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, @@ -82,13 +91,15 @@ -1, -1 }; -TEST_DEVICE("generic-mt", +struct litest_test_device litest_generic_multitouch_screen_device = { .type = LITEST_GENERIC_MULTITOUCH_SCREEN, .features = LITEST_TOUCH|LITEST_ELLIPSE, + .shortname = "generic-mt", + .setup = litest_generic_mt_setup, .interface = &interface, .name = "generic-mt", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-touchscreen-fuzz.c libinput-0.21.0/test/litest-device-touchscreen-fuzz.c --- libinput-1.10.3/test/litest-device-touchscreen-fuzz.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-touchscreen-fuzz.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -/* - * Copyright © 2015 Canonical, Ltd. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 1500, 10, 0, 0 }, - { ABS_Y, 0, 2500, 10, 0, 0 }, - { ABS_MT_SLOT, 0, 9, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 1500, 10, 0, 0 }, - { ABS_MT_POSITION_Y, 0, 2500, 10, 0, 0 }, - { ABS_MT_PRESSURE, 0, 255, 0, 0, 0 }, - { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x1, - .vendor = 0x0, - .product = 0x25, -}; - -static int events[] = { - EV_KEY, BTN_TOUCH, - INPUT_PROP_MAX, INPUT_PROP_DIRECT, - -1, -1 -}; - -TEST_DEVICE("touchscreen-fuzz", - .type = LITEST_MULTITOUCH_FUZZ_SCREEN, - .features = LITEST_TOUCH, - .interface = &interface, - - .name = "touchscreen with fuzz", - .id = &input_id, - .events = events, - .absinfo = absinfo, -) diff -Nru libinput-1.10.3/test/litest-device-trackpoint.c libinput-0.21.0/test/litest-device-trackpoint.c --- libinput-1.10.3/test/litest-device-trackpoint.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-trackpoint.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,19 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void litest_trackpoint_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_TRACKPOINT); + litest_set_current_device(d); +} + static struct input_id input_id = { .bustype = 0x11, .vendor = 0x2, @@ -43,9 +51,11 @@ -1, -1, }; -TEST_DEVICE("trackpoint", +struct litest_test_device litest_trackpoint_device = { .type = LITEST_TRACKPOINT, .features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_POINTINGSTICK, + .shortname = "trackpoint", + .setup = litest_trackpoint_setup, .interface = NULL, .name = "TPPS/2 IBM TrackPoint", @@ -53,4 +63,4 @@ .absinfo = NULL, .events = events, -) +}; diff -Nru libinput-1.10.3/test/litest-device-uclogic-tablet.c libinput-0.21.0/test/litest-device-uclogic-tablet.c --- libinput-1.10.3/test/litest-device-uclogic-tablet.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-uclogic-tablet.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event proximity_in[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event proximity_out[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event motion[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_PRESSURE: - *value = 100; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .tablet_proximity_in_events = proximity_in, - .tablet_proximity_out_events = proximity_out, - .tablet_motion_events = motion, - - .get_axis_default = get_axis_default, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 32767, 0, 0, 235 }, - { ABS_Y, 0, 32767, 0, 0, 323 }, - { ABS_PRESSURE, 0, 1023, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x256c, - .product = 0x6e, -}; - -static int events[] = { - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_STYLUS, - EV_KEY, BTN_STYLUS2, - EV_MSC, MSC_SCAN, - -1, -1, -}; - -TEST_DEVICE("uclogic-tablet", - .type = LITEST_UCLOGIC_TABLET, - .features = LITEST_TABLET, - .interface = &interface, - - .name = "uclogic PenTablet Pen", - .id = &input_id, - .events = events, - .absinfo = absinfo, -) diff -Nru libinput-1.10.3/test/litest-device-vmware-virtual-usb-mouse.c libinput-0.21.0/test/litest-device-vmware-virtual-usb-mouse.c --- libinput-1.10.3/test/litest-device-vmware-virtual-usb-mouse.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-vmware-virtual-usb-mouse.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,12 +21,21 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" #include +static void +litest_vmware_virtmouse_touch_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_VMWARE_VIRTMOUSE); + litest_set_current_device(d); +} + static void touch_down(struct litest_device *d, unsigned int slot, double x, double y) { @@ -93,13 +102,15 @@ -1, -1, }; -TEST_DEVICE("vmware-virtmouse", +struct litest_test_device litest_vmware_virtmouse_device = { .type = LITEST_VMWARE_VIRTMOUSE, .features = LITEST_WHEEL | LITEST_BUTTON | LITEST_ABSOLUTE, + .shortname = "vmware virtmouse", + .setup = litest_vmware_virtmouse_touch_setup, .interface = &interface, .name = "VMware VMware Virtual USB Mouse", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-wacom-bamboo-16fg-pen.c libinput-0.21.0/test/litest-device-wacom-bamboo-16fg-pen.c --- libinput-1.10.3/test/litest-device-wacom-bamboo-16fg-pen.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-bamboo-16fg-pen.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event proximity_in[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event proximity_out[] = { - { .type = EV_ABS, .code = ABS_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_Y, .value = 0 }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = 0 }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event motion[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_PRESSURE: - *value = 100; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .tablet_proximity_in_events = proximity_in, - .tablet_proximity_out_events = proximity_out, - .tablet_motion_events = motion, - - .get_axis_default = get_axis_default, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 14720, 4, 0, 100 }, - { ABS_Y, 0, 9200, 4, 0, 100 }, - { ABS_PRESSURE, 0, 1023, 0, 0, 0 }, - { ABS_DISTANCE, 0, 31, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0xde, - .version = 0x100, -}; - -static int events[] = { - EV_KEY, BTN_TOOL_PEN, - EV_KEY, BTN_TOOL_RUBBER, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_STYLUS, - EV_KEY, BTN_STYLUS2, - INPUT_PROP_MAX, INPUT_PROP_POINTER, - -1, -1, -}; - -TEST_DEVICE("wacom-bamboo-tablet", - .type = LITEST_WACOM_BAMBOO, - .features = LITEST_TABLET | LITEST_DISTANCE, - .interface = &interface, - - .name = "Wacom Bamboo 16FG 4x5 Pen", - .id = &input_id, - .events = events, - .absinfo = absinfo, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-bamboo-2fg-finger.c libinput-0.21.0/test/litest-device-wacom-bamboo-2fg-finger.c --- libinput-1.10.3/test/litest-device-wacom-bamboo-2fg-finger.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-bamboo-2fg-finger.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 15360, 0, 0, 128 }, - { ABS_Y, 0, 10240, 0, 0, 128 }, - { ABS_MT_SLOT, 0, 1, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 15360, 0, 0, 128 }, - { ABS_MT_POSITION_Y, 0, 10240, 0, 0, 128 }, - { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, - { ABS_MISC, 0, 0, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0xd1, - .version = 0x110, -}; - -static int events[] = { - EV_KEY, BTN_TOUCH, - INPUT_PROP_MAX, INPUT_PROP_DIRECT, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"rule_end\"\n" -"KERNEL!=\"event*\", GOTO=\"rule_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom Bamboo 2FG 4x5 Finger*\",\\\n" -" ENV{LIBINPUT_DEVICE_GROUP}=\"wacom-bamboo-2fg-group\"\n" -"\n" -"LABEL=\"rule_end\""; - -TEST_DEVICE("wacom-bamboo-2fg-finger", - .type = LITEST_WACOM_BAMBOO_2FG_FINGER, - .features = LITEST_TOUCH, - .interface = &interface, - - .name = "Wacom Bamboo 2F 4x5 Finger", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-bamboo-2fg-pad.c libinput-0.21.0/test/litest-device-wacom-bamboo-2fg-pad.c --- libinput-1.10.3/test/litest-device-wacom-bamboo-2fg-pad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-bamboo-2fg-pad.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = -1, .code = -1 }, -}; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 1, 0, 0, 0 }, - { ABS_Y, 0, 1, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0xd1, - .version = 0x100, -}; - -static int events[] = { - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_KEY, BTN_FORWARD, - EV_KEY, BTN_BACK, - EV_KEY, BTN_STYLUS, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"pad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"pad_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom Bamboo 2FG 4x5 Pad*\",\\\n" -" ENV{ID_INPUT_TABLET_PAD}=\"1\",\\\n" -" ENV{LIBINPUT_DEVICE_GROUP}=\"wacom-bamboo-2fg-group\"\n" -"\n" -"LABEL=\"pad_end\""; - -TEST_DEVICE("wacom-bamboo-2fg-pad", - .type = LITEST_WACOM_BAMBOO_2FG_PAD, - .features = LITEST_TABLET_PAD, - .interface = &interface, - - .name = "Wacom Bamboo 2FG 4x5 Pad", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-bamboo-2fg-pen.c libinput-0.21.0/test/litest-device-wacom-bamboo-2fg-pen.c --- libinput-1.10.3/test/litest-device-wacom-bamboo-2fg-pen.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-bamboo-2fg-pen.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,120 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event proximity_in[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event proximity_out[] = { - { .type = EV_ABS, .code = ABS_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_Y, .value = 0 }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = 0 }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event motion[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_PRESSURE: - *value = 100; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .tablet_proximity_in_events = proximity_in, - .tablet_proximity_out_events = proximity_out, - .tablet_motion_events = motion, - - .get_axis_default = get_axis_default, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 14720, 4, 0, 100 }, - { ABS_Y, 0, 9200, 4, 0, 100 }, - { ABS_PRESSURE, 0, 1023, 0, 0, 0 }, - { ABS_DISTANCE, 0, 31, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0xd1, - .version = 0x100, -}; - -static int events[] = { - EV_KEY, BTN_TOOL_PEN, - EV_KEY, BTN_TOOL_RUBBER, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_STYLUS, - EV_KEY, BTN_STYLUS2, - INPUT_PROP_MAX, INPUT_PROP_POINTER, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"pad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"pad_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom Bamboo 2FG 4x5 Pen*\",\\\n" -" ENV{LIBINPUT_DEVICE_GROUP}=\"wacom-bamboo-2fg-group\"\n" -"\n" -"LABEL=\"pad_end\""; - -TEST_DEVICE("wacom-bamboo-2fg-pen", - .type = LITEST_WACOM_BAMBOO_2FG_PEN, - .features = LITEST_TABLET | LITEST_DISTANCE, - .interface = &interface, - - .name = "Wacom Bamboo 2FG 4x5 Pen", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-cintiq-12wx-pen.c libinput-0.21.0/test/litest-device-wacom-cintiq-12wx-pen.c --- libinput-1.10.3/test/litest-device-wacom-cintiq-12wx-pen.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-cintiq-12wx-pen.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,149 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event proximity_in[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MISC, .value = 2083 }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event proximity_out[] = { - { .type = EV_ABS, .code = ABS_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_Y, .value = 0 }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = 0 }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = 0 }, - { .type = EV_ABS, .code = ABS_MISC, .value = 0 }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event motion[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_TILT_X: - case ABS_TILT_Y: - *value = 0; - return 0; - case ABS_PRESSURE: - *value = 100; - return 0; - case ABS_DISTANCE: - *value = 0; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .tablet_proximity_in_events = proximity_in, - .tablet_proximity_out_events = proximity_out, - .tablet_motion_events = motion, - - .get_axis_default = get_axis_default, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 53020, 4, 0, 200 }, - { ABS_Y, 0, 33440, 4, 0, 200 }, - { ABS_Z, -900, 899, 0, 0, 0 }, - { ABS_RX, 0, 4096, 0, 0, 0 }, - { ABS_RY, 0, 4096, 0, 0, 0 }, - { ABS_WHEEL, 0, 1023, 0, 0, 0 }, - { ABS_PRESSURE, 0, 1023, 0, 0, 0 }, - { ABS_DISTANCE, 0, 63, 0, 0, 0 }, - { ABS_TILT_X, 0, 127, 0, 0, 0 }, - { ABS_TILT_Y, 0, 127, 0, 0, 0 }, - { ABS_MISC, 0, 0, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0xc6, - .version = 0x113, -}; - -static int events[] = { - EV_KEY, BTN_0, - EV_KEY, BTN_1, - EV_KEY, BTN_2, - EV_KEY, BTN_3, - EV_KEY, BTN_4, - EV_KEY, BTN_5, - EV_KEY, BTN_6, - EV_KEY, BTN_7, - EV_KEY, BTN_8, - EV_KEY, BTN_9, - EV_KEY, BTN_TOOL_PEN, - EV_KEY, BTN_TOOL_RUBBER, - EV_KEY, BTN_TOOL_BRUSH, - EV_KEY, BTN_TOOL_PENCIL, - EV_KEY, BTN_TOOL_AIRBRUSH, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_STYLUS, - EV_KEY, BTN_STYLUS2, - EV_MSC, MSC_SERIAL, - INPUT_PROP_MAX, INPUT_PROP_DIRECT, - -1, -1, -}; - -TEST_DEVICE("wacom-cintiq-tablet", - .type = LITEST_WACOM_CINTIQ, - .features = LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_SERIAL | LITEST_TILT, - .interface = &interface, - - .name = "Wacom Cintiq 12WX", - .id = &input_id, - .events = events, - .absinfo = absinfo, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-cintiq-13hdt-finger.c libinput-0.21.0/test/litest-device-wacom-cintiq-13hdt-finger.c --- libinput-1.10.3/test/litest-device-wacom-cintiq-13hdt-finger.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-cintiq-13hdt-finger.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_ORIENTATION, .value = 0 }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 2937, 0, 0, 10 }, - { ABS_Y, 0, 1652, 0, 0, 10 }, - { ABS_MT_SLOT, 0, 9, 0, 0, 0 }, - { ABS_MT_TOUCH_MAJOR, 0, 2937, 0, 0, 0 }, - { ABS_MT_WIDTH_MAJOR, 0, 2937, 0, 0, 0 }, - { ABS_MT_WIDTH_MINOR, 0, 1652, 0, 0, 0 }, - { ABS_MT_ORIENTATION, 0, 1, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 2937, 0, 0, 10 }, - { ABS_MT_POSITION_Y, 0, 1652, 0, 0, 10 }, - { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, - { ABS_MISC, 0, 0, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0x335, - .version = 0x110, -}; - -static int events[] = { - EV_KEY, BTN_TOUCH, - INPUT_PROP_MAX, INPUT_PROP_DIRECT, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"rule_end\"\n" -"KERNEL!=\"event*\", GOTO=\"rule_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom Cintiq 13 HD touch Finger*\",\\\n" -" ENV{LIBINPUT_DEVICE_GROUP}=\"wacom-13hdt-group\"\n" -"\n" -"LABEL=\"rule_end\""; - -TEST_DEVICE("wacom-cintiq-13hdt-finger", - .type = LITEST_WACOM_CINTIQ_13HDT_FINGER, - .features = LITEST_TOUCH, - .interface = &interface, - - .name = "Wacom Cintiq 13 HD touch Finger", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-cintiq-13hdt-pad.c libinput-0.21.0/test/litest-device-wacom-cintiq-13hdt-pad.c --- libinput-1.10.3/test/litest-device-wacom-cintiq-13hdt-pad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-cintiq-13hdt-pad.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event ring_start[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MISC, .value = 15 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct input_event ring_change[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct input_event ring_end[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = 0 }, - { .type = EV_ABS, .code = ABS_MISC, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, - .pad_ring_start_events = ring_start, - .pad_ring_change_events = ring_change, - .pad_ring_end_events = ring_end, -}; -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 1, 0, 0, 0 }, - { ABS_Y, 0, 1, 0, 0, 0 }, - { ABS_WHEEL, 0, 71, 0, 0, 0 }, - { ABS_MISC, 0, 0, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0x333, - .version = 0x110, -}; - -static int events[] = { - EV_KEY, BTN_0, - EV_KEY, BTN_1, - EV_KEY, BTN_2, - EV_KEY, BTN_3, - EV_KEY, BTN_4, - EV_KEY, BTN_5, - EV_KEY, BTN_6, - EV_KEY, BTN_7, - EV_KEY, BTN_8, - EV_KEY, BTN_STYLUS, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"pad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"pad_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom Cintiq 13 HD touch Pad*\",\\\n" -" ENV{ID_INPUT_TABLET_PAD}=\"1\",\\\n" -" ENV{LIBINPUT_DEVICE_GROUP}=\"wacom-13hdt-group\"\n" -"\n" -"LABEL=\"pad_end\""; - -TEST_DEVICE("wacom-cintiq-13hdt-pad", - .type = LITEST_WACOM_CINTIQ_13HDT_PAD, - .features = LITEST_TABLET_PAD | LITEST_RING, - .interface = &interface, - - .name = "Wacom Cintiq 13 HD touch Pad", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-cintiq-13hdt-pen.c libinput-0.21.0/test/litest-device-wacom-cintiq-13hdt-pen.c --- libinput-1.10.3/test/litest-device-wacom-cintiq-13hdt-pen.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-cintiq-13hdt-pen.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,148 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event proximity_in[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MISC, .value = 2083 }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event proximity_out[] = { - { .type = EV_ABS, .code = ABS_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_Y, .value = 0 }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = 0 }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = 0 }, - { .type = EV_ABS, .code = ABS_MISC, .value = 0 }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event motion[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_TILT_X: - case ABS_TILT_Y: - *value = 0; - return 0; - case ABS_PRESSURE: - *value = 100; - return 0; - case ABS_DISTANCE: - *value = 0; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .tablet_proximity_in_events = proximity_in, - .tablet_proximity_out_events = proximity_out, - .tablet_motion_events = motion, - - .get_axis_default = get_axis_default, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 400, 59152, 4, 0, 200 }, - { ABS_Y, 400, 33448, 4, 0, 200 }, - { ABS_Z, -900, 899, 0, 0, 287 }, - { ABS_WHEEL, 0, 1023, 0, 0, 0 }, - { ABS_THROTTLE, 0, 71, 0, 0, 0 }, - { ABS_PRESSURE, 0, 2047, 0, 0, 0 }, - { ABS_DISTANCE, 0, 63, 1, 0, 0 }, - { ABS_TILT_X, -64, 63, 1, 0, 57 }, - { ABS_TILT_Y, -64, 63, 1, 0, 57 }, - { ABS_MISC, 0, 0, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0x333, - .version = 0x110, -}; - -static int events[] = { - EV_KEY, BTN_TOOL_PEN, - EV_KEY, BTN_TOOL_RUBBER, - EV_KEY, BTN_TOOL_BRUSH, - EV_KEY, BTN_TOOL_PENCIL, - EV_KEY, BTN_TOOL_AIRBRUSH, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_STYLUS, - EV_KEY, BTN_STYLUS2, - EV_MSC, MSC_SERIAL, - INPUT_PROP_MAX, INPUT_PROP_DIRECT, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"rule_end\"\n" -"KERNEL!=\"event*\", GOTO=\"rule_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom Cintiq 13 HD touch Pen*\",\\\n" -" ENV{LIBINPUT_DEVICE_GROUP}=\"wacom-13hdt-group\"\n" -"\n" -"LABEL=\"rule_end\""; - -TEST_DEVICE("wacom-cintiq-13hdt-pen-tablet", - .type = LITEST_WACOM_CINTIQ_13HDT_PEN, - .features = LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_SERIAL | LITEST_TILT, - .interface = &interface, - - .name = "Wacom Cintiq 13 HD touch Pen", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-cintiq-24hd-pen.c libinput-0.21.0/test/litest-device-wacom-cintiq-24hd-pen.c --- libinput-1.10.3/test/litest-device-wacom-cintiq-24hd-pen.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-cintiq-24hd-pen.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,138 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event proximity_in[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MISC, .value = 2083 }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event proximity_out[] = { - { .type = EV_ABS, .code = ABS_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_Y, .value = 0 }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = 0 }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = 0 }, - { .type = EV_ABS, .code = ABS_MISC, .value = 0 }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event motion[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_TILT_X: - case ABS_TILT_Y: - *value = 0; - return 0; - case ABS_PRESSURE: - *value = 100; - return 0; - case ABS_DISTANCE: - *value = 0; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .tablet_proximity_in_events = proximity_in, - .tablet_proximity_out_events = proximity_out, - .tablet_motion_events = motion, - - .get_axis_default = get_axis_default, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 400, 104080, 4, 0, 200 }, - { ABS_Y, 400, 65200, 4, 0, 200 }, - { ABS_Z, -900, 899, 0, 0, 0 }, - { ABS_WHEEL, 0, 1023, 0, 0, 0 }, - { ABS_THROTTLE, 0, 71, 0, 0, 0 }, - { ABS_PRESSURE, 0, 2047, 0, 0, 0 }, - { ABS_DISTANCE, 0, 63, 0, 0, 0 }, - { ABS_TILT_X, -64, 63, 0, 0, 57 }, - { ABS_TILT_Y, -64, 63, 0, 0, 57 }, - { ABS_MISC, 0, 0, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0xf4, - .version = 0x113, -}; - -static int events[] = { - EV_KEY, BTN_TOOL_PEN, - EV_KEY, BTN_TOOL_RUBBER, - EV_KEY, BTN_TOOL_BRUSH, - EV_KEY, BTN_TOOL_PENCIL, - EV_KEY, BTN_TOOL_AIRBRUSH, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_STYLUS, - EV_KEY, BTN_STYLUS2, - EV_MSC, MSC_SERIAL, - INPUT_PROP_MAX, INPUT_PROP_DIRECT, - -1, -1, -}; - -TEST_DEVICE("wacom-cintiq-24hd-tablet", - .type = LITEST_WACOM_CINTIQ_24HD, - .features = LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_SERIAL | LITEST_TILT, - .interface = &interface, - - .name = "Wacom Cintiq 24 HD Pen", - .id = &input_id, - .events = events, - .absinfo = absinfo, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-cintiq-24hdt-pad.c libinput-0.21.0/test/litest-device-wacom-cintiq-24hdt-pad.c --- libinput-1.10.3/test/litest-device-wacom-cintiq-24hdt-pad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-cintiq-24hdt-pad.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,136 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include -#include -#include -#include - -#include "litest.h" -#include "litest-int.h" - -static void -litest_wacom_cintiq_pad_teardown(void) -{ - litest_generic_device_teardown(); -} - -static struct input_event down[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event ring_start[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MISC, .value = 15 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct input_event ring_change[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct input_event ring_end[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = 0 }, - { .type = EV_ABS, .code = ABS_MISC, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, - .pad_ring_start_events = ring_start, - .pad_ring_change_events = ring_change, - .pad_ring_end_events = ring_end, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 1, 0, 0, 0 }, - { ABS_Y, 0, 1, 0, 0, 0 }, - { ABS_WHEEL, 0, 71, 0, 0, 0 }, - { ABS_THROTTLE, 0, 71, 0, 0, 0 }, - { ABS_MISC, 0, 0, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0xf8, - .version = 0x110, -}; - -static int events[] = { - EV_KEY, KEY_PROG1, - EV_KEY, KEY_PROG2, - EV_KEY, KEY_PROG3, - EV_KEY, BTN_0, - EV_KEY, BTN_1, - EV_KEY, BTN_2, - EV_KEY, BTN_3, - EV_KEY, BTN_4, - EV_KEY, BTN_5, - EV_KEY, BTN_6, - EV_KEY, BTN_7, - EV_KEY, BTN_8, - EV_KEY, BTN_9, - EV_KEY, BTN_SOUTH, - EV_KEY, BTN_EAST, - EV_KEY, BTN_C, - EV_KEY, BTN_NORTH, - EV_KEY, BTN_WEST, - EV_KEY, BTN_Z, - EV_KEY, BTN_STYLUS, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"pad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"pad_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom Cintiq 24 HD touch Pad*\",\\\n" -" ENV{ID_INPUT_TABLET_PAD}=\"1\"\n" -"\n" -"LABEL=\"pad_end\""; - -TEST_DEVICE("wacom-cintiq-24hdt-pad", - .type = LITEST_WACOM_CINTIQ_24HDT_PAD, - .features = LITEST_TABLET_PAD | LITEST_RING, - .teardown = litest_wacom_cintiq_pad_teardown, - .interface = &interface, - - .name = "Wacom Cintiq 24 HD touch Pad", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-ekr.c libinput-0.21.0/test/litest-device-wacom-ekr.c --- libinput-1.10.3/test/litest-device-wacom-ekr.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-ekr.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,122 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event ring_start[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MISC, .value = 15 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct input_event ring_change[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct input_event ring_end[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = 0 }, - { .type = EV_ABS, .code = ABS_MISC, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, - .pad_ring_start_events = ring_start, - .pad_ring_change_events = ring_change, - .pad_ring_end_events = ring_end, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 1, 0, 0, 0 }, - { ABS_Y, 0, 1, 0, 0, 0 }, - { ABS_WHEEL, 0, 71, 0, 0, 0 }, - { ABS_MISC, 0, 0, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0x331, -}; - -static int events[] = { - EV_KEY, BTN_0, - EV_KEY, BTN_1, - EV_KEY, BTN_2, - EV_KEY, BTN_3, - EV_KEY, BTN_3, - EV_KEY, BTN_4, - EV_KEY, BTN_5, - EV_KEY, BTN_6, - EV_KEY, BTN_7, - EV_KEY, BTN_8, - EV_KEY, BTN_9, - EV_KEY, BTN_BASE, - EV_KEY, BTN_BASE2, - EV_KEY, BTN_SOUTH, - EV_KEY, BTN_EAST, - EV_KEY, BTN_C, - EV_KEY, BTN_NORTH, - EV_KEY, BTN_WEST, - EV_KEY, BTN_Z, - EV_KEY, BTN_STYLUS, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"pad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"pad_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom Express Key Remote Pad*\",\\\n" -" ENV{ID_INPUT_TABLET_PAD}=\"1\"\n" -"\n" -"LABEL=\"pad_end\""; - -TEST_DEVICE("wacom-ekr", - .type = LITEST_WACOM_EKR, - .features = LITEST_TABLET_PAD | LITEST_RING, - .interface = &interface, - - .name = "Wacom Express Key Remote Pad", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-hid4800-pen.c libinput-0.21.0/test/litest-device-wacom-hid4800-pen.c --- libinput-1.10.3/test/litest-device-wacom-hid4800-pen.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-hid4800-pen.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event proximity_in[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event proximity_out[] = { - { .type = EV_ABS, .code = ABS_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_Y, .value = 0 }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 0 }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event motion[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 297797542 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_PRESSURE: - *value = 100; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .tablet_proximity_in_events = proximity_in, - .tablet_proximity_out_events = proximity_out, - .tablet_motion_events = motion, - - .get_axis_default = get_axis_default, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 21696, 4, 0, 100 }, - { ABS_Y, 0, 13560, 4, 0, 100 }, - { ABS_PRESSURE, 0, 2047, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x18, - .vendor = 0x56a, - .product = 0x4800, - .version = 0x100, -}; - -static int events[] = { - EV_KEY, BTN_TOOL_PEN, - EV_KEY, BTN_TOOL_RUBBER, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_STYLUS, - EV_KEY, BTN_STYLUS2, - EV_MSC, MSC_SERIAL, - INPUT_PROP_MAX, INPUT_PROP_DIRECT, - -1, -1, -}; - -TEST_DEVICE("wacom-hid4800-tablet", - .type = LITEST_WACOM_HID4800_PEN, - .features = LITEST_TABLET, - .interface = &interface, - - .name = "Wacom HID 4800 Pen", - .id = &input_id, - .events = events, - .absinfo = absinfo, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-intuos3-pad.c libinput-0.21.0/test/litest-device-wacom-intuos3-pad.c --- libinput-1.10.3/test/litest-device-wacom-intuos3-pad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-intuos3-pad.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event strip_start[] = { - { .type = EV_ABS, .code = ABS_RX, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MISC, .value = 15 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct input_event strip_change[] = { - { .type = EV_ABS, .code = ABS_RX, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct input_event strip_end[] = { - { .type = EV_ABS, .code = ABS_RX, .value = 0 }, - { .type = EV_ABS, .code = ABS_MISC, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, - .pad_strip_start_events = strip_start, - .pad_strip_change_events = strip_change, - .pad_strip_end_events = strip_end, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 1, 0, 0, 0 }, - { ABS_Y, 0, 1, 0, 0, 0 }, - { ABS_RX, 0, 4096, 0, 0, 0 }, - { ABS_MISC, 0, 0, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0xb7, -}; - -static int events[] = { - EV_KEY, BTN_0, - EV_KEY, BTN_1, - EV_KEY, BTN_2, - EV_KEY, BTN_3, - EV_KEY, BTN_STYLUS, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"pad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"pad_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom Intuos3 4x6 Pad*\",\\\n" -" ENV{ID_INPUT_TABLET_PAD}=\"1\"\n" -"\n" -"LABEL=\"pad_end\""; - -TEST_DEVICE("wacom-intuos3-pad", - .type = LITEST_WACOM_INTUOS3_PAD, - .features = LITEST_TABLET_PAD | LITEST_STRIP, - .interface = &interface, - - .name = "Wacom Intuos3 4x6 Pad", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-intuos5-finger.c libinput-0.21.0/test/litest-device-wacom-intuos5-finger.c --- libinput-1.10.3/test/litest-device-wacom-intuos5-finger.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-intuos5-finger.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 4096, 0, 0, 18 }, - { ABS_Y, 0, 4096, 0, 0, 29 }, - { ABS_MT_SLOT, 0, 15, 0, 0, 0 }, - { ABS_MT_TOUCH_MAJOR, 0, 4096, 0, 0, 0 }, - { ABS_MT_TOUCH_MINOR, 0, 4096, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 4096, 0, 0, 18 }, - { ABS_MT_POSITION_Y, 0, 4096, 0, 0, 29 }, - { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0x27, -}; - -static int events[] = { - EV_KEY, BTN_TOOL_FINGER, - EV_KEY, BTN_TOOL_QUINTTAP, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_TOOL_DOUBLETAP, - EV_KEY, BTN_TOOL_TRIPLETAP, - EV_KEY, BTN_TOOL_QUADTAP, - INPUT_PROP_MAX, INPUT_PROP_POINTER, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"rule_end\"\n" -"KERNEL!=\"event*\", GOTO=\"rule_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom Intuos5 touch M Finger*\",\\\n" -" ENV{LIBINPUT_DEVICE_GROUP}=\"wacom-i5-group\"\n" -"\n" -"LABEL=\"rule_end\""; - -TEST_DEVICE("wacom-finger", - .type = LITEST_WACOM_FINGER, - .features = LITEST_TOUCHPAD, - .interface = &interface, - - .name = "Wacom Intuos5 touch M Finger", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-intuos5-pad.c libinput-0.21.0/test/litest-device-wacom-intuos5-pad.c --- libinput-1.10.3/test/litest-device-wacom-intuos5-pad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-intuos5-pad.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event ring_start[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MISC, .value = 15 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct input_event ring_change[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct input_event ring_end[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = 0 }, - { .type = EV_ABS, .code = ABS_MISC, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, - .pad_ring_start_events = ring_start, - .pad_ring_change_events = ring_change, - .pad_ring_end_events = ring_end, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 1, 0, 0, 0 }, - { ABS_Y, 0, 1, 0, 0, 0 }, - { ABS_WHEEL, 0, 71, 0, 0, 0 }, - { ABS_MISC, 0, 0, 0, 0, 10 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0x27, -}; - -static int events[] = { - EV_KEY, BTN_0, - EV_KEY, BTN_1, - EV_KEY, BTN_2, - EV_KEY, BTN_3, - EV_KEY, BTN_4, - EV_KEY, BTN_5, - EV_KEY, BTN_6, - EV_KEY, BTN_7, - EV_KEY, BTN_8, - EV_KEY, BTN_STYLUS, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"pad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"pad_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom Intuos5 touch M Pad*\",\\\n" -" ENV{LIBINPUT_DEVICE_GROUP}=\"wacom-i5-group\",\\\n" -" ENV{ID_INPUT_TABLET_PAD}=\"1\"\n" -"\n" -"LABEL=\"pad_end\""; - -TEST_DEVICE("wacom-pad", - .type = LITEST_WACOM_INTUOS5_PAD, - .features = LITEST_TABLET_PAD | LITEST_RING, - .interface = &interface, - - .name = "Wacom Intuos5 touch M Pad", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-intuos5-pen.c libinput-0.21.0/test/litest-device-wacom-intuos5-pen.c --- libinput-1.10.3/test/litest-device-wacom-intuos5-pen.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-intuos5-pen.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event proximity_in[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MISC, .value = 1050626 }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 578837976 }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event proximity_out[] = { - { .type = EV_ABS, .code = ABS_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_Y, .value = 0 }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = 0 }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = 0 }, - { .type = EV_ABS, .code = ABS_MISC, .value = 0 }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 578837976 }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event motion[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_DISTANCE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_MSC, .code = MSC_SERIAL, .value = 578837976 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_TILT_X: - case ABS_TILT_Y: - *value = 0; - return 0; - case ABS_PRESSURE: - *value = 100; - return 0; - case ABS_DISTANCE: - *value = 0; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .tablet_proximity_in_events = proximity_in, - .tablet_proximity_out_events = proximity_out, - .tablet_motion_events = motion, - - .get_axis_default = get_axis_default, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 44704, 4, 0, 200 }, - { ABS_Y, 0, 27940, 4, 0, 200 }, - { ABS_Z, -900, 899, 0, 0, 0 }, - { ABS_THROTTLE, -1023, 1023, 0, 0, 0 }, - { ABS_WHEEL, 0, 1023, 0, 0, 0 }, - { ABS_PRESSURE, 0, 2047, 0, 0, 0 }, - { ABS_DISTANCE, 0, 63, 0, 0, 0 }, - { ABS_TILT_X, 0, 127, 0, 0, 0 }, - { ABS_TILT_Y, 0, 127, 0, 0, 0 }, - { ABS_MISC, 0, 0, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0x27, -}; - -static int events[] = { - EV_KEY, BTN_0, - EV_KEY, BTN_1, - EV_KEY, BTN_2, - EV_KEY, BTN_3, - EV_KEY, BTN_4, - EV_KEY, BTN_5, - EV_KEY, BTN_6, - EV_KEY, BTN_7, - EV_KEY, BTN_8, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_KEY, BTN_MIDDLE, - EV_KEY, BTN_SIDE, - EV_KEY, BTN_EXTRA, - EV_KEY, BTN_TOOL_PEN, - EV_KEY, BTN_TOOL_RUBBER, - EV_KEY, BTN_TOOL_BRUSH, - EV_KEY, BTN_TOOL_PENCIL, - EV_KEY, BTN_TOOL_AIRBRUSH, - EV_KEY, BTN_TOOL_MOUSE, - EV_KEY, BTN_TOOL_LENS, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_STYLUS, - EV_KEY, BTN_STYLUS2, - EV_REL, REL_WHEEL, - EV_MSC, MSC_SERIAL, - INPUT_PROP_MAX, INPUT_PROP_POINTER, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"rule_end\"\n" -"KERNEL!=\"event*\", GOTO=\"rule_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom Intuos5 touch M Pen*\",\\\n" -" ENV{LIBINPUT_DEVICE_GROUP}=\"wacom-i5-group\"\n" -"\n" -"LABEL=\"rule_end\""; - -TEST_DEVICE("wacom-intuos-tablet", - .type = LITEST_WACOM_INTUOS, - .features = LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_SERIAL | LITEST_TILT, - .interface = &interface, - - .name = "Wacom Intuos5 touch M Pen", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-intuos-finger.c libinput-0.21.0/test/litest-device-wacom-intuos-finger.c --- libinput-1.10.3/test/litest-device-wacom-intuos-finger.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-intuos-finger.c 2015-07-28 22:12:38.000000000 +0000 @@ -0,0 +1,104 @@ +/* + * Copyright © 2014 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include "litest.h" +#include "litest-int.h" + +static void +litest_wacom_finger_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_WACOM_FINGER); + litest_set_current_device(d); +} + +static struct input_event down[] = { + { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, + { .type = -1, .code = -1 }, +}; + +static struct input_event move[] = { + { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, + { .type = -1, .code = -1 }, +}; + +static struct litest_device_interface interface = { + .touch_down_events = down, + .touch_move_events = move, +}; + +static struct input_absinfo absinfo[] = { + { ABS_X, 0, 4096, 0, 0, 18 }, + { ABS_Y, 0, 4096, 0, 0, 29 }, + { ABS_MT_SLOT, 0, 15, 0, 0, 0 }, + { ABS_MT_TOUCH_MAJOR, 0, 4096, 0, 0, 0 }, + { ABS_MT_TOUCH_MINOR, 0, 4096, 0, 0, 0 }, + { ABS_MT_POSITION_X, 0, 4096, 0, 0, 18 }, + { ABS_MT_POSITION_Y, 0, 4096, 0, 0, 29 }, + { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, + { .value = -1 }, +}; + +static struct input_id input_id = { + .bustype = 0x3, + .vendor = 0x56a, + .product = 0x27, +}; + +static int events[] = { + EV_KEY, BTN_TOOL_FINGER, + EV_KEY, BTN_TOOL_QUINTTAP, + EV_KEY, BTN_TOUCH, + EV_KEY, BTN_TOOL_DOUBLETAP, + EV_KEY, BTN_TOOL_TRIPLETAP, + EV_KEY, BTN_TOOL_QUADTAP, + INPUT_PROP_MAX, INPUT_PROP_POINTER, + -1, -1, +}; + +struct litest_test_device litest_wacom_finger_device = { + .type = LITEST_WACOM_FINGER, + .features = LITEST_TOUCHPAD, + .shortname = "wacom-finger", + .setup = litest_wacom_finger_setup, + .interface = &interface, + + .name = "Wacom Intuos5 touch M Finger", + .id = &input_id, + .events = events, + .absinfo = absinfo, +}; diff -Nru libinput-1.10.3/test/litest-device-wacom-isdv4-e6-finger.c libinput-0.21.0/test/litest-device-wacom-isdv4-e6-finger.c --- libinput-1.10.3/test/litest-device-wacom-isdv4-e6-finger.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-isdv4-e6-finger.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,88 +0,0 @@ -/* - * Copyright © 2013 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 2776, 0, 0, 10 }, - { ABS_Y, 0, 1569, 0, 0, 9 }, - { ABS_MT_SLOT, 0, 1, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 2776, 0, 0, 10 }, - { ABS_MT_POSITION_Y, 0, 1569, 0, 0, 9 }, - { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0xe6, -}; - -static int events[] = { - EV_KEY, BTN_TOUCH, - INPUT_PROP_MAX, INPUT_PROP_DIRECT, - -1, -1, -}; - -TEST_DEVICE("wacom-touch", - .type = LITEST_WACOM_TOUCH, - .features = LITEST_TOUCH, - .interface = &interface, - - .name = "Wacom ISDv4 E6 Finger", - .id = &input_id, - .events = events, - .absinfo = absinfo, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-isdv4-e6-pen.c libinput-0.21.0/test/litest-device-wacom-isdv4-e6-pen.c --- libinput-1.10.3/test/litest-device-wacom-isdv4-e6-pen.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-isdv4-e6-pen.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event proximity_in[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event proximity_out[] = { - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event motion[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_PRESSURE: - *value = 100; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .tablet_proximity_in_events = proximity_in, - .tablet_proximity_out_events = proximity_out, - .tablet_motion_events = motion, - - .get_axis_default = get_axis_default, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 27760, 4, 0, 100 }, - { ABS_Y, 0, 15694, 4, 0, 100 }, - { ABS_PRESSURE, 0, 255, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0xe6, -}; - -static int events[] = { - EV_KEY, BTN_TOOL_PEN, - EV_KEY, BTN_TOOL_RUBBER, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_STYLUS, - EV_KEY, BTN_STYLUS2, - INPUT_PROP_MAX, INPUT_PROP_DIRECT, - -1, -1, -}; - -TEST_DEVICE("wacom-isdv4-tablet", - .type = LITEST_WACOM_ISDV4, - .features = LITEST_TABLET, - .interface = &interface, - - .name = "Wacom ISDv4 E6 Pen", - .id = &input_id, - .events = events, - .absinfo = absinfo, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-mobilestudio-pro-pad.c libinput-0.21.0/test/litest-device-wacom-mobilestudio-pro-pad.c --- libinput-1.10.3/test/litest-device-wacom-mobilestudio-pro-pad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-mobilestudio-pro-pad.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,119 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event down[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event move[] = { - { .type = -1, .code = -1 }, -}; - -static struct input_event ring_start[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_MISC, .value = 15 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct input_event ring_change[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct input_event ring_end[] = { - { .type = EV_ABS, .code = ABS_WHEEL, .value = 0 }, - { .type = EV_ABS, .code = ABS_MISC, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -} ; - -static struct litest_device_interface interface = { - .touch_down_events = down, - .touch_move_events = move, - .pad_ring_start_events = ring_start, - .pad_ring_change_events = ring_change, - .pad_ring_end_events = ring_end, -}; -static struct input_absinfo absinfo[] = { - { ABS_X, -2048, 2048, 0, 0, 0 }, - { ABS_Y, -2048, 2048, 0, 0, 0 }, - { ABS_Z, -2048, 2048, 0, 0, 0 }, - { ABS_WHEEL, 0, 35, 0, 0, 0 }, - { ABS_MISC, 0, 0, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x56a, - .product = 0x34e, - .version = 0x110, -}; - -static int events[] = { - EV_KEY, BTN_0, - EV_KEY, BTN_1, - EV_KEY, BTN_2, - EV_KEY, BTN_3, - EV_KEY, BTN_4, - EV_KEY, BTN_5, - EV_KEY, BTN_6, - EV_KEY, BTN_7, - EV_KEY, BTN_8, - EV_KEY, BTN_9, - EV_KEY, BTN_SOUTH, - EV_KEY, BTN_EAST, - EV_KEY, BTN_C, - EV_KEY, BTN_STYLUS, - INPUT_PROP_MAX, INPUT_PROP_ACCELEROMETER, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"pad_end\"\n" -"KERNEL!=\"event*\", GOTO=\"pad_end\"\n" -"\n" -"ATTRS{name}==\"litest Wacom MobileStudio Pro 16 Pad*\",\\\n" -" ENV{ID_INPUT_TABLET}=\"1\",\\\n" -" ENV{ID_INPUT_TABLET_PAD}=\"1\"\\\n" -"\n" -"LABEL=\"pad_end\""; - -TEST_DEVICE("wacom-mobilestudio-pro16-pad", - .type = LITEST_WACOM_MOBILESTUDIO_PRO_16_PAD, - .features = LITEST_TABLET_PAD | LITEST_RING, - .interface = &interface, - - .name = "Wacom MobileStudio Pro 16 Pad", - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wacom-touch.c libinput-0.21.0/test/litest-device-wacom-touch.c --- libinput-1.10.3/test/litest-device-wacom-touch.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wacom-touch.c 2015-07-28 22:12:38.000000000 +0000 @@ -0,0 +1,99 @@ +/* + * Copyright © 2013 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include "litest.h" +#include "litest-int.h" + +static void +litest_wacom_touch_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_WACOM_TOUCH); + litest_set_current_device(d); +} + +static struct input_event down[] = { + { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 }, + { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, + { .type = -1, .code = -1 }, +}; + +static struct input_event move[] = { + { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_KEY, .code = BTN_TOUCH, .value = 1 }, + { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, + { .type = -1, .code = -1 }, +}; + +static struct litest_device_interface interface = { + .touch_down_events = down, + .touch_move_events = move, +}; + +static struct input_absinfo absinfo[] = { + { ABS_X, 0, 2776, 0, 0, 10 }, + { ABS_Y, 0, 1569, 0, 0, 9 }, + { ABS_MT_SLOT, 0, 1, 0, 0, 0 }, + { ABS_MT_POSITION_X, 0, 2776, 0, 0, 10 }, + { ABS_MT_POSITION_Y, 0, 1569, 0, 0, 9 }, + { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, + { .value = -1 }, +}; + +static struct input_id input_id = { + .bustype = 0x3, + .vendor = 0x56a, + .product = 0xe6, +}; + +static int events[] = { + EV_KEY, BTN_TOUCH, + INPUT_PROP_MAX, INPUT_PROP_DIRECT, + -1, -1, +}; + +struct litest_test_device litest_wacom_touch_device = { + .type = LITEST_WACOM_TOUCH, + .features = LITEST_TOUCH, + .shortname = "wacom-touch", + .setup = litest_wacom_touch_setup, + .interface = &interface, + + .name = "Wacom ISDv4 E6 Finger", + .id = &input_id, + .events = events, + .absinfo = absinfo, +}; diff -Nru libinput-1.10.3/test/litest-device-waltop-tablet.c libinput-0.21.0/test/litest-device-waltop-tablet.c --- libinput-1.10.3/test/litest-device-waltop-tablet.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-waltop-tablet.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,243 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_event proximity_in[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event proximity_out[] = { - { .type = EV_ABS, .code = ABS_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_Y, .value = 0 }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = 0 }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = 0 }, - { .type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0 }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static struct input_event motion[] = { - { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_PRESSURE, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_X, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_ABS, .code = ABS_TILT_Y, .value = LITEST_AUTO_ASSIGN }, - { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, - { .type = -1, .code = -1 }, -}; - -static int -get_axis_default(struct litest_device *d, unsigned int evcode, int32_t *value) -{ - switch (evcode) { - case ABS_TILT_X: - case ABS_TILT_Y: - *value = 0; - return 0; - case ABS_PRESSURE: - *value = 100; - return 0; - } - return 1; -} - -static struct litest_device_interface interface = { - .tablet_proximity_in_events = proximity_in, - .tablet_proximity_out_events = proximity_out, - .tablet_motion_events = motion, - - .get_axis_default = get_axis_default, -}; - -static struct input_absinfo absinfo[] = { - { ABS_X, 0, 32000, 0, 0, 0 }, - { ABS_Y, 0, 32000, 0, 0, 0 }, - { ABS_PRESSURE, 0, 2047, 0, 0, 0 }, - { ABS_TILT_X, -127, 127, 0, 0, 0 }, - { ABS_TILT_Y, -127, 127, 0, 0, 0 }, - { .value = -1 }, -}; - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x172f, - .product = 0x509, -}; - -static int events[] = { - EV_KEY, KEY_ESC, - EV_KEY, KEY_1, - EV_KEY, KEY_2, - EV_KEY, KEY_3, - EV_KEY, KEY_4, - EV_KEY, KEY_5, - EV_KEY, KEY_6, - EV_KEY, KEY_7, - EV_KEY, KEY_8, - EV_KEY, KEY_9, - EV_KEY, KEY_0, - EV_KEY, KEY_MINUS, - EV_KEY, KEY_EQUAL, - EV_KEY, KEY_BACKSPACE, - EV_KEY, KEY_TAB, - EV_KEY, KEY_Q, - EV_KEY, KEY_W, - EV_KEY, KEY_E, - EV_KEY, KEY_R, - EV_KEY, KEY_T, - EV_KEY, KEY_Y, - EV_KEY, KEY_U, - EV_KEY, KEY_I, - EV_KEY, KEY_O, - EV_KEY, KEY_P, - EV_KEY, KEY_LEFTBRACE, - EV_KEY, KEY_RIGHTBRACE, - EV_KEY, KEY_ENTER, - EV_KEY, KEY_LEFTCTRL, - EV_KEY, KEY_A, - EV_KEY, KEY_S, - EV_KEY, KEY_D, - EV_KEY, KEY_F, - EV_KEY, KEY_G, - EV_KEY, KEY_H, - EV_KEY, KEY_J, - EV_KEY, KEY_K, - EV_KEY, KEY_L, - EV_KEY, KEY_SEMICOLON, - EV_KEY, KEY_APOSTROPHE, - EV_KEY, KEY_GRAVE, - EV_KEY, KEY_LEFTSHIFT, - EV_KEY, KEY_BACKSLASH, - EV_KEY, KEY_Z, - EV_KEY, KEY_X, - EV_KEY, KEY_C, - EV_KEY, KEY_V, - EV_KEY, KEY_B, - EV_KEY, KEY_N, - EV_KEY, KEY_M, - EV_KEY, KEY_COMMA, - EV_KEY, KEY_DOT, - EV_KEY, KEY_SLASH, - EV_KEY, KEY_RIGHTSHIFT, - EV_KEY, KEY_KPASTERISK, - EV_KEY, KEY_LEFTALT, - EV_KEY, KEY_SPACE, - EV_KEY, KEY_CAPSLOCK, - EV_KEY, KEY_F1, - EV_KEY, KEY_F2, - EV_KEY, KEY_F3, - EV_KEY, KEY_F4, - EV_KEY, KEY_F5, - EV_KEY, KEY_F6, - EV_KEY, KEY_F7, - EV_KEY, KEY_F8, - EV_KEY, KEY_F9, - EV_KEY, KEY_F10, - EV_KEY, KEY_NUMLOCK, - EV_KEY, KEY_SCROLLLOCK, - EV_KEY, KEY_KP7, - EV_KEY, KEY_KP8, - EV_KEY, KEY_KP9, - EV_KEY, KEY_KPMINUS, - EV_KEY, KEY_KP4, - EV_KEY, KEY_KP5, - EV_KEY, KEY_KP6, - EV_KEY, KEY_KPPLUS, - EV_KEY, KEY_KP1, - EV_KEY, KEY_KP2, - EV_KEY, KEY_KP3, - EV_KEY, KEY_KP0, - EV_KEY, KEY_KPDOT, - EV_KEY, KEY_102ND, - EV_KEY, KEY_F11, - EV_KEY, KEY_F12, - EV_KEY, KEY_KPENTER, - EV_KEY, KEY_RIGHTCTRL, - EV_KEY, KEY_KPSLASH, - EV_KEY, KEY_SYSRQ, - EV_KEY, KEY_RIGHTALT, - EV_KEY, KEY_HOME, - EV_KEY, KEY_UP, - EV_KEY, KEY_PAGEUP, - EV_KEY, KEY_LEFT, - EV_KEY, KEY_RIGHT, - EV_KEY, KEY_END, - EV_KEY, KEY_DOWN, - EV_KEY, KEY_PAGEDOWN, - EV_KEY, KEY_INSERT, - EV_KEY, KEY_DELETE, - EV_KEY, KEY_MUTE, - EV_KEY, KEY_VOLUMEDOWN, - EV_KEY, KEY_VOLUMEUP, - EV_KEY, KEY_PAUSE, - EV_KEY, KEY_LEFTMETA, - EV_KEY, KEY_RIGHTMETA, - EV_KEY, KEY_COMPOSE, - EV_KEY, BTN_0, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_KEY, BTN_MIDDLE, - EV_KEY, BTN_SIDE, - EV_KEY, BTN_EXTRA, - EV_KEY, BTN_TOOL_PEN, - EV_KEY, BTN_TOOL_RUBBER, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_STYLUS, - EV_REL, REL_HWHEEL, - EV_REL, REL_WHEEL, - EV_MSC, MSC_SERIAL, - -1, -1, -}; - -static const char udev_rule[] = -"ACTION==\"remove\", GOTO=\"waltop_end\"\n" -"KERNEL!=\"event*\", GOTO=\"waltop_end\"\n" -"ENV{ID_INPUT_TABLET}==\"\", GOTO=\"waltop_end\"\n" -"\n" -"ATTRS{name}==\"litest WALTOP Batteryless Tablet*\",\\\n" -" ENV{LIBINPUT_ATTR_SIZE_HINT}=\"200x200\"\n" -"\n" -"LABEL=\"waltop_end\""; - -TEST_DEVICE("waltop-tablet", - .type = LITEST_WALTOP, - .features = LITEST_TABLET | LITEST_WHEEL | LITEST_TILT, - .interface = &interface, - - .name = " WALTOP Batteryless Tablet ", /* sic */ - .id = &input_id, - .events = events, - .absinfo = absinfo, - .udev_rule = udev_rule, -) diff -Nru libinput-1.10.3/test/litest-device-wheel-only.c libinput-0.21.0/test/litest-device-wheel-only.c --- libinput-1.10.3/test/litest-device-wheel-only.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-wheel-only.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,11 +21,19 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" +static void litest_wheel_only_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_WHEEL_ONLY); + litest_set_current_device(d); +} + static struct input_id input_id = { .bustype = 0x3, .vendor = 0x1, @@ -46,9 +54,11 @@ "\n" "LABEL=\"wheel_only_end\""; -TEST_DEVICE("wheel-only", +struct litest_test_device litest_wheel_only_device = { .type = LITEST_WHEEL_ONLY, .features = LITEST_WHEEL, + .shortname = "wheel only", + .setup = litest_wheel_only_setup, .interface = NULL, .name = "wheel only device", @@ -56,4 +66,4 @@ .absinfo = NULL, .events = events, .udev_rule = udev_rule, -) +}; diff -Nru libinput-1.10.3/test/litest-device-xen-virtual-pointer.c libinput-0.21.0/test/litest-device-xen-virtual-pointer.c --- libinput-1.10.3/test/litest-device-xen-virtual-pointer.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-xen-virtual-pointer.c 2015-07-28 22:12:38.000000000 +0000 @@ -21,12 +21,21 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include "litest.h" #include "litest-int.h" #include +static void +litest_xen_virtual_pointer_touch_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_XEN_VIRTUAL_POINTER); + litest_set_current_device(d); +} + static void touch_down(struct litest_device *d, unsigned int slot, double x, double y) { @@ -84,13 +93,15 @@ -1, -1, }; -TEST_DEVICE("xen-pointer", +struct litest_test_device litest_xen_virtual_pointer_device = { .type = LITEST_XEN_VIRTUAL_POINTER, .features = LITEST_WHEEL | LITEST_BUTTON | LITEST_ABSOLUTE, + .shortname = "xen pointer", + .setup = litest_xen_virtual_pointer_touch_setup, .interface = &interface, .name = "Xen Virtual Pointer", .id = &input_id, .events = events, .absinfo = absinfo, -) +}; diff -Nru libinput-1.10.3/test/litest-device-yubikey.c libinput-0.21.0/test/litest-device-yubikey.c --- libinput-1.10.3/test/litest-device-yubikey.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-device-yubikey.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,159 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include "litest.h" -#include "litest-int.h" - -static struct input_id input_id = { - .bustype = 0x3, - .vendor = 0x1050, - .product = 0x10, -}; - -static int events[] = { - EV_KEY, KEY_ESC, - EV_KEY, KEY_1, - EV_KEY, KEY_2, - EV_KEY, KEY_3, - EV_KEY, KEY_4, - EV_KEY, KEY_5, - EV_KEY, KEY_6, - EV_KEY, KEY_7, - EV_KEY, KEY_8, - EV_KEY, KEY_9, - EV_KEY, KEY_0, - EV_KEY, KEY_MINUS, - EV_KEY, KEY_EQUAL, - EV_KEY, KEY_BACKSPACE, - EV_KEY, KEY_TAB, - EV_KEY, KEY_Q, - EV_KEY, KEY_W, - EV_KEY, KEY_E, - EV_KEY, KEY_R, - EV_KEY, KEY_T, - EV_KEY, KEY_Y, - EV_KEY, KEY_U, - EV_KEY, KEY_I, - EV_KEY, KEY_O, - EV_KEY, KEY_P, - EV_KEY, KEY_LEFTBRACE, - EV_KEY, KEY_RIGHTBRACE, - EV_KEY, KEY_ENTER, - EV_KEY, KEY_LEFTCTRL, - EV_KEY, KEY_A, - EV_KEY, KEY_S, - EV_KEY, KEY_D, - EV_KEY, KEY_F, - EV_KEY, KEY_G, - EV_KEY, KEY_H, - EV_KEY, KEY_J, - EV_KEY, KEY_K, - EV_KEY, KEY_L, - EV_KEY, KEY_SEMICOLON, - EV_KEY, KEY_APOSTROPHE, - EV_KEY, KEY_GRAVE, - EV_KEY, KEY_LEFTSHIFT, - EV_KEY, KEY_BACKSLASH, - EV_KEY, KEY_Z, - EV_KEY, KEY_X, - EV_KEY, KEY_C, - EV_KEY, KEY_V, - EV_KEY, KEY_B, - EV_KEY, KEY_N, - EV_KEY, KEY_M, - EV_KEY, KEY_COMMA, - EV_KEY, KEY_DOT, - EV_KEY, KEY_SLASH, - EV_KEY, KEY_RIGHTSHIFT, - EV_KEY, KEY_KPASTERISK, - EV_KEY, KEY_LEFTALT, - EV_KEY, KEY_SPACE, - EV_KEY, KEY_CAPSLOCK, - EV_KEY, KEY_F1, - EV_KEY, KEY_F2, - EV_KEY, KEY_F3, - EV_KEY, KEY_F4, - EV_KEY, KEY_F5, - EV_KEY, KEY_F6, - EV_KEY, KEY_F7, - EV_KEY, KEY_F8, - EV_KEY, KEY_F9, - EV_KEY, KEY_F10, - EV_KEY, KEY_NUMLOCK, - EV_KEY, KEY_SCROLLLOCK, - EV_KEY, KEY_KP7, - EV_KEY, KEY_KP8, - EV_KEY, KEY_KP9, - EV_KEY, KEY_KPMINUS, - EV_KEY, KEY_KP4, - EV_KEY, KEY_KP5, - EV_KEY, KEY_KP6, - EV_KEY, KEY_KPPLUS, - EV_KEY, KEY_KP1, - EV_KEY, KEY_KP2, - EV_KEY, KEY_KP3, - EV_KEY, KEY_KP0, - EV_KEY, KEY_KPDOT, - EV_KEY, KEY_102ND, - EV_KEY, KEY_F11, - EV_KEY, KEY_F12, - EV_KEY, KEY_KPENTER, - EV_KEY, KEY_RIGHTCTRL, - EV_KEY, KEY_KPSLASH, - EV_KEY, KEY_SYSRQ, - EV_KEY, KEY_RIGHTALT, - EV_KEY, KEY_HOME, - EV_KEY, KEY_UP, - EV_KEY, KEY_PAGEUP, - EV_KEY, KEY_LEFT, - EV_KEY, KEY_RIGHT, - EV_KEY, KEY_END, - EV_KEY, KEY_DOWN, - EV_KEY, KEY_PAGEDOWN, - EV_KEY, KEY_INSERT, - EV_KEY, KEY_DELETE, - EV_KEY, KEY_PAUSE, - EV_KEY, KEY_LEFTMETA, - EV_KEY, KEY_RIGHTMETA, - EV_KEY, KEY_COMPOSE, - - EV_LED, LED_NUML, - EV_LED, LED_CAPSL, - EV_LED, LED_SCROLLL, - EV_LED, LED_COMPOSE, - EV_LED, LED_KANA, - -1, -1, -}; - -TEST_DEVICE("yubikey", - .type = LITEST_YUBIKEY, - .features = LITEST_KEYS, - .interface = NULL, - - .name = "Yubico Yubico Yubikey II", - .id = &input_id, - .events = events, - .absinfo = NULL, -) diff -Nru libinput-1.10.3/test/litest.h libinput-0.21.0/test/litest.h --- libinput-1.10.3/test/litest.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest.h 2015-08-03 04:35:00.000000000 +0000 @@ -21,85 +21,20 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #ifndef LITEST_H #define LITEST_H #include -#include #include #include #include #include #include -#include "libinput-util.h" - -struct test_device { - const char *name; - struct litest_test_device *device; -} __attribute__((aligned(16))); - -#define TEST_DEVICE(name, ...) \ - static struct litest_test_device _device; \ - \ - static void _setup(void) { \ - struct litest_device *d = litest_create_device(_device.type); \ - litest_set_current_device(d); \ - } \ - \ - static const struct test_device _test_device \ - __attribute__ ((used)) \ - __attribute__ ((section ("test_section"))) = { \ - name, &_device \ - }; \ - static struct litest_test_device _device = { \ - .setup = _setup, \ - .shortname = name, \ - __VA_ARGS__ \ - }; - -extern void litest_setup_tests_udev(void); -extern void litest_setup_tests_path(void); -extern void litest_setup_tests_pointer(void); -extern void litest_setup_tests_touch(void); -extern void litest_setup_tests_log(void); -extern void litest_setup_tests_tablet(void); -extern void litest_setup_tests_pad(void); -extern void litest_setup_tests_touchpad(void); -extern void litest_setup_tests_touchpad_tap(void); -extern void litest_setup_tests_touchpad_buttons(void); -extern void litest_setup_tests_trackpoint(void); -extern void litest_setup_tests_trackball(void); -extern void litest_setup_tests_misc(void); -extern void litest_setup_tests_keyboard(void); -extern void litest_setup_tests_device(void); -extern void litest_setup_tests_gestures(void); -extern void litest_setup_tests_lid(void); - -void -litest_fail_condition(const char *file, - int line, - const char *func, - const char *condition, - const char *message, - ...); -void -litest_fail_comparison_int(const char *file, - int line, - const char *func, - const char *operator, - int a, - int b, - const char *astr, - const char *bstr); -void -litest_fail_comparison_ptr(const char *file, - int line, - const char *func, - const char *comparison); - #define litest_assert(cond) \ do { \ if (!(cond)) \ @@ -176,101 +111,37 @@ #define litest_assert_ptr_notnull(a_) \ litest_assert_comparison_ptr_(a_, !=, NULL) -#define litest_assert_double_eq(a_, b_)\ - ck_assert_int_eq((int)((a_) * 256), (int)((b_) * 256)) - -#define litest_assert_double_ne(a_, b_)\ - ck_assert_int_ne((int)((a_) * 256), (int)((b_) * 256)) - -#define litest_assert_double_lt(a_, b_)\ - ck_assert_int_lt((int)((a_) * 256), (int)((b_) * 256)) - -#define litest_assert_double_le(a_, b_)\ - ck_assert_int_le((int)((a_) * 256), (int)((b_) * 256)) - -#define litest_assert_double_gt(a_, b_)\ - ck_assert_int_gt((int)((a_) * 256), (int)((b_) * 256)) - -#define litest_assert_double_ge(a_, b_)\ - ck_assert_int_ge((int)((a_) * 256), (int)((b_) * 256)) - enum litest_device_type { LITEST_NO_DEVICE = -1, - LITEST_SYNAPTICS_CLICKPAD_X220 = -1000, - LITEST_SYNAPTICS_TOUCHPAD, - LITEST_SYNAPTICS_TOPBUTTONPAD, - LITEST_BCM5974, - LITEST_KEYBOARD, - LITEST_TRACKPOINT, - LITEST_MOUSE, - LITEST_WACOM_TOUCH, - LITEST_ALPS_SEMI_MT, - LITEST_GENERIC_SINGLETOUCH, - LITEST_MS_SURFACE_COVER, - LITEST_QEMU_TABLET, - LITEST_XEN_VIRTUAL_POINTER, - LITEST_VMWARE_VIRTMOUSE, - LITEST_SYNAPTICS_HOVER_SEMI_MT, - LITEST_SYNAPTICS_TRACKPOINT_BUTTONS, - LITEST_PROTOCOL_A_SCREEN, - LITEST_WACOM_FINGER, - LITEST_KEYBOARD_BLACKWIDOW, - LITEST_WHEEL_ONLY, - LITEST_MOUSE_ROCCAT, - LITEST_LOGITECH_TRACKBALL, - LITEST_ATMEL_HOVER, - LITEST_ALPS_DUALPOINT, - LITEST_MOUSE_LOW_DPI, - LITEST_GENERIC_MULTITOUCH_SCREEN, - LITEST_NEXUS4_TOUCH_SCREEN, - LITEST_MAGIC_TRACKPAD, - LITEST_ELANTECH_TOUCHPAD, - LITEST_MOUSE_GLADIUS, - LITEST_MOUSE_WHEEL_CLICK_ANGLE, - LITEST_APPLE_KEYBOARD, - LITEST_ANKER_MOUSE_KBD, - LITEST_WACOM_BAMBOO, - LITEST_WACOM_CINTIQ, - LITEST_WACOM_INTUOS, - LITEST_WACOM_ISDV4, - LITEST_WALTOP, - LITEST_HUION_TABLET, - LITEST_CYBORG_RAT, - LITEST_YUBIKEY, - LITEST_SYNAPTICS_I2C, - LITEST_WACOM_CINTIQ_24HD, - LITEST_MULTITOUCH_FUZZ_SCREEN, - LITEST_WACOM_INTUOS3_PAD, - LITEST_WACOM_INTUOS5_PAD, - LITEST_KEYBOARD_ALL_CODES, - LITEST_MAGICMOUSE, - LITEST_WACOM_EKR, - LITEST_WACOM_CINTIQ_24HDT_PAD, - LITEST_WACOM_CINTIQ_13HDT_PEN, - LITEST_WACOM_CINTIQ_13HDT_PAD, - LITEST_WACOM_CINTIQ_13HDT_FINGER, - LITEST_WACOM_HID4800_PEN, - LITEST_MOUSE_WHEEL_CLICK_COUNT, - LITEST_CALIBRATED_TOUCHSCREEN, - LITEST_ACER_HAWAII_KEYBOARD, - LITEST_ACER_HAWAII_TOUCHPAD, - LITEST_SYNAPTICS_RMI4, - LITEST_MOUSE_WHEEL_TILT, - LITEST_LID_SWITCH, - LITEST_LID_SWITCH_SURFACE3, - LITEST_APPLETOUCH, - LITEST_GPIO_KEYS, - LITEST_IGNORED_MOUSE, - LITEST_WACOM_MOBILESTUDIO_PRO_16_PAD, - LITEST_THINKPAD_EXTRABUTTONS, - LITEST_UCLOGIC_TABLET, - LITEST_KEYBOARD_BLADE_STEALTH, - LITEST_KEYBOARD_BLADE_STEALTH_VIDEOSWITCH, - LITEST_WACOM_BAMBOO_2FG_PAD, - LITEST_WACOM_BAMBOO_2FG_PEN, - LITEST_WACOM_BAMBOO_2FG_FINGER, - LITEST_HP_WMI_HOTKEYS, - LITEST_MS_NANO_TRANSCEIVER_MOUSE, + LITEST_SYNAPTICS_CLICKPAD = -2, + LITEST_SYNAPTICS_TOUCHPAD = -3, + LITEST_SYNAPTICS_TOPBUTTONPAD = -4, + LITEST_BCM5974 = -5, + LITEST_KEYBOARD = -6, + LITEST_TRACKPOINT = -7, + LITEST_MOUSE = -8, + LITEST_WACOM_TOUCH = -9, + LITEST_ALPS_SEMI_MT = -10, + LITEST_GENERIC_SINGLETOUCH = -11, + LITEST_MS_SURFACE_COVER = -12, + LITEST_QEMU_TABLET = -13, + LITEST_XEN_VIRTUAL_POINTER = -14, + LITEST_VMWARE_VIRTMOUSE = -15, + LITEST_SYNAPTICS_HOVER_SEMI_MT = -16, + LITEST_SYNAPTICS_TRACKPOINT_BUTTONS = -17, + LITEST_PROTOCOL_A_SCREEN = -18, + LITEST_WACOM_FINGER = -19, + LITEST_KEYBOARD_BLACKWIDOW = -20, + LITEST_WHEEL_ONLY = -21, + LITEST_MOUSE_ROCCAT = -22, + LITEST_LOGITECH_TRACKBALL = -23, + LITEST_ATMEL_HOVER = -24, + LITEST_ALPS_DUALPOINT = -25, + LITEST_MOUSE_LOW_DPI = -26, + LITEST_GENERIC_MULTITOUCH_SCREEN = -27, + LITEST_NEXUS4_TOUCH_SCREEN = -28, + LITEST_MAGIC_TRACKPAD = -29, + LITEST_ELANTECH_TOUCHPAD = -30, }; enum litest_device_feature { @@ -293,35 +164,6 @@ LITEST_PROTOCOL_A = 1 << 14, LITEST_HOVER = 1 << 15, LITEST_ELLIPSE = 1 << 16, - LITEST_TABLET = 1 << 17, - LITEST_DISTANCE = 1 << 18, - LITEST_TOOL_SERIAL = 1 << 19, - LITEST_TILT = 1 << 20, - LITEST_TABLET_PAD = 1 << 21, - LITEST_RING = 1 << 22, - LITEST_STRIP = 1 << 23, - LITEST_TRACKBALL = 1 << 24, - LITEST_LEDS = 1 << 25, - LITEST_SWITCH = 1 << 26, - LITEST_IGNORED = 1 << 27, - LITEST_NO_DEBOUNCE = 1 << 28, -}; - -/* this is a semi-mt device, so we keep track of the touches that the tests - * send and modify them so that the first touch is always slot 0 and sends - * the top-left of the bounding box, the second is always slot 1 and sends - * the bottom-right of the bounding box. - * Lifting any of two fingers terminates slot 1 - */ -struct litest_semi_mt { - bool is_semi_mt; - - int tracking_id; - /* The actual touches requested by the test for the two slots - * in the 0..100 range used by litest */ - struct { - double x, y; - } touches[2]; }; struct litest_device { @@ -333,46 +175,18 @@ struct litest_device_interface *interface; int ntouches_down; - int skip_ev_syn; - struct litest_semi_mt semi_mt; /** only used for semi-mt device */ + bool skip_ev_syn; void *private; /* device-specific data */ + + char *udev_rule_file; }; struct axis_replacement { int32_t evcode; - double value; + int32_t value; }; -/** - * Same as litest_axis_set_value but allows for ranges outside 0..100% - */ -static inline void -litest_axis_set_value_unchecked(struct axis_replacement *axes, int code, double value) -{ - while (axes->evcode != -1) { - if (axes->evcode == code) { - axes->value = value; - return; - } - axes++; - } - - litest_abort_msg("Missing axis code %d\n", code); -} - -/** - * Takes a value in percent and sets the given axis to that code. - */ -static inline void -litest_axis_set_value(struct axis_replacement *axes, int code, double value) -{ - litest_assert_double_ge(value, 0.0); - litest_assert_double_le(value, 100.0); - - litest_axis_set_value_unchecked(axes, code, value); -} - /* A loop range, resolves to: for (i = lower; i < upper; i++) */ @@ -384,7 +198,28 @@ struct libinput *litest_create_context(void); void litest_disable_log_handler(struct libinput *libinput); void litest_restore_log_handler(struct libinput *libinput); -void litest_set_log_handler_bug(struct libinput *libinput); + +void +litest_fail_condition(const char *file, + int line, + const char *func, + const char *condition, + const char *message, + ...); +void +litest_fail_comparison_int(const char *file, + int line, + const char *func, + const char *operator, + int a, + int b, + const char *astr, + const char *bstr); +void +litest_fail_comparison_ptr(const char *file, + int line, + const char *func, + const char *comparison); #define litest_add(name_, func_, ...) \ _litest_add(name_, #func_, func_, __VA_ARGS__) @@ -398,59 +233,44 @@ _litest_add_no_device(name_, #func_, func_) #define litest_add_ranged_no_device(name_, func_, ...) \ _litest_add_ranged_no_device(name_, #func_, func_, __VA_ARGS__) -void -_litest_add(const char *name, - const char *funcname, - void *func, - enum litest_device_feature required_feature, - enum litest_device_feature excluded_feature); -void -_litest_add_ranged(const char *name, - const char *funcname, - void *func, - enum litest_device_feature required, - enum litest_device_feature excluded, - const struct range *range); -void -_litest_add_for_device(const char *name, - const char *funcname, - void *func, - enum litest_device_type type); -void -_litest_add_ranged_for_device(const char *name, - const char *funcname, - void *func, - enum litest_device_type type, - const struct range *range); -void -_litest_add_no_device(const char *name, - const char *funcname, - void *func); -void -_litest_add_ranged_no_device(const char *name, - const char *funcname, - void *func, - const struct range *range); - -struct litest_device * -litest_create_device(enum litest_device_type which); - -struct litest_device * -litest_add_device(struct libinput *libinput, - enum litest_device_type which); +void _litest_add(const char *name, + const char *funcname, + void *func, + enum litest_device_feature required_feature, + enum litest_device_feature excluded_feature); +void _litest_add_ranged(const char *name, + const char *funcname, + void *func, + enum litest_device_feature required, + enum litest_device_feature excluded, + const struct range *range); +void _litest_add_for_device(const char *name, + const char *funcname, + void *func, + enum litest_device_type type); +void _litest_add_ranged_for_device(const char *name, + const char *funcname, + void *func, + enum litest_device_type type, + const struct range *range); +void _litest_add_no_device(const char *name, + const char *funcname, + void *func); +void _litest_add_ranged_no_device(const char *name, + const char *funcname, + void *func, + const struct range *range); + +extern void litest_setup_tests(void); +struct litest_device * litest_create_device(enum litest_device_type which); +struct litest_device * litest_add_device(struct libinput *libinput, + enum litest_device_type which); struct libevdev_uinput * litest_create_uinput_device_from_description(const char *name, const struct input_id *id, const struct input_absinfo *abs, const int *events); struct litest_device * -litest_create(enum litest_device_type which, - const char *name_override, - struct input_id *id_override, - const struct input_absinfo *abs_override, - const int *events_override); - -struct litest_device * litest_create_device_with_overrides(enum litest_device_type which, const char *name_override, struct input_id *id_override, @@ -464,352 +284,165 @@ const struct input_absinfo *abs_override, const int *events_override); -struct litest_device * -litest_current_device(void); - -void -litest_delete_device(struct litest_device *d); - -void -litest_event(struct litest_device *t, - unsigned int type, - unsigned int code, - int value); -int -litest_auto_assign_value(struct litest_device *d, - const struct input_event *ev, - int slot, double x, double y, - struct axis_replacement *axes, - bool touching); -void -litest_touch_up(struct litest_device *d, unsigned int slot); - -void -litest_touch_move(struct litest_device *d, - unsigned int slot, - double x, - double y); - -void -litest_touch_move_extended(struct litest_device *d, - unsigned int slot, - double x, - double y, - struct axis_replacement *axes); - -void -litest_touch_down(struct litest_device *d, - unsigned int slot, - double x, - double y); - -void -litest_touch_down_extended(struct litest_device *d, - unsigned int slot, - double x, - double y, - struct axis_replacement *axes); - -void -litest_touch_move_to(struct litest_device *d, - unsigned int slot, - double x_from, double y_from, - double x_to, double y_to, - int steps, int sleep_ms); - -void -litest_touch_move_to_extended(struct litest_device *d, - unsigned int slot, - double x_from, double y_from, - double x_to, double y_to, - struct axis_replacement *axes, - int steps, int sleep_ms); - -void -litest_touch_move_two_touches(struct litest_device *d, - double x0, double y0, - double x1, double y1, - double dx, double dy, - int steps, int sleep_ms); - -void -litest_touch_move_three_touches(struct litest_device *d, - double x0, double y0, - double x1, double y1, - double x2, double y2, - double dx, double dy, - int steps, int sleep_ms); - -void -litest_tablet_proximity_in(struct litest_device *d, - int x, int y, - struct axis_replacement *axes); - -void -litest_tablet_proximity_out(struct litest_device *d); - -void -litest_tablet_motion(struct litest_device *d, - int x, int y, - struct axis_replacement *axes); - -void -litest_pad_ring_start(struct litest_device *d, double value); - -void -litest_pad_ring_change(struct litest_device *d, double value); - -void -litest_pad_ring_end(struct litest_device *d); - -void -litest_pad_strip_start(struct litest_device *d, double value); - -void -litest_pad_strip_change(struct litest_device *d, double value); - -void -litest_pad_strip_end(struct litest_device *d); - -void -litest_hover_start(struct litest_device *d, - unsigned int slot, - double x, - double y); - -void -litest_hover_end(struct litest_device *d, unsigned int slot); - +struct litest_device *litest_current_device(void); +void litest_delete_device(struct litest_device *d); +int litest_handle_events(struct litest_device *d); + +void litest_event(struct litest_device *t, + unsigned int type, + unsigned int code, + int value); +int litest_auto_assign_value(struct litest_device *d, + const struct input_event *ev, + int slot, double x, double y, + struct axis_replacement *axes, + bool touching); +void litest_touch_up(struct litest_device *d, unsigned int slot); +void litest_touch_move(struct litest_device *d, + unsigned int slot, + double x, + double y); +void litest_touch_move_extended(struct litest_device *d, + unsigned int slot, + double x, + double y, + struct axis_replacement *axes); +void litest_touch_down(struct litest_device *d, + unsigned int slot, + double x, + double y); +void litest_touch_down_extended(struct litest_device *d, + unsigned int slot, + double x, + double y, + struct axis_replacement *axes); +void litest_touch_move_to(struct litest_device *d, + unsigned int slot, + double x_from, double y_from, + double x_to, double y_to, + int steps, int sleep_ms); +void litest_touch_move_two_touches(struct litest_device *d, + double x0, double y0, + double x1, double y1, + double dx, double dy, + int steps, int sleep_ms); +void litest_touch_move_three_touches(struct litest_device *d, + double x0, double y0, + double x1, double y1, + double x2, double y2, + double dx, double dy, + int steps, int sleep_ms); +void litest_hover_start(struct litest_device *d, + unsigned int slot, + double x, + double y); +void litest_hover_end(struct litest_device *d, unsigned int slot); void litest_hover_move(struct litest_device *d, unsigned int slot, double x, double y); - -void -litest_hover_move_to(struct litest_device *d, - unsigned int slot, - double x_from, double y_from, - double x_to, double y_to, - int steps, int sleep_ms); - -void -litest_hover_move_two_touches(struct litest_device *d, - double x0, double y0, - double x1, double y1, - double dx, double dy, - int steps, int sleep_ms); - -void -litest_button_click_debounced(struct litest_device *d, - struct libinput *li, - unsigned int button, - bool is_press); - -void -litest_button_click(struct litest_device *d, - unsigned int button, - bool is_press); - -void -litest_button_scroll(struct litest_device *d, - unsigned int button, - double dx, double dy); - -void -litest_keyboard_key(struct litest_device *d, - unsigned int key, - bool is_press); - -void litest_switch_action(struct litest_device *d, - enum libinput_switch sw, - enum libinput_switch_state state); - -void -litest_wait_for_event(struct libinput *li); - -void -litest_wait_for_event_of_type(struct libinput *li, ...); - -void -litest_drain_events(struct libinput *li); - -void -litest_assert_event_type(struct libinput_event *event, - enum libinput_event_type want); - -void -litest_assert_empty_queue(struct libinput *li); - -void -litest_assert_touch_sequence(struct libinput *li); - -struct libinput_event_pointer * -litest_is_button_event(struct libinput_event *event, +void litest_hover_move_to(struct litest_device *d, + unsigned int slot, + double x_from, double y_from, + double x_to, double y_to, + int steps, int sleep_ms); +void litest_hover_move_two_touches(struct litest_device *d, + double x0, double y0, + double x1, double y1, + double dx, double dy, + int steps, int sleep_ms); +void litest_button_click(struct litest_device *d, + unsigned int button, + bool is_press); +void litest_button_scroll(struct litest_device *d, + unsigned int button, + double dx, double dy); +void litest_keyboard_key(struct litest_device *d, + unsigned int key, + bool is_press); +void litest_wait_for_event(struct libinput *li); +void litest_wait_for_event_of_type(struct libinput *li, ...); +void litest_drain_events(struct libinput *li); +void litest_assert_empty_queue(struct libinput *li); +struct libinput_event_pointer * litest_is_button_event( + struct libinput_event *event, unsigned int button, enum libinput_button_state state); - -struct libinput_event_pointer * -litest_is_axis_event(struct libinput_event *event, - enum libinput_pointer_axis axis, - enum libinput_pointer_axis_source source); - -struct libinput_event_pointer * -litest_is_motion_event(struct libinput_event *event); - -struct libinput_event_touch * -litest_is_touch_event(struct libinput_event *event, - enum libinput_event_type type); - -struct libinput_event_keyboard * -litest_is_keyboard_event(struct libinput_event *event, - unsigned int key, - enum libinput_key_state state); - -struct libinput_event_gesture * -litest_is_gesture_event(struct libinput_event *event, - enum libinput_event_type type, - int nfingers); - -struct libinput_event_tablet_tool * -litest_is_tablet_event(struct libinput_event *event, +struct libinput_event_pointer * litest_is_axis_event( + struct libinput_event *event, + enum libinput_pointer_axis axis, + enum libinput_pointer_axis_source source); +struct libinput_event_pointer * litest_is_motion_event( + struct libinput_event *event); +struct libinput_event_touch * litest_is_touch_event( + struct libinput_event *event, enum libinput_event_type type); +struct libinput_event_keyboard * litest_is_keyboard_event( + struct libinput_event *event, + unsigned int key, + enum libinput_key_state state); +struct libinput_event_gesture * litest_is_gesture_event( + struct libinput_event *event, + enum libinput_event_type type, + int nfingers); + +void litest_assert_button_event(struct libinput *li, + unsigned int button, + enum libinput_button_state state); +void litest_assert_scroll(struct libinput *li, + enum libinput_pointer_axis axis, + int minimum_movement); +void litest_assert_only_typed_events(struct libinput *li, + enum libinput_event_type type); + +struct libevdev_uinput * litest_create_uinput_device(const char *name, + struct input_id *id, + ...); +struct libevdev_uinput * litest_create_uinput_abs_device(const char *name, + struct input_id *id, + const struct input_absinfo *abs, + ...); + +void litest_timeout_tap(void); +void litest_timeout_tapndrag(void); +void litest_timeout_softbuttons(void); +void litest_timeout_buttonscroll(void); +void litest_timeout_edgescroll(void); +void litest_timeout_finger_switch(void); +void litest_timeout_middlebutton(void); +void litest_timeout_dwt_short(void); +void litest_timeout_dwt_long(void); +void litest_timeout_gesture(void); -struct libinput_event_tablet_pad * -litest_is_pad_button_event(struct libinput_event *event, - unsigned int button, - enum libinput_button_state state); -struct libinput_event_tablet_pad * -litest_is_pad_ring_event(struct libinput_event *event, - unsigned int number, - enum libinput_tablet_pad_ring_axis_source source); -struct libinput_event_tablet_pad * -litest_is_pad_strip_event(struct libinput_event *event, - unsigned int number, - enum libinput_tablet_pad_strip_axis_source source); - -struct libinput_event_switch * -litest_is_switch_event(struct libinput_event *event, - enum libinput_switch sw, - enum libinput_switch_state state); - -void -litest_assert_key_event(struct libinput *li, unsigned int key, - enum libinput_key_state state); - -void -litest_assert_button_event(struct libinput *li, - unsigned int button, - enum libinput_button_state state); - -void -litest_assert_scroll(struct libinput *li, - enum libinput_pointer_axis axis, - int minimum_movement); - -void -litest_assert_only_typed_events(struct libinput *li, - enum libinput_event_type type); - -void -litest_assert_tablet_button_event(struct libinput *li, - unsigned int button, - enum libinput_button_state state); - -void -litest_assert_tablet_proximity_event(struct libinput *li, - enum libinput_tablet_tool_proximity_state state); - -void -litest_assert_pad_button_event(struct libinput *li, - unsigned int button, - enum libinput_button_state state); -struct libevdev_uinput * -litest_create_uinput_device(const char *name, - struct input_id *id, - ...); - -struct libevdev_uinput * -litest_create_uinput_abs_device(const char *name, - struct input_id *id, - const struct input_absinfo *abs, - ...); - -void -litest_timeout_tap(void); +void litest_push_event_frame(struct litest_device *dev); +void litest_pop_event_frame(struct litest_device *dev); -void -litest_timeout_tapndrag(void); - -void -litest_timeout_debounce(void); - -void -litest_timeout_softbuttons(void); - -void -litest_timeout_buttonscroll(void); - -void -litest_timeout_edgescroll(void); - -void -litest_timeout_finger_switch(void); - -void -litest_timeout_middlebutton(void); - -void -litest_timeout_dwt_short(void); - -void -litest_timeout_dwt_long(void); - -void -litest_timeout_gesture(void); - -void -litest_timeout_gesture_scroll(void); - -void -litest_timeout_trackpoint(void); - -void -litest_timeout_tablet_proxout(void); - -void -litest_timeout_hysteresis(void); - -void -litest_push_event_frame(struct litest_device *dev); - -void -litest_pop_event_frame(struct litest_device *dev); - -void -litest_filter_event(struct litest_device *dev, - unsigned int type, - unsigned int code); - -void -litest_unfilter_event(struct litest_device *dev, - unsigned int type, - unsigned int code); -void -litest_semi_mt_touch_down(struct litest_device *d, - struct litest_semi_mt *semi_mt, - unsigned int slot, - double x, double y); - -void -litest_semi_mt_touch_move(struct litest_device *d, - struct litest_semi_mt *semi_mt, - unsigned int slot, - double x, double y); +/* this is a semi-mt device, so we keep track of the touches that the tests + * send and modify them so that the first touch is always slot 0 and sends + * the top-left of the bounding box, the second is always slot 1 and sends + * the bottom-right of the bounding box. + * Lifting any of two fingers terminates slot 1 + */ +struct litest_semi_mt { + int tracking_id; + /* The actual touches requested by the test for the two slots + * in the 0..100 range used by litest */ + struct { + double x, y; + } touches[2]; +}; -void -litest_semi_mt_touch_up(struct litest_device *d, - struct litest_semi_mt *semi_mt, - unsigned int slot); +void litest_semi_mt_touch_down(struct litest_device *d, + struct litest_semi_mt *semi_mt, + unsigned int slot, + double x, double y); +void litest_semi_mt_touch_move(struct litest_device *d, + struct litest_semi_mt *semi_mt, + unsigned int slot, + double x, double y); +void litest_semi_mt_touch_up(struct litest_device *d, + struct litest_semi_mt *semi_mt, + unsigned int slot); #ifndef ck_assert_notnull #define ck_assert_notnull(ptr) ck_assert_ptr_ne(ptr, NULL) @@ -839,41 +472,6 @@ litest_assert_int_eq(status, expected); } -static inline void -litest_set_tap_map(struct libinput_device *device, - enum libinput_config_tap_button_map map) -{ - enum libinput_config_status status, expected; - - expected = LIBINPUT_CONFIG_STATUS_SUCCESS; - status = libinput_device_config_tap_set_button_map(device, map); - litest_assert_int_eq(status, expected); -} - -static inline void -litest_enable_tap_drag(struct libinput_device *device) -{ - enum libinput_config_status status, expected; - - expected = LIBINPUT_CONFIG_STATUS_SUCCESS; - status = libinput_device_config_tap_set_drag_enabled(device, - LIBINPUT_CONFIG_DRAG_ENABLED); - - litest_assert_int_eq(status, expected); -} - -static inline void -litest_disable_tap_drag(struct libinput_device *device) -{ - enum libinput_config_status status, expected; - - expected = LIBINPUT_CONFIG_STATUS_SUCCESS; - status = libinput_device_config_tap_set_drag_enabled(device, - LIBINPUT_CONFIG_DRAG_DISABLED); - - litest_assert_int_eq(status, expected); -} - static inline bool litest_has_2fg_scroll(struct litest_device *dev) { @@ -909,15 +507,6 @@ litest_assert_int_eq(status, expected); } -static inline bool -litest_has_clickfinger(struct litest_device *dev) -{ - struct libinput_device *device = dev->libinput_device; - uint32_t methods = libinput_device_config_click_get_methods(device); - - return methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER; -} - static inline void litest_enable_clickfinger(struct litest_device *dev) { @@ -942,6 +531,16 @@ litest_assert_int_eq(status, expected); } +static inline int +litest_is_synaptics_semi_mt(struct litest_device *dev) +{ + struct libevdev *evdev = dev->evdev; + + return libevdev_has_property(evdev, INPUT_PROP_SEMI_MT) && + libevdev_get_id_vendor(evdev) == 0x2 && + libevdev_get_id_product(evdev) == 0x7; +} + static inline void litest_enable_drag_lock(struct libinput_device *device) { @@ -966,55 +565,6 @@ litest_assert_int_eq(status, expected); } -static inline void -litest_enable_middleemu(struct litest_device *dev) -{ - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status, expected; - - expected = LIBINPUT_CONFIG_STATUS_SUCCESS; - status = libinput_device_config_middle_emulation_set_enabled(device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - - litest_assert_int_eq(status, expected); -} - -static inline void -litest_disable_middleemu(struct litest_device *dev) -{ - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status, expected; - - expected = LIBINPUT_CONFIG_STATUS_SUCCESS; - status = libinput_device_config_middle_emulation_set_enabled(device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); - - litest_assert_int_eq(status, expected); -} - -static inline bool -litest_touchpad_is_external(struct litest_device *dev) -{ - struct udev_device *udev_device; - const char *prop; - bool is_external; - - udev_device = libinput_device_get_udev_device(dev->libinput_device); - prop = udev_device_get_property_value(udev_device, - "ID_INPUT_TOUCHPAD_INTEGRATION"); - is_external = prop && streq(prop, "external"); - udev_device_unref(udev_device); - - return is_external; -} - -#undef ck_assert_double_eq -#undef ck_assert_double_ne -#undef ck_assert_double_lt -#undef ck_assert_double_le -#undef ck_assert_double_gt -#undef ck_assert_double_ge - #define CK_DOUBLE_EQ_EPSILON 1E-3 #define ck_assert_double_eq(X,Y) \ do { \ diff -Nru libinput-1.10.3/test/litest-int.h libinput-0.21.0/test/litest-int.h --- libinput-1.10.3/test/litest-int.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-int.h 2015-07-28 22:12:38.000000000 +0000 @@ -21,7 +21,9 @@ * DEALINGS IN THE SOFTWARE. */ +#if HAVE_CONFIG_H #include "config.h" +#endif #include #ifndef LITEST_INT_H @@ -95,32 +97,8 @@ struct input_event *touch_move_events; struct input_event *touch_up_events; - /** - * Tablet events, LITEST_AUTO_ASSIGN is allowed on event values for - * ABS_X, ABS_Y, ABS_DISTANCE and ABS_PRESSURE. - */ - struct input_event *tablet_proximity_in_events; - struct input_event *tablet_proximity_out_events; - struct input_event *tablet_motion_events; - - /** - * Pad events, LITEST_AUTO_ASSIGN is allowed on event values - * for ABS_WHEEL - */ - struct input_event *pad_ring_start_events; - struct input_event *pad_ring_change_events; - struct input_event *pad_ring_end_events; - - /** - * Pad events, LITEST_AUTO_ASSIGN is allowed on event values - * for ABS_RX - */ - struct input_event *pad_strip_start_events; - struct input_event *pad_strip_change_events; - struct input_event *pad_strip_end_events; - - int min[2]; /* x/y axis minimum */ - int max[2]; /* x/y axis maximum */ + int min[2]; + int max[2]; }; void litest_set_current_device(struct litest_device *device); diff -Nru libinput-1.10.3/test/litest-selftest.c libinput-0.21.0/test/litest-selftest.c --- libinput-1.10.3/test/litest-selftest.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/litest-selftest.c 2015-07-28 22:12:38.000000000 +0000 @@ -169,8 +169,8 @@ int v = 10; int *a = &v; int *b = &v; - int *c = NULL; - int *d = NULL; + int c = NULL; + int d = NULL; litest_assert_ptr_eq(a, b); litest_assert_ptr_eq(c, d); diff -Nru libinput-1.10.3/test/log.c libinput-0.21.0/test/log.c --- libinput-1.10.3/test/log.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/log.c 2015-07-15 04:18:08.000000000 +0000 @@ -0,0 +1,150 @@ +/* + * Copyright © 2014 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include + +#include +#include +#include +#include +#include + +#include "litest.h" + +static int log_handler_called; +static struct libinput *log_handler_context; + +static int open_restricted(const char *path, int flags, void *data) +{ + int fd; + fd = open(path, flags); + return fd < 0 ? -errno : fd; +} +static void close_restricted(int fd, void *data) +{ + close(fd); +} + +const struct libinput_interface simple_interface = { + .open_restricted = open_restricted, + .close_restricted = close_restricted, +}; + +static void +simple_log_handler(struct libinput *libinput, + enum libinput_log_priority priority, + const char *format, + va_list args) +{ + log_handler_called++; + if (log_handler_context) + litest_assert_ptr_eq(libinput, log_handler_context); + litest_assert_notnull(format); +} + +START_TEST(log_default_priority) +{ + enum libinput_log_priority pri; + struct libinput *li; + + li = libinput_path_create_context(&simple_interface, NULL); + pri = libinput_log_get_priority(li); + + ck_assert_int_eq(pri, LIBINPUT_LOG_PRIORITY_ERROR); + + libinput_unref(li); +} +END_TEST + +START_TEST(log_handler_invoked) +{ + struct libinput *li; + + li = libinput_path_create_context(&simple_interface, NULL); + + libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_DEBUG); + libinput_log_set_handler(li, simple_log_handler); + log_handler_context = li; + + libinput_path_add_device(li, "/tmp"); + + ck_assert_int_gt(log_handler_called, 0); + log_handler_called = 0; + + libinput_unref(li); + + log_handler_context = NULL; +} +END_TEST + +START_TEST(log_handler_NULL) +{ + struct libinput *li; + + li = libinput_path_create_context(&simple_interface, NULL); + libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_DEBUG); + libinput_log_set_handler(li, NULL); + + libinput_path_add_device(li, "/tmp"); + + ck_assert_int_eq(log_handler_called, 0); + log_handler_called = 0; + + libinput_unref(li); +} +END_TEST + +START_TEST(log_priority) +{ + struct libinput *li; + + li = libinput_path_create_context(&simple_interface, NULL); + libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_ERROR); + libinput_log_set_handler(li, simple_log_handler); + log_handler_context = li; + + libinput_path_add_device(li, "/tmp"); + + ck_assert_int_eq(log_handler_called, 1); + + libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_INFO); + /* event0 is usually Lid Switch which prints an info that + we don't handle it */ + libinput_path_add_device(li, "/dev/input/event0"); + ck_assert_int_gt(log_handler_called, 1); + + log_handler_called = 0; + + libinput_unref(li); + log_handler_context = NULL; +} +END_TEST + +void +litest_setup_tests(void) +{ + litest_add_no_device("log:defaults", log_default_priority); + litest_add_no_device("log:logging", log_handler_invoked); + litest_add_no_device("log:logging", log_handler_NULL); + litest_add_no_device("log:logging", log_priority); +} diff -Nru libinput-1.10.3/test/Makefile.am libinput-0.21.0/test/Makefile.am --- libinput-1.10.3/test/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/Makefile.am 2015-08-03 03:44:47.000000000 +0000 @@ -0,0 +1,176 @@ +if BUILD_TESTS +AM_CPPFLAGS = -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + $(CHECK_CFLAGS) \ + $(LIBEVDEV_CFLAGS) \ + $(LIBUDEV_CFLAGS) + +AM_CFLAGS = $(GCC_CFLAGS) +AM_CXXFLAGS = $(GCC_CXXFLAGS) + +TEST_LIBS = liblitest.la $(CHECK_LIBS) $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS) $(top_builddir)/src/libinput.la +noinst_LTLIBRARIES = liblitest.la +liblitest_la_SOURCES = \ + litest.h \ + litest-int.h \ + litest-device-alps-semi-mt.c \ + litest-device-alps-dualpoint.c \ + litest-device-atmel-hover.c \ + litest-device-bcm5974.c \ + litest-device-elantech-touchpad.c \ + litest-device-generic-singletouch.c \ + litest-device-keyboard.c \ + litest-device-keyboard-razer-blackwidow.c \ + litest-device-logitech-trackball.c \ + litest-device-nexus4-touch-screen.c \ + litest-device-magic-trackpad.c \ + litest-device-mouse.c \ + litest-device-mouse-roccat.c \ + litest-device-mouse-low-dpi.c \ + litest-device-ms-surface-cover.c \ + litest-device-protocol-a-touch-screen.c \ + litest-device-qemu-usb-tablet.c \ + litest-device-synaptics.c \ + litest-device-synaptics-hover.c \ + litest-device-synaptics-st.c \ + litest-device-synaptics-t440.c \ + litest-device-synaptics-x1-carbon-3rd.c \ + litest-device-trackpoint.c \ + litest-device-touch-screen.c \ + litest-device-wacom-touch.c \ + litest-device-wacom-intuos-finger.c \ + litest-device-wheel-only.c \ + litest-device-xen-virtual-pointer.c \ + litest-device-vmware-virtual-usb-mouse.c \ + litest.c +liblitest_la_LIBADD = $(top_builddir)/src/libinput-util.la +liblitest_la_CFLAGS = $(AM_CFLAGS) \ + -DLIBINPUT_MODEL_QUIRKS_UDEV_RULES_FILE="\"$(abs_top_builddir)/udev/90-libinput-model-quirks-litest.rules\"" \ + -DLIBINPUT_MODEL_QUIRKS_UDEV_HWDB_FILE="\"$(abs_top_srcdir)/udev/90-libinput-model-quirks.hwdb\"" \ + -DLIBINPUT_TEST_DEVICE_RULES_FILE="\"$(abs_top_srcdir)/udev/80-libinput-test-device.rules\"" +if HAVE_LIBUNWIND +liblitest_la_LIBADD += $(LIBUNWIND_LIBS) -ldl +liblitest_la_CFLAGS += $(LIBUNWIND_CFLAGS) +endif + +run_tests = \ + test-touchpad \ + test-touchpad-tap \ + test-touchpad-buttons \ + test-device \ + test-gestures \ + test-pointer \ + test-touch \ + test-trackpoint \ + test-udev \ + test-path \ + test-log \ + test-misc \ + test-keyboard \ + test-litest-selftest + +build_tests = \ + test-build-cxx \ + test-build-linker \ + test-build-pedantic-c99 \ + test-build-std-gnuc90 + +noinst_PROGRAMS = $(build_tests) $(run_tests) +noinst_SCRIPTS = symbols-leak-test +TESTS = $(run_tests) symbols-leak-test + +.NOTPARALLEL: + +test_udev_SOURCES = udev.c +test_udev_LDADD = $(TEST_LIBS) +test_udev_LDFLAGS = -no-install + +test_path_SOURCES = path.c +test_path_LDADD = $(TEST_LIBS) +test_path_LDFLAGS = -no-install + +test_pointer_SOURCES = pointer.c +test_pointer_LDADD = $(TEST_LIBS) +test_pointer_LDFLAGS = -no-install + +test_touch_SOURCES = touch.c +test_touch_LDADD = $(TEST_LIBS) +test_touch_LDFLAGS = -no-install + +test_log_SOURCES = log.c +test_log_LDADD = $(TEST_LIBS) +test_log_LDFLAGS = -no-install + +test_touchpad_SOURCES = touchpad.c +test_touchpad_LDADD = $(TEST_LIBS) +test_touchpad_LDFLAGS = -no-install + +test_touchpad_tap_SOURCES = touchpad-tap.c +test_touchpad_tap_LDADD = $(TEST_LIBS) +test_touchpad_tap_LDFLAGS = -no-install + +test_touchpad_buttons_SOURCES = touchpad-buttons.c +test_touchpad_buttons_LDADD = $(TEST_LIBS) +test_touchpad_buttons_LDFLAGS = -no-install + +test_trackpoint_SOURCES = trackpoint.c +test_trackpoint_LDADD = $(TEST_LIBS) +test_trackpoint_LDFLAGS = -no-install + +test_misc_SOURCES = misc.c +test_misc_LDADD = $(TEST_LIBS) +test_misc_LDFLAGS = -no-install + +test_keyboard_SOURCES = keyboard.c +test_keyboard_LDADD = $(TEST_LIBS) +test_keyboard_LDFLAGS = -no-install + +test_device_SOURCES = device.c +test_device_LDADD = $(TEST_LIBS) +test_device_LDFLAGS = -no-install + +test_gestures_SOURCES = gestures.c +test_gestures_LDADD = $(TEST_LIBS) +test_gestures_LDFLAGS = -no-install + +test_litest_selftest_SOURCES = litest-selftest.c litest.c litest-int.h litest.h +test_litest_selftest_CFLAGS = -DLITEST_DISABLE_BACKTRACE_LOGGING -DLITEST_NO_MAIN $(liblitest_la_CFLAGS) +test_litest_selftest_LDADD = $(TEST_LIBS) +test_litest_selftest_LDFLAGS = -no-install +if HAVE_LIBUNWIND +test_litest_selftest_LDADD += $(LIBUNWIND_LIBS) -ldl +test_litest_selftest_CFLAGS += $(LIBUNWIND_CFLAGS) +endif + +# build-test only +test_build_pedantic_c99_SOURCES = build-pedantic.c +test_build_pedantic_c99_CFLAGS = -std=c99 -pedantic -Werror + +test_build_std_gnuc90_SOURCES = build-pedantic.c +test_build_std_gnuc90_CFLAGS = -std=gnu90 -Werror + +# test for linking with the minimal linker flags +test_build_linker_SOURCES = build-pedantic.c +test_build_linker_CFLAGS = -I$(top_srcdir)/src +test_build_linker_LDADD = $(top_builddir)/src/libinput.la $(top_builddir)/src/libinput-util.la + +# test including from C++ +test_build_cxx_SOURCES = build-cxx.cc +test_build_cxx_CXXFLAGS = -Wall -Wextra -Wno-unused-parameter $(AM_CXXFLAGS) + +AM_TESTS_ENVIRONMENT= LITEST_VERBOSE=1; export LITEST_VERBOSE; + +if HAVE_VALGRIND +VALGRIND_FLAGS=--leak-check=full \ + --quiet \ + --error-exitcode=3 \ + --suppressions=$(srcdir)/valgrind.suppressions + +valgrind: + $(MAKE) check-TESTS LOG_COMPILER="$(VALGRIND)" LOG_FLAGS="$(VALGRIND_FLAGS)" CK_FORK=no USING_VALGRIND=yes + +check: valgrind + +endif +endif +EXTRA_DIST=valgrind.suppressions diff -Nru libinput-1.10.3/test/Makefile.in libinput-0.21.0/test/Makefile.in --- libinput-1.10.3/test/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/Makefile.in 2015-08-04 00:58:31.000000000 +0000 @@ -0,0 +1,1960 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 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__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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@ +@BUILD_TESTS_TRUE@@HAVE_LIBUNWIND_TRUE@am__append_1 = $(LIBUNWIND_LIBS) -ldl +@BUILD_TESTS_TRUE@@HAVE_LIBUNWIND_TRUE@am__append_2 = $(LIBUNWIND_CFLAGS) +@BUILD_TESTS_TRUE@noinst_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) +@BUILD_TESTS_TRUE@TESTS = $(am__EXEEXT_2) symbols-leak-test +@BUILD_TESTS_TRUE@@HAVE_LIBUNWIND_TRUE@am__append_3 = $(LIBUNWIND_LIBS) -ldl +@BUILD_TESTS_TRUE@@HAVE_LIBUNWIND_TRUE@am__append_4 = $(LIBUNWIND_CFLAGS) +subdir = test +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(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)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = symbols-leak-test +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +@BUILD_TESTS_TRUE@@HAVE_LIBUNWIND_TRUE@am__DEPENDENCIES_2 = \ +@BUILD_TESTS_TRUE@@HAVE_LIBUNWIND_TRUE@ $(am__DEPENDENCIES_1) +@BUILD_TESTS_TRUE@liblitest_la_DEPENDENCIES = \ +@BUILD_TESTS_TRUE@ $(top_builddir)/src/libinput-util.la \ +@BUILD_TESTS_TRUE@ $(am__DEPENDENCIES_2) +am__liblitest_la_SOURCES_DIST = litest.h litest-int.h \ + litest-device-alps-semi-mt.c litest-device-alps-dualpoint.c \ + litest-device-atmel-hover.c litest-device-bcm5974.c \ + litest-device-elantech-touchpad.c \ + litest-device-generic-singletouch.c litest-device-keyboard.c \ + litest-device-keyboard-razer-blackwidow.c \ + litest-device-logitech-trackball.c \ + litest-device-nexus4-touch-screen.c \ + litest-device-magic-trackpad.c litest-device-mouse.c \ + litest-device-mouse-roccat.c litest-device-mouse-low-dpi.c \ + litest-device-ms-surface-cover.c \ + litest-device-protocol-a-touch-screen.c \ + litest-device-qemu-usb-tablet.c litest-device-synaptics.c \ + litest-device-synaptics-hover.c litest-device-synaptics-st.c \ + litest-device-synaptics-t440.c \ + litest-device-synaptics-x1-carbon-3rd.c \ + litest-device-trackpoint.c litest-device-touch-screen.c \ + litest-device-wacom-touch.c \ + litest-device-wacom-intuos-finger.c litest-device-wheel-only.c \ + litest-device-xen-virtual-pointer.c \ + litest-device-vmware-virtual-usb-mouse.c litest.c +@BUILD_TESTS_TRUE@am_liblitest_la_OBJECTS = \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-alps-semi-mt.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-alps-dualpoint.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-atmel-hover.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-bcm5974.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-elantech-touchpad.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-generic-singletouch.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-keyboard.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-keyboard-razer-blackwidow.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-logitech-trackball.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-nexus4-touch-screen.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-magic-trackpad.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-mouse.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-mouse-roccat.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-mouse-low-dpi.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-ms-surface-cover.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-protocol-a-touch-screen.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-qemu-usb-tablet.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-synaptics.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-synaptics-hover.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-synaptics-st.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-synaptics-t440.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-synaptics-x1-carbon-3rd.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-trackpoint.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-touch-screen.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-wacom-touch.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-wacom-intuos-finger.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-wheel-only.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-xen-virtual-pointer.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest-device-vmware-virtual-usb-mouse.lo \ +@BUILD_TESTS_TRUE@ liblitest_la-litest.lo +liblitest_la_OBJECTS = $(am_liblitest_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 = +liblitest_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(liblitest_la_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +@BUILD_TESTS_TRUE@am_liblitest_la_rpath = +@BUILD_TESTS_TRUE@am__EXEEXT_1 = test-build-cxx$(EXEEXT) \ +@BUILD_TESTS_TRUE@ test-build-linker$(EXEEXT) \ +@BUILD_TESTS_TRUE@ test-build-pedantic-c99$(EXEEXT) \ +@BUILD_TESTS_TRUE@ test-build-std-gnuc90$(EXEEXT) +@BUILD_TESTS_TRUE@am__EXEEXT_2 = test-touchpad$(EXEEXT) \ +@BUILD_TESTS_TRUE@ test-touchpad-tap$(EXEEXT) \ +@BUILD_TESTS_TRUE@ test-touchpad-buttons$(EXEEXT) \ +@BUILD_TESTS_TRUE@ test-device$(EXEEXT) test-gestures$(EXEEXT) \ +@BUILD_TESTS_TRUE@ test-pointer$(EXEEXT) test-touch$(EXEEXT) \ +@BUILD_TESTS_TRUE@ test-trackpoint$(EXEEXT) test-udev$(EXEEXT) \ +@BUILD_TESTS_TRUE@ test-path$(EXEEXT) test-log$(EXEEXT) \ +@BUILD_TESTS_TRUE@ test-misc$(EXEEXT) test-keyboard$(EXEEXT) \ +@BUILD_TESTS_TRUE@ test-litest-selftest$(EXEEXT) +PROGRAMS = $(noinst_PROGRAMS) +am__test_build_cxx_SOURCES_DIST = build-cxx.cc +@BUILD_TESTS_TRUE@am_test_build_cxx_OBJECTS = \ +@BUILD_TESTS_TRUE@ test_build_cxx-build-cxx.$(OBJEXT) +test_build_cxx_OBJECTS = $(am_test_build_cxx_OBJECTS) +test_build_cxx_LDADD = $(LDADD) +test_build_cxx_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(test_build_cxx_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am__test_build_linker_SOURCES_DIST = build-pedantic.c +@BUILD_TESTS_TRUE@am_test_build_linker_OBJECTS = \ +@BUILD_TESTS_TRUE@ test_build_linker-build-pedantic.$(OBJEXT) +test_build_linker_OBJECTS = $(am_test_build_linker_OBJECTS) +@BUILD_TESTS_TRUE@test_build_linker_DEPENDENCIES = \ +@BUILD_TESTS_TRUE@ $(top_builddir)/src/libinput.la \ +@BUILD_TESTS_TRUE@ $(top_builddir)/src/libinput-util.la +test_build_linker_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_build_linker_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +am__test_build_pedantic_c99_SOURCES_DIST = build-pedantic.c +@BUILD_TESTS_TRUE@am_test_build_pedantic_c99_OBJECTS = test_build_pedantic_c99-build-pedantic.$(OBJEXT) +test_build_pedantic_c99_OBJECTS = \ + $(am_test_build_pedantic_c99_OBJECTS) +test_build_pedantic_c99_LDADD = $(LDADD) +test_build_pedantic_c99_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_build_pedantic_c99_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am__test_build_std_gnuc90_SOURCES_DIST = build-pedantic.c +@BUILD_TESTS_TRUE@am_test_build_std_gnuc90_OBJECTS = test_build_std_gnuc90-build-pedantic.$(OBJEXT) +test_build_std_gnuc90_OBJECTS = $(am_test_build_std_gnuc90_OBJECTS) +test_build_std_gnuc90_LDADD = $(LDADD) +test_build_std_gnuc90_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_build_std_gnuc90_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am__test_device_SOURCES_DIST = device.c +@BUILD_TESTS_TRUE@am_test_device_OBJECTS = device.$(OBJEXT) +test_device_OBJECTS = $(am_test_device_OBJECTS) +@BUILD_TESTS_TRUE@am__DEPENDENCIES_3 = liblitest.la \ +@BUILD_TESTS_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +@BUILD_TESTS_TRUE@ $(am__DEPENDENCIES_1) \ +@BUILD_TESTS_TRUE@ $(top_builddir)/src/libinput.la +@BUILD_TESTS_TRUE@test_device_DEPENDENCIES = $(am__DEPENDENCIES_3) +test_device_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(test_device_LDFLAGS) $(LDFLAGS) -o $@ +am__test_gestures_SOURCES_DIST = gestures.c +@BUILD_TESTS_TRUE@am_test_gestures_OBJECTS = gestures.$(OBJEXT) +test_gestures_OBJECTS = $(am_test_gestures_OBJECTS) +@BUILD_TESTS_TRUE@test_gestures_DEPENDENCIES = $(am__DEPENDENCIES_3) +test_gestures_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(test_gestures_LDFLAGS) $(LDFLAGS) -o $@ +am__test_keyboard_SOURCES_DIST = keyboard.c +@BUILD_TESTS_TRUE@am_test_keyboard_OBJECTS = keyboard.$(OBJEXT) +test_keyboard_OBJECTS = $(am_test_keyboard_OBJECTS) +@BUILD_TESTS_TRUE@test_keyboard_DEPENDENCIES = $(am__DEPENDENCIES_3) +test_keyboard_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(test_keyboard_LDFLAGS) $(LDFLAGS) -o $@ +am__test_litest_selftest_SOURCES_DIST = litest-selftest.c litest.c \ + litest-int.h litest.h +@BUILD_TESTS_TRUE@am_test_litest_selftest_OBJECTS = test_litest_selftest-litest-selftest.$(OBJEXT) \ +@BUILD_TESTS_TRUE@ test_litest_selftest-litest.$(OBJEXT) +test_litest_selftest_OBJECTS = $(am_test_litest_selftest_OBJECTS) +@BUILD_TESTS_TRUE@test_litest_selftest_DEPENDENCIES = \ +@BUILD_TESTS_TRUE@ $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_2) +test_litest_selftest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_litest_selftest_CFLAGS) $(CFLAGS) \ + $(test_litest_selftest_LDFLAGS) $(LDFLAGS) -o $@ +am__test_log_SOURCES_DIST = log.c +@BUILD_TESTS_TRUE@am_test_log_OBJECTS = log.$(OBJEXT) +test_log_OBJECTS = $(am_test_log_OBJECTS) +@BUILD_TESTS_TRUE@test_log_DEPENDENCIES = $(am__DEPENDENCIES_3) +test_log_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(test_log_LDFLAGS) $(LDFLAGS) -o $@ +am__test_misc_SOURCES_DIST = misc.c +@BUILD_TESTS_TRUE@am_test_misc_OBJECTS = misc.$(OBJEXT) +test_misc_OBJECTS = $(am_test_misc_OBJECTS) +@BUILD_TESTS_TRUE@test_misc_DEPENDENCIES = $(am__DEPENDENCIES_3) +test_misc_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(test_misc_LDFLAGS) $(LDFLAGS) -o $@ +am__test_path_SOURCES_DIST = path.c +@BUILD_TESTS_TRUE@am_test_path_OBJECTS = path.$(OBJEXT) +test_path_OBJECTS = $(am_test_path_OBJECTS) +@BUILD_TESTS_TRUE@test_path_DEPENDENCIES = $(am__DEPENDENCIES_3) +test_path_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(test_path_LDFLAGS) $(LDFLAGS) -o $@ +am__test_pointer_SOURCES_DIST = pointer.c +@BUILD_TESTS_TRUE@am_test_pointer_OBJECTS = pointer.$(OBJEXT) +test_pointer_OBJECTS = $(am_test_pointer_OBJECTS) +@BUILD_TESTS_TRUE@test_pointer_DEPENDENCIES = $(am__DEPENDENCIES_3) +test_pointer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(test_pointer_LDFLAGS) $(LDFLAGS) -o $@ +am__test_touch_SOURCES_DIST = touch.c +@BUILD_TESTS_TRUE@am_test_touch_OBJECTS = touch.$(OBJEXT) +test_touch_OBJECTS = $(am_test_touch_OBJECTS) +@BUILD_TESTS_TRUE@test_touch_DEPENDENCIES = $(am__DEPENDENCIES_3) +test_touch_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(test_touch_LDFLAGS) $(LDFLAGS) -o $@ +am__test_touchpad_SOURCES_DIST = touchpad.c +@BUILD_TESTS_TRUE@am_test_touchpad_OBJECTS = touchpad.$(OBJEXT) +test_touchpad_OBJECTS = $(am_test_touchpad_OBJECTS) +@BUILD_TESTS_TRUE@test_touchpad_DEPENDENCIES = $(am__DEPENDENCIES_3) +test_touchpad_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(test_touchpad_LDFLAGS) $(LDFLAGS) -o $@ +am__test_touchpad_buttons_SOURCES_DIST = touchpad-buttons.c +@BUILD_TESTS_TRUE@am_test_touchpad_buttons_OBJECTS = \ +@BUILD_TESTS_TRUE@ touchpad-buttons.$(OBJEXT) +test_touchpad_buttons_OBJECTS = $(am_test_touchpad_buttons_OBJECTS) +@BUILD_TESTS_TRUE@test_touchpad_buttons_DEPENDENCIES = \ +@BUILD_TESTS_TRUE@ $(am__DEPENDENCIES_3) +test_touchpad_buttons_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(test_touchpad_buttons_LDFLAGS) \ + $(LDFLAGS) -o $@ +am__test_touchpad_tap_SOURCES_DIST = touchpad-tap.c +@BUILD_TESTS_TRUE@am_test_touchpad_tap_OBJECTS = \ +@BUILD_TESTS_TRUE@ touchpad-tap.$(OBJEXT) +test_touchpad_tap_OBJECTS = $(am_test_touchpad_tap_OBJECTS) +@BUILD_TESTS_TRUE@test_touchpad_tap_DEPENDENCIES = \ +@BUILD_TESTS_TRUE@ $(am__DEPENDENCIES_3) +test_touchpad_tap_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(test_touchpad_tap_LDFLAGS) $(LDFLAGS) \ + -o $@ +am__test_trackpoint_SOURCES_DIST = trackpoint.c +@BUILD_TESTS_TRUE@am_test_trackpoint_OBJECTS = trackpoint.$(OBJEXT) +test_trackpoint_OBJECTS = $(am_test_trackpoint_OBJECTS) +@BUILD_TESTS_TRUE@test_trackpoint_DEPENDENCIES = \ +@BUILD_TESTS_TRUE@ $(am__DEPENDENCIES_3) +test_trackpoint_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(test_trackpoint_LDFLAGS) $(LDFLAGS) \ + -o $@ +am__test_udev_SOURCES_DIST = udev.c +@BUILD_TESTS_TRUE@am_test_udev_OBJECTS = udev.$(OBJEXT) +test_udev_OBJECTS = $(am_test_udev_OBJECTS) +@BUILD_TESTS_TRUE@test_udev_DEPENDENCIES = $(am__DEPENDENCIES_3) +test_udev_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(test_udev_LDFLAGS) $(LDFLAGS) -o $@ +SCRIPTS = $(noinst_SCRIPTS) +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 = +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(liblitest_la_SOURCES) $(test_build_cxx_SOURCES) \ + $(test_build_linker_SOURCES) \ + $(test_build_pedantic_c99_SOURCES) \ + $(test_build_std_gnuc90_SOURCES) $(test_device_SOURCES) \ + $(test_gestures_SOURCES) $(test_keyboard_SOURCES) \ + $(test_litest_selftest_SOURCES) $(test_log_SOURCES) \ + $(test_misc_SOURCES) $(test_path_SOURCES) \ + $(test_pointer_SOURCES) $(test_touch_SOURCES) \ + $(test_touchpad_SOURCES) $(test_touchpad_buttons_SOURCES) \ + $(test_touchpad_tap_SOURCES) $(test_trackpoint_SOURCES) \ + $(test_udev_SOURCES) +DIST_SOURCES = $(am__liblitest_la_SOURCES_DIST) \ + $(am__test_build_cxx_SOURCES_DIST) \ + $(am__test_build_linker_SOURCES_DIST) \ + $(am__test_build_pedantic_c99_SOURCES_DIST) \ + $(am__test_build_std_gnuc90_SOURCES_DIST) \ + $(am__test_device_SOURCES_DIST) \ + $(am__test_gestures_SOURCES_DIST) \ + $(am__test_keyboard_SOURCES_DIST) \ + $(am__test_litest_selftest_SOURCES_DIST) \ + $(am__test_log_SOURCES_DIST) $(am__test_misc_SOURCES_DIST) \ + $(am__test_path_SOURCES_DIST) $(am__test_pointer_SOURCES_DIST) \ + $(am__test_touch_SOURCES_DIST) \ + $(am__test_touchpad_SOURCES_DIST) \ + $(am__test_touchpad_buttons_SOURCES_DIST) \ + $(am__test_touchpad_tap_SOURCES_DIST) \ + $(am__test_trackpoint_SOURCES_DIST) \ + $(am__test_udev_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red=''; \ + grn=''; \ + lgn=''; \ + blu=''; \ + mgn=''; \ + brg=''; \ + std=''; \ + fi; \ +} +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__recheck_rx = ^[ ]*:recheck:[ ]* +am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* +am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* +# A command that, given a newline-separated list of test names on the +# standard input, print the name of the tests that are to be re-run +# upon "make recheck". +am__list_recheck_tests = $(AWK) '{ \ + recheck = 1; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + { \ + if ((getline line2 < ($$0 ".log")) < 0) \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ + { \ + recheck = 0; \ + break; \ + } \ + else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ + { \ + break; \ + } \ + }; \ + if (recheck) \ + print $$0; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# A command that, given a newline-separated list of test names on the +# standard input, create the global log from their .trs and .log files. +am__create_global_log = $(AWK) ' \ +function fatal(msg) \ +{ \ + print "fatal: making $@: " msg | "cat >&2"; \ + exit 1; \ +} \ +function rst_section(header) \ +{ \ + print header; \ + len = length(header); \ + for (i = 1; i <= len; i = i + 1) \ + printf "="; \ + printf "\n\n"; \ +} \ +{ \ + copy_in_global_log = 1; \ + global_test_result = "RUN"; \ + while ((rc = (getline line < ($$0 ".trs"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".trs"); \ + if (line ~ /$(am__global_test_result_rx)/) \ + { \ + sub("$(am__global_test_result_rx)", "", line); \ + sub("[ ]*$$", "", line); \ + global_test_result = line; \ + } \ + else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ + copy_in_global_log = 0; \ + }; \ + if (copy_in_global_log) \ + { \ + rst_section(global_test_result ": " $$0); \ + while ((rc = (getline line < ($$0 ".log"))) != 0) \ + { \ + if (rc < 0) \ + fatal("failed to read from " $$0 ".log"); \ + print line; \ + }; \ + printf "\n"; \ + }; \ + close ($$0 ".trs"); \ + close ($$0 ".log"); \ +}' +# Restructured Text title. +am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } +# Solaris 10 'make', and several other traditional 'make' implementations, +# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it +# by disabling -e (using the XSI extension "set +e") if it's set. +am__sh_e_setup = case $$- in *e*) set +e;; esac +# Default flags passed to test drivers. +am__common_driver_flags = \ + --color-tests "$$am__color_tests" \ + --enable-hard-errors "$$am__enable_hard_errors" \ + --expect-failure "$$am__expect_failure" +# To be inserted before the command running the test. Creates the +# directory for the log if needed. Stores in $dir the directory +# containing $f, in $tst the test, in $log the log. Executes the +# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and +# passes TESTS_ENVIRONMENT. Set up options for the wrapper that +# will run the test scripts (or their associated LOG_COMPILER, if +# thy have one). +am__check_pre = \ +$(am__sh_e_setup); \ +$(am__vpath_adj_setup) $(am__vpath_adj) \ +$(am__tty_colors); \ +srcdir=$(srcdir); export srcdir; \ +case "$@" in \ + */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ + *) am__odir=.;; \ +esac; \ +test "x$$am__odir" = x"." || test -d "$$am__odir" \ + || $(MKDIR_P) "$$am__odir" || exit $$?; \ +if test -f "./$$f"; then dir=./; \ +elif test -f "$$f"; then dir=; \ +else dir="$(srcdir)/"; fi; \ +tst=$$dir$$f; log='$@'; \ +if test -n '$(DISABLE_HARD_ERRORS)'; then \ + am__enable_hard_errors=no; \ +else \ + am__enable_hard_errors=yes; \ +fi; \ +case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ + am__expect_failure=yes;; \ + *) \ + am__expect_failure=no;; \ +esac; \ +$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) +# A shell command to get the names of the tests scripts with any registered +# extension removed (i.e., equivalently, the names of the test logs, with +# the '.log' extension removed). The result is saved in the shell variable +# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, +# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", +# since that might cause problem with VPATH rewrites for suffix-less tests. +# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. +am__set_TESTS_bases = \ + bases='$(TEST_LOGS)'; \ + bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ + bases=`echo $$bases` +RECHECK_LOGS = $(TEST_LOGS) +AM_RECURSIVE_TARGETS = check recheck +TEST_SUITE_LOG = test-suite.log +TEST_EXTENSIONS = @EXEEXT@ .test +LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) +am__set_b = \ + case '$@' in \ + */*) \ + case '$*' in \ + */*) b='$*';; \ + *) b=`echo '$@' | sed 's/\.log$$//'`; \ + esac;; \ + *) \ + b='$*';; \ + esac +am__test_logs1 = $(TESTS:=.log) +am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) +TEST_LOGS = $(am__test_logs2:.test.log=.log) +TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver +TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ + $(TEST_LOG_FLAGS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/symbols-leak-test.in \ + $(top_srcdir)/depcomp $(top_srcdir)/test-driver +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADDR2LINE = @ADDR2LINE@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GCC_CFLAGS = @GCC_CFLAGS@ +GCC_CXXFLAGS = @GCC_CXXFLAGS@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBEVDEV_CFLAGS = @LIBEVDEV_CFLAGS@ +LIBEVDEV_LIBS = @LIBEVDEV_LIBS@ +LIBINPUT_LT_VERSION = @LIBINPUT_LT_VERSION@ +LIBINPUT_VERSION = @LIBINPUT_VERSION@ +LIBINPUT_VERSION_MAJOR = @LIBINPUT_VERSION_MAJOR@ +LIBINPUT_VERSION_MICRO = @LIBINPUT_VERSION_MICRO@ +LIBINPUT_VERSION_MINOR = @LIBINPUT_VERSION_MINOR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@ +LIBUDEV_LIBS = @LIBUDEV_LIBS@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MTDEV_CFLAGS = @MTDEV_CFLAGS@ +MTDEV_LIBS = @MTDEV_LIBS@ +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@ +STRIP = @STRIP@ +UDEV_DIR = @UDEV_DIR@ +UDEV_TEST_PATH = @UDEV_TEST_PATH@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +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_CXX = @ac_ct_CXX@ +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@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@BUILD_TESTS_TRUE@AM_CPPFLAGS = -I$(top_srcdir)/include \ +@BUILD_TESTS_TRUE@ -I$(top_srcdir)/src \ +@BUILD_TESTS_TRUE@ $(CHECK_CFLAGS) \ +@BUILD_TESTS_TRUE@ $(LIBEVDEV_CFLAGS) \ +@BUILD_TESTS_TRUE@ $(LIBUDEV_CFLAGS) + +@BUILD_TESTS_TRUE@AM_CFLAGS = $(GCC_CFLAGS) +@BUILD_TESTS_TRUE@AM_CXXFLAGS = $(GCC_CXXFLAGS) +@BUILD_TESTS_TRUE@TEST_LIBS = liblitest.la $(CHECK_LIBS) $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS) $(top_builddir)/src/libinput.la +@BUILD_TESTS_TRUE@noinst_LTLIBRARIES = liblitest.la +@BUILD_TESTS_TRUE@liblitest_la_SOURCES = \ +@BUILD_TESTS_TRUE@ litest.h \ +@BUILD_TESTS_TRUE@ litest-int.h \ +@BUILD_TESTS_TRUE@ litest-device-alps-semi-mt.c \ +@BUILD_TESTS_TRUE@ litest-device-alps-dualpoint.c \ +@BUILD_TESTS_TRUE@ litest-device-atmel-hover.c \ +@BUILD_TESTS_TRUE@ litest-device-bcm5974.c \ +@BUILD_TESTS_TRUE@ litest-device-elantech-touchpad.c \ +@BUILD_TESTS_TRUE@ litest-device-generic-singletouch.c \ +@BUILD_TESTS_TRUE@ litest-device-keyboard.c \ +@BUILD_TESTS_TRUE@ litest-device-keyboard-razer-blackwidow.c \ +@BUILD_TESTS_TRUE@ litest-device-logitech-trackball.c \ +@BUILD_TESTS_TRUE@ litest-device-nexus4-touch-screen.c \ +@BUILD_TESTS_TRUE@ litest-device-magic-trackpad.c \ +@BUILD_TESTS_TRUE@ litest-device-mouse.c \ +@BUILD_TESTS_TRUE@ litest-device-mouse-roccat.c \ +@BUILD_TESTS_TRUE@ litest-device-mouse-low-dpi.c \ +@BUILD_TESTS_TRUE@ litest-device-ms-surface-cover.c \ +@BUILD_TESTS_TRUE@ litest-device-protocol-a-touch-screen.c \ +@BUILD_TESTS_TRUE@ litest-device-qemu-usb-tablet.c \ +@BUILD_TESTS_TRUE@ litest-device-synaptics.c \ +@BUILD_TESTS_TRUE@ litest-device-synaptics-hover.c \ +@BUILD_TESTS_TRUE@ litest-device-synaptics-st.c \ +@BUILD_TESTS_TRUE@ litest-device-synaptics-t440.c \ +@BUILD_TESTS_TRUE@ litest-device-synaptics-x1-carbon-3rd.c \ +@BUILD_TESTS_TRUE@ litest-device-trackpoint.c \ +@BUILD_TESTS_TRUE@ litest-device-touch-screen.c \ +@BUILD_TESTS_TRUE@ litest-device-wacom-touch.c \ +@BUILD_TESTS_TRUE@ litest-device-wacom-intuos-finger.c \ +@BUILD_TESTS_TRUE@ litest-device-wheel-only.c \ +@BUILD_TESTS_TRUE@ litest-device-xen-virtual-pointer.c \ +@BUILD_TESTS_TRUE@ litest-device-vmware-virtual-usb-mouse.c \ +@BUILD_TESTS_TRUE@ litest.c + +@BUILD_TESTS_TRUE@liblitest_la_LIBADD = \ +@BUILD_TESTS_TRUE@ $(top_builddir)/src/libinput-util.la \ +@BUILD_TESTS_TRUE@ $(am__append_1) +@BUILD_TESTS_TRUE@liblitest_la_CFLAGS = $(AM_CFLAGS) \ +@BUILD_TESTS_TRUE@ -DLIBINPUT_MODEL_QUIRKS_UDEV_RULES_FILE="\"$(abs_top_builddir)/udev/90-libinput-model-quirks-litest.rules\"" \ +@BUILD_TESTS_TRUE@ -DLIBINPUT_MODEL_QUIRKS_UDEV_HWDB_FILE="\"$(abs_top_srcdir)/udev/90-libinput-model-quirks.hwdb\"" \ +@BUILD_TESTS_TRUE@ -DLIBINPUT_TEST_DEVICE_RULES_FILE="\"$(abs_top_srcdir)/udev/80-libinput-test-device.rules\"" \ +@BUILD_TESTS_TRUE@ $(am__append_2) +@BUILD_TESTS_TRUE@run_tests = \ +@BUILD_TESTS_TRUE@ test-touchpad \ +@BUILD_TESTS_TRUE@ test-touchpad-tap \ +@BUILD_TESTS_TRUE@ test-touchpad-buttons \ +@BUILD_TESTS_TRUE@ test-device \ +@BUILD_TESTS_TRUE@ test-gestures \ +@BUILD_TESTS_TRUE@ test-pointer \ +@BUILD_TESTS_TRUE@ test-touch \ +@BUILD_TESTS_TRUE@ test-trackpoint \ +@BUILD_TESTS_TRUE@ test-udev \ +@BUILD_TESTS_TRUE@ test-path \ +@BUILD_TESTS_TRUE@ test-log \ +@BUILD_TESTS_TRUE@ test-misc \ +@BUILD_TESTS_TRUE@ test-keyboard \ +@BUILD_TESTS_TRUE@ test-litest-selftest + +@BUILD_TESTS_TRUE@build_tests = \ +@BUILD_TESTS_TRUE@ test-build-cxx \ +@BUILD_TESTS_TRUE@ test-build-linker \ +@BUILD_TESTS_TRUE@ test-build-pedantic-c99 \ +@BUILD_TESTS_TRUE@ test-build-std-gnuc90 + +@BUILD_TESTS_TRUE@noinst_SCRIPTS = symbols-leak-test +@BUILD_TESTS_TRUE@test_udev_SOURCES = udev.c +@BUILD_TESTS_TRUE@test_udev_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_udev_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_path_SOURCES = path.c +@BUILD_TESTS_TRUE@test_path_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_path_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_pointer_SOURCES = pointer.c +@BUILD_TESTS_TRUE@test_pointer_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_pointer_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_touch_SOURCES = touch.c +@BUILD_TESTS_TRUE@test_touch_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_touch_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_log_SOURCES = log.c +@BUILD_TESTS_TRUE@test_log_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_log_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_touchpad_SOURCES = touchpad.c +@BUILD_TESTS_TRUE@test_touchpad_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_touchpad_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_touchpad_tap_SOURCES = touchpad-tap.c +@BUILD_TESTS_TRUE@test_touchpad_tap_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_touchpad_tap_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_touchpad_buttons_SOURCES = touchpad-buttons.c +@BUILD_TESTS_TRUE@test_touchpad_buttons_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_touchpad_buttons_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_trackpoint_SOURCES = trackpoint.c +@BUILD_TESTS_TRUE@test_trackpoint_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_trackpoint_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_misc_SOURCES = misc.c +@BUILD_TESTS_TRUE@test_misc_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_misc_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_keyboard_SOURCES = keyboard.c +@BUILD_TESTS_TRUE@test_keyboard_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_keyboard_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_device_SOURCES = device.c +@BUILD_TESTS_TRUE@test_device_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_device_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_gestures_SOURCES = gestures.c +@BUILD_TESTS_TRUE@test_gestures_LDADD = $(TEST_LIBS) +@BUILD_TESTS_TRUE@test_gestures_LDFLAGS = -no-install +@BUILD_TESTS_TRUE@test_litest_selftest_SOURCES = litest-selftest.c litest.c litest-int.h litest.h +@BUILD_TESTS_TRUE@test_litest_selftest_CFLAGS = \ +@BUILD_TESTS_TRUE@ -DLITEST_DISABLE_BACKTRACE_LOGGING \ +@BUILD_TESTS_TRUE@ -DLITEST_NO_MAIN $(liblitest_la_CFLAGS) \ +@BUILD_TESTS_TRUE@ $(am__append_4) +@BUILD_TESTS_TRUE@test_litest_selftest_LDADD = $(TEST_LIBS) \ +@BUILD_TESTS_TRUE@ $(am__append_3) +@BUILD_TESTS_TRUE@test_litest_selftest_LDFLAGS = -no-install + +# build-test only +@BUILD_TESTS_TRUE@test_build_pedantic_c99_SOURCES = build-pedantic.c +@BUILD_TESTS_TRUE@test_build_pedantic_c99_CFLAGS = -std=c99 -pedantic -Werror +@BUILD_TESTS_TRUE@test_build_std_gnuc90_SOURCES = build-pedantic.c +@BUILD_TESTS_TRUE@test_build_std_gnuc90_CFLAGS = -std=gnu90 -Werror + +# test for linking with the minimal linker flags +@BUILD_TESTS_TRUE@test_build_linker_SOURCES = build-pedantic.c +@BUILD_TESTS_TRUE@test_build_linker_CFLAGS = -I$(top_srcdir)/src +@BUILD_TESTS_TRUE@test_build_linker_LDADD = $(top_builddir)/src/libinput.la $(top_builddir)/src/libinput-util.la + +# test including from C++ +@BUILD_TESTS_TRUE@test_build_cxx_SOURCES = build-cxx.cc +@BUILD_TESTS_TRUE@test_build_cxx_CXXFLAGS = -Wall -Wextra -Wno-unused-parameter $(AM_CXXFLAGS) +@BUILD_TESTS_TRUE@AM_TESTS_ENVIRONMENT = LITEST_VERBOSE=1; export LITEST_VERBOSE; +@BUILD_TESTS_TRUE@@HAVE_VALGRIND_TRUE@VALGRIND_FLAGS = --leak-check=full \ +@BUILD_TESTS_TRUE@@HAVE_VALGRIND_TRUE@ --quiet \ +@BUILD_TESTS_TRUE@@HAVE_VALGRIND_TRUE@ --error-exitcode=3 \ +@BUILD_TESTS_TRUE@@HAVE_VALGRIND_TRUE@ --suppressions=$(srcdir)/valgrind.suppressions + +EXTRA_DIST = valgrind.suppressions +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cc .lo .log .o .obj .test .test$(EXEEXT) .trs +$(srcdir)/Makefile.in: $(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 test/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/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: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +symbols-leak-test: $(top_builddir)/config.status $(srcdir)/symbols-leak-test.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_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}; \ + } + +liblitest.la: $(liblitest_la_OBJECTS) $(liblitest_la_DEPENDENCIES) $(EXTRA_liblitest_la_DEPENDENCIES) + $(AM_V_CCLD)$(liblitest_la_LINK) $(am_liblitest_la_rpath) $(liblitest_la_OBJECTS) $(liblitest_la_LIBADD) $(LIBS) + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test-build-cxx$(EXEEXT): $(test_build_cxx_OBJECTS) $(test_build_cxx_DEPENDENCIES) $(EXTRA_test_build_cxx_DEPENDENCIES) + @rm -f test-build-cxx$(EXEEXT) + $(AM_V_CXXLD)$(test_build_cxx_LINK) $(test_build_cxx_OBJECTS) $(test_build_cxx_LDADD) $(LIBS) + +test-build-linker$(EXEEXT): $(test_build_linker_OBJECTS) $(test_build_linker_DEPENDENCIES) $(EXTRA_test_build_linker_DEPENDENCIES) + @rm -f test-build-linker$(EXEEXT) + $(AM_V_CCLD)$(test_build_linker_LINK) $(test_build_linker_OBJECTS) $(test_build_linker_LDADD) $(LIBS) + +test-build-pedantic-c99$(EXEEXT): $(test_build_pedantic_c99_OBJECTS) $(test_build_pedantic_c99_DEPENDENCIES) $(EXTRA_test_build_pedantic_c99_DEPENDENCIES) + @rm -f test-build-pedantic-c99$(EXEEXT) + $(AM_V_CCLD)$(test_build_pedantic_c99_LINK) $(test_build_pedantic_c99_OBJECTS) $(test_build_pedantic_c99_LDADD) $(LIBS) + +test-build-std-gnuc90$(EXEEXT): $(test_build_std_gnuc90_OBJECTS) $(test_build_std_gnuc90_DEPENDENCIES) $(EXTRA_test_build_std_gnuc90_DEPENDENCIES) + @rm -f test-build-std-gnuc90$(EXEEXT) + $(AM_V_CCLD)$(test_build_std_gnuc90_LINK) $(test_build_std_gnuc90_OBJECTS) $(test_build_std_gnuc90_LDADD) $(LIBS) + +test-device$(EXEEXT): $(test_device_OBJECTS) $(test_device_DEPENDENCIES) $(EXTRA_test_device_DEPENDENCIES) + @rm -f test-device$(EXEEXT) + $(AM_V_CCLD)$(test_device_LINK) $(test_device_OBJECTS) $(test_device_LDADD) $(LIBS) + +test-gestures$(EXEEXT): $(test_gestures_OBJECTS) $(test_gestures_DEPENDENCIES) $(EXTRA_test_gestures_DEPENDENCIES) + @rm -f test-gestures$(EXEEXT) + $(AM_V_CCLD)$(test_gestures_LINK) $(test_gestures_OBJECTS) $(test_gestures_LDADD) $(LIBS) + +test-keyboard$(EXEEXT): $(test_keyboard_OBJECTS) $(test_keyboard_DEPENDENCIES) $(EXTRA_test_keyboard_DEPENDENCIES) + @rm -f test-keyboard$(EXEEXT) + $(AM_V_CCLD)$(test_keyboard_LINK) $(test_keyboard_OBJECTS) $(test_keyboard_LDADD) $(LIBS) + +test-litest-selftest$(EXEEXT): $(test_litest_selftest_OBJECTS) $(test_litest_selftest_DEPENDENCIES) $(EXTRA_test_litest_selftest_DEPENDENCIES) + @rm -f test-litest-selftest$(EXEEXT) + $(AM_V_CCLD)$(test_litest_selftest_LINK) $(test_litest_selftest_OBJECTS) $(test_litest_selftest_LDADD) $(LIBS) + +test-log$(EXEEXT): $(test_log_OBJECTS) $(test_log_DEPENDENCIES) $(EXTRA_test_log_DEPENDENCIES) + @rm -f test-log$(EXEEXT) + $(AM_V_CCLD)$(test_log_LINK) $(test_log_OBJECTS) $(test_log_LDADD) $(LIBS) + +test-misc$(EXEEXT): $(test_misc_OBJECTS) $(test_misc_DEPENDENCIES) $(EXTRA_test_misc_DEPENDENCIES) + @rm -f test-misc$(EXEEXT) + $(AM_V_CCLD)$(test_misc_LINK) $(test_misc_OBJECTS) $(test_misc_LDADD) $(LIBS) + +test-path$(EXEEXT): $(test_path_OBJECTS) $(test_path_DEPENDENCIES) $(EXTRA_test_path_DEPENDENCIES) + @rm -f test-path$(EXEEXT) + $(AM_V_CCLD)$(test_path_LINK) $(test_path_OBJECTS) $(test_path_LDADD) $(LIBS) + +test-pointer$(EXEEXT): $(test_pointer_OBJECTS) $(test_pointer_DEPENDENCIES) $(EXTRA_test_pointer_DEPENDENCIES) + @rm -f test-pointer$(EXEEXT) + $(AM_V_CCLD)$(test_pointer_LINK) $(test_pointer_OBJECTS) $(test_pointer_LDADD) $(LIBS) + +test-touch$(EXEEXT): $(test_touch_OBJECTS) $(test_touch_DEPENDENCIES) $(EXTRA_test_touch_DEPENDENCIES) + @rm -f test-touch$(EXEEXT) + $(AM_V_CCLD)$(test_touch_LINK) $(test_touch_OBJECTS) $(test_touch_LDADD) $(LIBS) + +test-touchpad$(EXEEXT): $(test_touchpad_OBJECTS) $(test_touchpad_DEPENDENCIES) $(EXTRA_test_touchpad_DEPENDENCIES) + @rm -f test-touchpad$(EXEEXT) + $(AM_V_CCLD)$(test_touchpad_LINK) $(test_touchpad_OBJECTS) $(test_touchpad_LDADD) $(LIBS) + +test-touchpad-buttons$(EXEEXT): $(test_touchpad_buttons_OBJECTS) $(test_touchpad_buttons_DEPENDENCIES) $(EXTRA_test_touchpad_buttons_DEPENDENCIES) + @rm -f test-touchpad-buttons$(EXEEXT) + $(AM_V_CCLD)$(test_touchpad_buttons_LINK) $(test_touchpad_buttons_OBJECTS) $(test_touchpad_buttons_LDADD) $(LIBS) + +test-touchpad-tap$(EXEEXT): $(test_touchpad_tap_OBJECTS) $(test_touchpad_tap_DEPENDENCIES) $(EXTRA_test_touchpad_tap_DEPENDENCIES) + @rm -f test-touchpad-tap$(EXEEXT) + $(AM_V_CCLD)$(test_touchpad_tap_LINK) $(test_touchpad_tap_OBJECTS) $(test_touchpad_tap_LDADD) $(LIBS) + +test-trackpoint$(EXEEXT): $(test_trackpoint_OBJECTS) $(test_trackpoint_DEPENDENCIES) $(EXTRA_test_trackpoint_DEPENDENCIES) + @rm -f test-trackpoint$(EXEEXT) + $(AM_V_CCLD)$(test_trackpoint_LINK) $(test_trackpoint_OBJECTS) $(test_trackpoint_LDADD) $(LIBS) + +test-udev$(EXEEXT): $(test_udev_OBJECTS) $(test_udev_DEPENDENCIES) $(EXTRA_test_udev_DEPENDENCIES) + @rm -f test-udev$(EXEEXT) + $(AM_V_CCLD)$(test_udev_LINK) $(test_udev_OBJECTS) $(test_udev_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/device.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gestures.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyboard.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-alps-dualpoint.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-alps-semi-mt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-atmel-hover.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-bcm5974.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-elantech-touchpad.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-generic-singletouch.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-keyboard-razer-blackwidow.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-keyboard.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-logitech-trackball.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-magic-trackpad.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-mouse-low-dpi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-mouse-roccat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-mouse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-ms-surface-cover.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-nexus4-touch-screen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-protocol-a-touch-screen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-qemu-usb-tablet.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-synaptics-hover.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-synaptics-st.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-synaptics-t440.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-synaptics-x1-carbon-3rd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-synaptics.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-touch-screen.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-trackpoint.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-vmware-virtual-usb-mouse.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-wacom-intuos-finger.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-wacom-touch.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-wheel-only.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest-device-xen-virtual-pointer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblitest_la-litest.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pointer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_build_cxx-build-cxx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_build_linker-build-pedantic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_build_pedantic_c99-build-pedantic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_build_std_gnuc90-build-pedantic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_litest_selftest-litest-selftest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_litest_selftest-litest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/touch.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/touchpad-buttons.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/touchpad-tap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/touchpad.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trackpoint.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev.Po@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 -o $@ $< + +.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 -o $@ `$(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 $@ $< + +liblitest_la-litest-device-alps-semi-mt.lo: litest-device-alps-semi-mt.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-alps-semi-mt.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-alps-semi-mt.Tpo -c -o liblitest_la-litest-device-alps-semi-mt.lo `test -f 'litest-device-alps-semi-mt.c' || echo '$(srcdir)/'`litest-device-alps-semi-mt.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-alps-semi-mt.Tpo $(DEPDIR)/liblitest_la-litest-device-alps-semi-mt.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-alps-semi-mt.c' object='liblitest_la-litest-device-alps-semi-mt.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-alps-semi-mt.lo `test -f 'litest-device-alps-semi-mt.c' || echo '$(srcdir)/'`litest-device-alps-semi-mt.c + +liblitest_la-litest-device-alps-dualpoint.lo: litest-device-alps-dualpoint.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-alps-dualpoint.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-alps-dualpoint.Tpo -c -o liblitest_la-litest-device-alps-dualpoint.lo `test -f 'litest-device-alps-dualpoint.c' || echo '$(srcdir)/'`litest-device-alps-dualpoint.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-alps-dualpoint.Tpo $(DEPDIR)/liblitest_la-litest-device-alps-dualpoint.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-alps-dualpoint.c' object='liblitest_la-litest-device-alps-dualpoint.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-alps-dualpoint.lo `test -f 'litest-device-alps-dualpoint.c' || echo '$(srcdir)/'`litest-device-alps-dualpoint.c + +liblitest_la-litest-device-atmel-hover.lo: litest-device-atmel-hover.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-atmel-hover.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-atmel-hover.Tpo -c -o liblitest_la-litest-device-atmel-hover.lo `test -f 'litest-device-atmel-hover.c' || echo '$(srcdir)/'`litest-device-atmel-hover.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-atmel-hover.Tpo $(DEPDIR)/liblitest_la-litest-device-atmel-hover.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-atmel-hover.c' object='liblitest_la-litest-device-atmel-hover.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-atmel-hover.lo `test -f 'litest-device-atmel-hover.c' || echo '$(srcdir)/'`litest-device-atmel-hover.c + +liblitest_la-litest-device-bcm5974.lo: litest-device-bcm5974.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-bcm5974.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-bcm5974.Tpo -c -o liblitest_la-litest-device-bcm5974.lo `test -f 'litest-device-bcm5974.c' || echo '$(srcdir)/'`litest-device-bcm5974.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-bcm5974.Tpo $(DEPDIR)/liblitest_la-litest-device-bcm5974.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-bcm5974.c' object='liblitest_la-litest-device-bcm5974.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-bcm5974.lo `test -f 'litest-device-bcm5974.c' || echo '$(srcdir)/'`litest-device-bcm5974.c + +liblitest_la-litest-device-elantech-touchpad.lo: litest-device-elantech-touchpad.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-elantech-touchpad.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-elantech-touchpad.Tpo -c -o liblitest_la-litest-device-elantech-touchpad.lo `test -f 'litest-device-elantech-touchpad.c' || echo '$(srcdir)/'`litest-device-elantech-touchpad.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-elantech-touchpad.Tpo $(DEPDIR)/liblitest_la-litest-device-elantech-touchpad.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-elantech-touchpad.c' object='liblitest_la-litest-device-elantech-touchpad.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-elantech-touchpad.lo `test -f 'litest-device-elantech-touchpad.c' || echo '$(srcdir)/'`litest-device-elantech-touchpad.c + +liblitest_la-litest-device-generic-singletouch.lo: litest-device-generic-singletouch.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-generic-singletouch.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-generic-singletouch.Tpo -c -o liblitest_la-litest-device-generic-singletouch.lo `test -f 'litest-device-generic-singletouch.c' || echo '$(srcdir)/'`litest-device-generic-singletouch.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-generic-singletouch.Tpo $(DEPDIR)/liblitest_la-litest-device-generic-singletouch.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-generic-singletouch.c' object='liblitest_la-litest-device-generic-singletouch.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-generic-singletouch.lo `test -f 'litest-device-generic-singletouch.c' || echo '$(srcdir)/'`litest-device-generic-singletouch.c + +liblitest_la-litest-device-keyboard.lo: litest-device-keyboard.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-keyboard.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-keyboard.Tpo -c -o liblitest_la-litest-device-keyboard.lo `test -f 'litest-device-keyboard.c' || echo '$(srcdir)/'`litest-device-keyboard.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-keyboard.Tpo $(DEPDIR)/liblitest_la-litest-device-keyboard.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-keyboard.c' object='liblitest_la-litest-device-keyboard.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-keyboard.lo `test -f 'litest-device-keyboard.c' || echo '$(srcdir)/'`litest-device-keyboard.c + +liblitest_la-litest-device-keyboard-razer-blackwidow.lo: litest-device-keyboard-razer-blackwidow.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-keyboard-razer-blackwidow.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-keyboard-razer-blackwidow.Tpo -c -o liblitest_la-litest-device-keyboard-razer-blackwidow.lo `test -f 'litest-device-keyboard-razer-blackwidow.c' || echo '$(srcdir)/'`litest-device-keyboard-razer-blackwidow.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-keyboard-razer-blackwidow.Tpo $(DEPDIR)/liblitest_la-litest-device-keyboard-razer-blackwidow.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-keyboard-razer-blackwidow.c' object='liblitest_la-litest-device-keyboard-razer-blackwidow.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-keyboard-razer-blackwidow.lo `test -f 'litest-device-keyboard-razer-blackwidow.c' || echo '$(srcdir)/'`litest-device-keyboard-razer-blackwidow.c + +liblitest_la-litest-device-logitech-trackball.lo: litest-device-logitech-trackball.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-logitech-trackball.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-logitech-trackball.Tpo -c -o liblitest_la-litest-device-logitech-trackball.lo `test -f 'litest-device-logitech-trackball.c' || echo '$(srcdir)/'`litest-device-logitech-trackball.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-logitech-trackball.Tpo $(DEPDIR)/liblitest_la-litest-device-logitech-trackball.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-logitech-trackball.c' object='liblitest_la-litest-device-logitech-trackball.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-logitech-trackball.lo `test -f 'litest-device-logitech-trackball.c' || echo '$(srcdir)/'`litest-device-logitech-trackball.c + +liblitest_la-litest-device-nexus4-touch-screen.lo: litest-device-nexus4-touch-screen.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-nexus4-touch-screen.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-nexus4-touch-screen.Tpo -c -o liblitest_la-litest-device-nexus4-touch-screen.lo `test -f 'litest-device-nexus4-touch-screen.c' || echo '$(srcdir)/'`litest-device-nexus4-touch-screen.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-nexus4-touch-screen.Tpo $(DEPDIR)/liblitest_la-litest-device-nexus4-touch-screen.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-nexus4-touch-screen.c' object='liblitest_la-litest-device-nexus4-touch-screen.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-nexus4-touch-screen.lo `test -f 'litest-device-nexus4-touch-screen.c' || echo '$(srcdir)/'`litest-device-nexus4-touch-screen.c + +liblitest_la-litest-device-magic-trackpad.lo: litest-device-magic-trackpad.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-magic-trackpad.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-magic-trackpad.Tpo -c -o liblitest_la-litest-device-magic-trackpad.lo `test -f 'litest-device-magic-trackpad.c' || echo '$(srcdir)/'`litest-device-magic-trackpad.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-magic-trackpad.Tpo $(DEPDIR)/liblitest_la-litest-device-magic-trackpad.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-magic-trackpad.c' object='liblitest_la-litest-device-magic-trackpad.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-magic-trackpad.lo `test -f 'litest-device-magic-trackpad.c' || echo '$(srcdir)/'`litest-device-magic-trackpad.c + +liblitest_la-litest-device-mouse.lo: litest-device-mouse.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-mouse.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-mouse.Tpo -c -o liblitest_la-litest-device-mouse.lo `test -f 'litest-device-mouse.c' || echo '$(srcdir)/'`litest-device-mouse.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-mouse.Tpo $(DEPDIR)/liblitest_la-litest-device-mouse.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-mouse.c' object='liblitest_la-litest-device-mouse.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-mouse.lo `test -f 'litest-device-mouse.c' || echo '$(srcdir)/'`litest-device-mouse.c + +liblitest_la-litest-device-mouse-roccat.lo: litest-device-mouse-roccat.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-mouse-roccat.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-mouse-roccat.Tpo -c -o liblitest_la-litest-device-mouse-roccat.lo `test -f 'litest-device-mouse-roccat.c' || echo '$(srcdir)/'`litest-device-mouse-roccat.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-mouse-roccat.Tpo $(DEPDIR)/liblitest_la-litest-device-mouse-roccat.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-mouse-roccat.c' object='liblitest_la-litest-device-mouse-roccat.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-mouse-roccat.lo `test -f 'litest-device-mouse-roccat.c' || echo '$(srcdir)/'`litest-device-mouse-roccat.c + +liblitest_la-litest-device-mouse-low-dpi.lo: litest-device-mouse-low-dpi.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-mouse-low-dpi.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-mouse-low-dpi.Tpo -c -o liblitest_la-litest-device-mouse-low-dpi.lo `test -f 'litest-device-mouse-low-dpi.c' || echo '$(srcdir)/'`litest-device-mouse-low-dpi.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-mouse-low-dpi.Tpo $(DEPDIR)/liblitest_la-litest-device-mouse-low-dpi.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-mouse-low-dpi.c' object='liblitest_la-litest-device-mouse-low-dpi.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-mouse-low-dpi.lo `test -f 'litest-device-mouse-low-dpi.c' || echo '$(srcdir)/'`litest-device-mouse-low-dpi.c + +liblitest_la-litest-device-ms-surface-cover.lo: litest-device-ms-surface-cover.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-ms-surface-cover.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-ms-surface-cover.Tpo -c -o liblitest_la-litest-device-ms-surface-cover.lo `test -f 'litest-device-ms-surface-cover.c' || echo '$(srcdir)/'`litest-device-ms-surface-cover.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-ms-surface-cover.Tpo $(DEPDIR)/liblitest_la-litest-device-ms-surface-cover.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-ms-surface-cover.c' object='liblitest_la-litest-device-ms-surface-cover.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-ms-surface-cover.lo `test -f 'litest-device-ms-surface-cover.c' || echo '$(srcdir)/'`litest-device-ms-surface-cover.c + +liblitest_la-litest-device-protocol-a-touch-screen.lo: litest-device-protocol-a-touch-screen.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-protocol-a-touch-screen.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-protocol-a-touch-screen.Tpo -c -o liblitest_la-litest-device-protocol-a-touch-screen.lo `test -f 'litest-device-protocol-a-touch-screen.c' || echo '$(srcdir)/'`litest-device-protocol-a-touch-screen.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-protocol-a-touch-screen.Tpo $(DEPDIR)/liblitest_la-litest-device-protocol-a-touch-screen.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-protocol-a-touch-screen.c' object='liblitest_la-litest-device-protocol-a-touch-screen.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-protocol-a-touch-screen.lo `test -f 'litest-device-protocol-a-touch-screen.c' || echo '$(srcdir)/'`litest-device-protocol-a-touch-screen.c + +liblitest_la-litest-device-qemu-usb-tablet.lo: litest-device-qemu-usb-tablet.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-qemu-usb-tablet.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-qemu-usb-tablet.Tpo -c -o liblitest_la-litest-device-qemu-usb-tablet.lo `test -f 'litest-device-qemu-usb-tablet.c' || echo '$(srcdir)/'`litest-device-qemu-usb-tablet.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-qemu-usb-tablet.Tpo $(DEPDIR)/liblitest_la-litest-device-qemu-usb-tablet.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-qemu-usb-tablet.c' object='liblitest_la-litest-device-qemu-usb-tablet.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-qemu-usb-tablet.lo `test -f 'litest-device-qemu-usb-tablet.c' || echo '$(srcdir)/'`litest-device-qemu-usb-tablet.c + +liblitest_la-litest-device-synaptics.lo: litest-device-synaptics.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-synaptics.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-synaptics.Tpo -c -o liblitest_la-litest-device-synaptics.lo `test -f 'litest-device-synaptics.c' || echo '$(srcdir)/'`litest-device-synaptics.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-synaptics.Tpo $(DEPDIR)/liblitest_la-litest-device-synaptics.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-synaptics.c' object='liblitest_la-litest-device-synaptics.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-synaptics.lo `test -f 'litest-device-synaptics.c' || echo '$(srcdir)/'`litest-device-synaptics.c + +liblitest_la-litest-device-synaptics-hover.lo: litest-device-synaptics-hover.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-synaptics-hover.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-synaptics-hover.Tpo -c -o liblitest_la-litest-device-synaptics-hover.lo `test -f 'litest-device-synaptics-hover.c' || echo '$(srcdir)/'`litest-device-synaptics-hover.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-synaptics-hover.Tpo $(DEPDIR)/liblitest_la-litest-device-synaptics-hover.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-synaptics-hover.c' object='liblitest_la-litest-device-synaptics-hover.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-synaptics-hover.lo `test -f 'litest-device-synaptics-hover.c' || echo '$(srcdir)/'`litest-device-synaptics-hover.c + +liblitest_la-litest-device-synaptics-st.lo: litest-device-synaptics-st.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-synaptics-st.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-synaptics-st.Tpo -c -o liblitest_la-litest-device-synaptics-st.lo `test -f 'litest-device-synaptics-st.c' || echo '$(srcdir)/'`litest-device-synaptics-st.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-synaptics-st.Tpo $(DEPDIR)/liblitest_la-litest-device-synaptics-st.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-synaptics-st.c' object='liblitest_la-litest-device-synaptics-st.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-synaptics-st.lo `test -f 'litest-device-synaptics-st.c' || echo '$(srcdir)/'`litest-device-synaptics-st.c + +liblitest_la-litest-device-synaptics-t440.lo: litest-device-synaptics-t440.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-synaptics-t440.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-synaptics-t440.Tpo -c -o liblitest_la-litest-device-synaptics-t440.lo `test -f 'litest-device-synaptics-t440.c' || echo '$(srcdir)/'`litest-device-synaptics-t440.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-synaptics-t440.Tpo $(DEPDIR)/liblitest_la-litest-device-synaptics-t440.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-synaptics-t440.c' object='liblitest_la-litest-device-synaptics-t440.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-synaptics-t440.lo `test -f 'litest-device-synaptics-t440.c' || echo '$(srcdir)/'`litest-device-synaptics-t440.c + +liblitest_la-litest-device-synaptics-x1-carbon-3rd.lo: litest-device-synaptics-x1-carbon-3rd.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-synaptics-x1-carbon-3rd.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-synaptics-x1-carbon-3rd.Tpo -c -o liblitest_la-litest-device-synaptics-x1-carbon-3rd.lo `test -f 'litest-device-synaptics-x1-carbon-3rd.c' || echo '$(srcdir)/'`litest-device-synaptics-x1-carbon-3rd.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-synaptics-x1-carbon-3rd.Tpo $(DEPDIR)/liblitest_la-litest-device-synaptics-x1-carbon-3rd.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-synaptics-x1-carbon-3rd.c' object='liblitest_la-litest-device-synaptics-x1-carbon-3rd.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-synaptics-x1-carbon-3rd.lo `test -f 'litest-device-synaptics-x1-carbon-3rd.c' || echo '$(srcdir)/'`litest-device-synaptics-x1-carbon-3rd.c + +liblitest_la-litest-device-trackpoint.lo: litest-device-trackpoint.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-trackpoint.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-trackpoint.Tpo -c -o liblitest_la-litest-device-trackpoint.lo `test -f 'litest-device-trackpoint.c' || echo '$(srcdir)/'`litest-device-trackpoint.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-trackpoint.Tpo $(DEPDIR)/liblitest_la-litest-device-trackpoint.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-trackpoint.c' object='liblitest_la-litest-device-trackpoint.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-trackpoint.lo `test -f 'litest-device-trackpoint.c' || echo '$(srcdir)/'`litest-device-trackpoint.c + +liblitest_la-litest-device-touch-screen.lo: litest-device-touch-screen.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-touch-screen.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-touch-screen.Tpo -c -o liblitest_la-litest-device-touch-screen.lo `test -f 'litest-device-touch-screen.c' || echo '$(srcdir)/'`litest-device-touch-screen.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-touch-screen.Tpo $(DEPDIR)/liblitest_la-litest-device-touch-screen.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-touch-screen.c' object='liblitest_la-litest-device-touch-screen.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-touch-screen.lo `test -f 'litest-device-touch-screen.c' || echo '$(srcdir)/'`litest-device-touch-screen.c + +liblitest_la-litest-device-wacom-touch.lo: litest-device-wacom-touch.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-wacom-touch.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-wacom-touch.Tpo -c -o liblitest_la-litest-device-wacom-touch.lo `test -f 'litest-device-wacom-touch.c' || echo '$(srcdir)/'`litest-device-wacom-touch.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-wacom-touch.Tpo $(DEPDIR)/liblitest_la-litest-device-wacom-touch.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-wacom-touch.c' object='liblitest_la-litest-device-wacom-touch.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-wacom-touch.lo `test -f 'litest-device-wacom-touch.c' || echo '$(srcdir)/'`litest-device-wacom-touch.c + +liblitest_la-litest-device-wacom-intuos-finger.lo: litest-device-wacom-intuos-finger.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-wacom-intuos-finger.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-wacom-intuos-finger.Tpo -c -o liblitest_la-litest-device-wacom-intuos-finger.lo `test -f 'litest-device-wacom-intuos-finger.c' || echo '$(srcdir)/'`litest-device-wacom-intuos-finger.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-wacom-intuos-finger.Tpo $(DEPDIR)/liblitest_la-litest-device-wacom-intuos-finger.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-wacom-intuos-finger.c' object='liblitest_la-litest-device-wacom-intuos-finger.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-wacom-intuos-finger.lo `test -f 'litest-device-wacom-intuos-finger.c' || echo '$(srcdir)/'`litest-device-wacom-intuos-finger.c + +liblitest_la-litest-device-wheel-only.lo: litest-device-wheel-only.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-wheel-only.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-wheel-only.Tpo -c -o liblitest_la-litest-device-wheel-only.lo `test -f 'litest-device-wheel-only.c' || echo '$(srcdir)/'`litest-device-wheel-only.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-wheel-only.Tpo $(DEPDIR)/liblitest_la-litest-device-wheel-only.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-wheel-only.c' object='liblitest_la-litest-device-wheel-only.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-wheel-only.lo `test -f 'litest-device-wheel-only.c' || echo '$(srcdir)/'`litest-device-wheel-only.c + +liblitest_la-litest-device-xen-virtual-pointer.lo: litest-device-xen-virtual-pointer.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-xen-virtual-pointer.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-xen-virtual-pointer.Tpo -c -o liblitest_la-litest-device-xen-virtual-pointer.lo `test -f 'litest-device-xen-virtual-pointer.c' || echo '$(srcdir)/'`litest-device-xen-virtual-pointer.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-xen-virtual-pointer.Tpo $(DEPDIR)/liblitest_la-litest-device-xen-virtual-pointer.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-xen-virtual-pointer.c' object='liblitest_la-litest-device-xen-virtual-pointer.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-xen-virtual-pointer.lo `test -f 'litest-device-xen-virtual-pointer.c' || echo '$(srcdir)/'`litest-device-xen-virtual-pointer.c + +liblitest_la-litest-device-vmware-virtual-usb-mouse.lo: litest-device-vmware-virtual-usb-mouse.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest-device-vmware-virtual-usb-mouse.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest-device-vmware-virtual-usb-mouse.Tpo -c -o liblitest_la-litest-device-vmware-virtual-usb-mouse.lo `test -f 'litest-device-vmware-virtual-usb-mouse.c' || echo '$(srcdir)/'`litest-device-vmware-virtual-usb-mouse.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest-device-vmware-virtual-usb-mouse.Tpo $(DEPDIR)/liblitest_la-litest-device-vmware-virtual-usb-mouse.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-device-vmware-virtual-usb-mouse.c' object='liblitest_la-litest-device-vmware-virtual-usb-mouse.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest-device-vmware-virtual-usb-mouse.lo `test -f 'litest-device-vmware-virtual-usb-mouse.c' || echo '$(srcdir)/'`litest-device-vmware-virtual-usb-mouse.c + +liblitest_la-litest.lo: litest.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -MT liblitest_la-litest.lo -MD -MP -MF $(DEPDIR)/liblitest_la-litest.Tpo -c -o liblitest_la-litest.lo `test -f 'litest.c' || echo '$(srcdir)/'`litest.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblitest_la-litest.Tpo $(DEPDIR)/liblitest_la-litest.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest.c' object='liblitest_la-litest.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblitest_la_CFLAGS) $(CFLAGS) -c -o liblitest_la-litest.lo `test -f 'litest.c' || echo '$(srcdir)/'`litest.c + +test_build_linker-build-pedantic.o: build-pedantic.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_linker_CFLAGS) $(CFLAGS) -MT test_build_linker-build-pedantic.o -MD -MP -MF $(DEPDIR)/test_build_linker-build-pedantic.Tpo -c -o test_build_linker-build-pedantic.o `test -f 'build-pedantic.c' || echo '$(srcdir)/'`build-pedantic.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_build_linker-build-pedantic.Tpo $(DEPDIR)/test_build_linker-build-pedantic.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='build-pedantic.c' object='test_build_linker-build-pedantic.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_linker_CFLAGS) $(CFLAGS) -c -o test_build_linker-build-pedantic.o `test -f 'build-pedantic.c' || echo '$(srcdir)/'`build-pedantic.c + +test_build_linker-build-pedantic.obj: build-pedantic.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_linker_CFLAGS) $(CFLAGS) -MT test_build_linker-build-pedantic.obj -MD -MP -MF $(DEPDIR)/test_build_linker-build-pedantic.Tpo -c -o test_build_linker-build-pedantic.obj `if test -f 'build-pedantic.c'; then $(CYGPATH_W) 'build-pedantic.c'; else $(CYGPATH_W) '$(srcdir)/build-pedantic.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_build_linker-build-pedantic.Tpo $(DEPDIR)/test_build_linker-build-pedantic.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='build-pedantic.c' object='test_build_linker-build-pedantic.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_linker_CFLAGS) $(CFLAGS) -c -o test_build_linker-build-pedantic.obj `if test -f 'build-pedantic.c'; then $(CYGPATH_W) 'build-pedantic.c'; else $(CYGPATH_W) '$(srcdir)/build-pedantic.c'; fi` + +test_build_pedantic_c99-build-pedantic.o: build-pedantic.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_pedantic_c99_CFLAGS) $(CFLAGS) -MT test_build_pedantic_c99-build-pedantic.o -MD -MP -MF $(DEPDIR)/test_build_pedantic_c99-build-pedantic.Tpo -c -o test_build_pedantic_c99-build-pedantic.o `test -f 'build-pedantic.c' || echo '$(srcdir)/'`build-pedantic.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_build_pedantic_c99-build-pedantic.Tpo $(DEPDIR)/test_build_pedantic_c99-build-pedantic.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='build-pedantic.c' object='test_build_pedantic_c99-build-pedantic.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_pedantic_c99_CFLAGS) $(CFLAGS) -c -o test_build_pedantic_c99-build-pedantic.o `test -f 'build-pedantic.c' || echo '$(srcdir)/'`build-pedantic.c + +test_build_pedantic_c99-build-pedantic.obj: build-pedantic.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_pedantic_c99_CFLAGS) $(CFLAGS) -MT test_build_pedantic_c99-build-pedantic.obj -MD -MP -MF $(DEPDIR)/test_build_pedantic_c99-build-pedantic.Tpo -c -o test_build_pedantic_c99-build-pedantic.obj `if test -f 'build-pedantic.c'; then $(CYGPATH_W) 'build-pedantic.c'; else $(CYGPATH_W) '$(srcdir)/build-pedantic.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_build_pedantic_c99-build-pedantic.Tpo $(DEPDIR)/test_build_pedantic_c99-build-pedantic.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='build-pedantic.c' object='test_build_pedantic_c99-build-pedantic.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_pedantic_c99_CFLAGS) $(CFLAGS) -c -o test_build_pedantic_c99-build-pedantic.obj `if test -f 'build-pedantic.c'; then $(CYGPATH_W) 'build-pedantic.c'; else $(CYGPATH_W) '$(srcdir)/build-pedantic.c'; fi` + +test_build_std_gnuc90-build-pedantic.o: build-pedantic.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_std_gnuc90_CFLAGS) $(CFLAGS) -MT test_build_std_gnuc90-build-pedantic.o -MD -MP -MF $(DEPDIR)/test_build_std_gnuc90-build-pedantic.Tpo -c -o test_build_std_gnuc90-build-pedantic.o `test -f 'build-pedantic.c' || echo '$(srcdir)/'`build-pedantic.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_build_std_gnuc90-build-pedantic.Tpo $(DEPDIR)/test_build_std_gnuc90-build-pedantic.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='build-pedantic.c' object='test_build_std_gnuc90-build-pedantic.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_std_gnuc90_CFLAGS) $(CFLAGS) -c -o test_build_std_gnuc90-build-pedantic.o `test -f 'build-pedantic.c' || echo '$(srcdir)/'`build-pedantic.c + +test_build_std_gnuc90-build-pedantic.obj: build-pedantic.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_std_gnuc90_CFLAGS) $(CFLAGS) -MT test_build_std_gnuc90-build-pedantic.obj -MD -MP -MF $(DEPDIR)/test_build_std_gnuc90-build-pedantic.Tpo -c -o test_build_std_gnuc90-build-pedantic.obj `if test -f 'build-pedantic.c'; then $(CYGPATH_W) 'build-pedantic.c'; else $(CYGPATH_W) '$(srcdir)/build-pedantic.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_build_std_gnuc90-build-pedantic.Tpo $(DEPDIR)/test_build_std_gnuc90-build-pedantic.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='build-pedantic.c' object='test_build_std_gnuc90-build-pedantic.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_std_gnuc90_CFLAGS) $(CFLAGS) -c -o test_build_std_gnuc90-build-pedantic.obj `if test -f 'build-pedantic.c'; then $(CYGPATH_W) 'build-pedantic.c'; else $(CYGPATH_W) '$(srcdir)/build-pedantic.c'; fi` + +test_litest_selftest-litest-selftest.o: litest-selftest.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_litest_selftest_CFLAGS) $(CFLAGS) -MT test_litest_selftest-litest-selftest.o -MD -MP -MF $(DEPDIR)/test_litest_selftest-litest-selftest.Tpo -c -o test_litest_selftest-litest-selftest.o `test -f 'litest-selftest.c' || echo '$(srcdir)/'`litest-selftest.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_litest_selftest-litest-selftest.Tpo $(DEPDIR)/test_litest_selftest-litest-selftest.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-selftest.c' object='test_litest_selftest-litest-selftest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_litest_selftest_CFLAGS) $(CFLAGS) -c -o test_litest_selftest-litest-selftest.o `test -f 'litest-selftest.c' || echo '$(srcdir)/'`litest-selftest.c + +test_litest_selftest-litest-selftest.obj: litest-selftest.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_litest_selftest_CFLAGS) $(CFLAGS) -MT test_litest_selftest-litest-selftest.obj -MD -MP -MF $(DEPDIR)/test_litest_selftest-litest-selftest.Tpo -c -o test_litest_selftest-litest-selftest.obj `if test -f 'litest-selftest.c'; then $(CYGPATH_W) 'litest-selftest.c'; else $(CYGPATH_W) '$(srcdir)/litest-selftest.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_litest_selftest-litest-selftest.Tpo $(DEPDIR)/test_litest_selftest-litest-selftest.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest-selftest.c' object='test_litest_selftest-litest-selftest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_litest_selftest_CFLAGS) $(CFLAGS) -c -o test_litest_selftest-litest-selftest.obj `if test -f 'litest-selftest.c'; then $(CYGPATH_W) 'litest-selftest.c'; else $(CYGPATH_W) '$(srcdir)/litest-selftest.c'; fi` + +test_litest_selftest-litest.o: litest.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_litest_selftest_CFLAGS) $(CFLAGS) -MT test_litest_selftest-litest.o -MD -MP -MF $(DEPDIR)/test_litest_selftest-litest.Tpo -c -o test_litest_selftest-litest.o `test -f 'litest.c' || echo '$(srcdir)/'`litest.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_litest_selftest-litest.Tpo $(DEPDIR)/test_litest_selftest-litest.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest.c' object='test_litest_selftest-litest.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_litest_selftest_CFLAGS) $(CFLAGS) -c -o test_litest_selftest-litest.o `test -f 'litest.c' || echo '$(srcdir)/'`litest.c + +test_litest_selftest-litest.obj: litest.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_litest_selftest_CFLAGS) $(CFLAGS) -MT test_litest_selftest-litest.obj -MD -MP -MF $(DEPDIR)/test_litest_selftest-litest.Tpo -c -o test_litest_selftest-litest.obj `if test -f 'litest.c'; then $(CYGPATH_W) 'litest.c'; else $(CYGPATH_W) '$(srcdir)/litest.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_litest_selftest-litest.Tpo $(DEPDIR)/test_litest_selftest-litest.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='litest.c' object='test_litest_selftest-litest.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_litest_selftest_CFLAGS) $(CFLAGS) -c -o test_litest_selftest-litest.obj `if test -f 'litest.c'; then $(CYGPATH_W) 'litest.c'; else $(CYGPATH_W) '$(srcdir)/litest.c'; fi` + +.cc.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cc.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< + +test_build_cxx-build-cxx.o: build-cxx.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_cxx_CXXFLAGS) $(CXXFLAGS) -MT test_build_cxx-build-cxx.o -MD -MP -MF $(DEPDIR)/test_build_cxx-build-cxx.Tpo -c -o test_build_cxx-build-cxx.o `test -f 'build-cxx.cc' || echo '$(srcdir)/'`build-cxx.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_build_cxx-build-cxx.Tpo $(DEPDIR)/test_build_cxx-build-cxx.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='build-cxx.cc' object='test_build_cxx-build-cxx.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_cxx_CXXFLAGS) $(CXXFLAGS) -c -o test_build_cxx-build-cxx.o `test -f 'build-cxx.cc' || echo '$(srcdir)/'`build-cxx.cc + +test_build_cxx-build-cxx.obj: build-cxx.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_cxx_CXXFLAGS) $(CXXFLAGS) -MT test_build_cxx-build-cxx.obj -MD -MP -MF $(DEPDIR)/test_build_cxx-build-cxx.Tpo -c -o test_build_cxx-build-cxx.obj `if test -f 'build-cxx.cc'; then $(CYGPATH_W) 'build-cxx.cc'; else $(CYGPATH_W) '$(srcdir)/build-cxx.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_build_cxx-build-cxx.Tpo $(DEPDIR)/test_build_cxx-build-cxx.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='build-cxx.cc' object='test_build_cxx-build-cxx.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_build_cxx_CXXFLAGS) $(CXXFLAGS) -c -o test_build_cxx-build-cxx.obj `if test -f 'build-cxx.cc'; then $(CYGPATH_W) 'build-cxx.cc'; else $(CYGPATH_W) '$(srcdir)/build-cxx.cc'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + 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-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + 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: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + 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 + +# Recover from deleted '.trs' file; this should ensure that +# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create +# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells +# to avoid problems with "make -n". +.log.trs: + rm -f $< $@ + $(MAKE) $(AM_MAKEFLAGS) $< + +# Leading 'am--fnord' is there to ensure the list of targets does not +# expand to empty, as could happen e.g. with make check TESTS=''. +am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) +am--force-recheck: + @: + +$(TEST_SUITE_LOG): $(TEST_LOGS) + @$(am__set_TESTS_bases); \ + am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ + redo_bases=`for i in $$bases; do \ + am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ + done`; \ + if test -n "$$redo_bases"; then \ + redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ + redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ + if $(am__make_dryrun); then :; else \ + rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ + fi; \ + fi; \ + if test -n "$$am__remaking_logs"; then \ + echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ + "recursion detected" >&2; \ + elif test -n "$$redo_logs"; then \ + am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ + fi; \ + if $(am__make_dryrun); then :; else \ + st=0; \ + errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ + for i in $$redo_bases; do \ + test -f $$i.trs && test -r $$i.trs \ + || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ + test -f $$i.log && test -r $$i.log \ + || { echo "$$errmsg $$i.log" >&2; st=1; }; \ + done; \ + test $$st -eq 0 || exit 1; \ + fi + @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ + ws='[ ]'; \ + results=`for b in $$bases; do echo $$b.trs; done`; \ + test -n "$$results" || results=/dev/null; \ + all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ + pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ + fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ + skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ + xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ + xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ + error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ + if test `expr $$fail + $$xpass + $$error` -eq 0; then \ + success=true; \ + else \ + success=false; \ + fi; \ + br='==================='; br=$$br$$br$$br$$br; \ + result_count () \ + { \ + if test x"$$1" = x"--maybe-color"; then \ + maybe_colorize=yes; \ + elif test x"$$1" = x"--no-color"; then \ + maybe_colorize=no; \ + else \ + echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + fi; \ + shift; \ + desc=$$1 count=$$2; \ + if test $$maybe_colorize = yes && test $$count -gt 0; then \ + color_start=$$3 color_end=$$std; \ + else \ + color_start= color_end=; \ + fi; \ + echo "$${color_start}# $$desc $$count$${color_end}"; \ + }; \ + create_testsuite_report () \ + { \ + result_count $$1 "TOTAL:" $$all "$$brg"; \ + result_count $$1 "PASS: " $$pass "$$grn"; \ + result_count $$1 "SKIP: " $$skip "$$blu"; \ + result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ + result_count $$1 "FAIL: " $$fail "$$red"; \ + result_count $$1 "XPASS:" $$xpass "$$red"; \ + result_count $$1 "ERROR:" $$error "$$mgn"; \ + }; \ + { \ + echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ + $(am__rst_title); \ + create_testsuite_report --no-color; \ + echo; \ + echo ".. contents:: :depth: 2"; \ + echo; \ + for b in $$bases; do echo $$b; done \ + | $(am__create_global_log); \ + } >$(TEST_SUITE_LOG).tmp || exit 1; \ + mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ + if $$success; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ + fi; \ + echo "$${col}$$br$${std}"; \ + echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ + echo "$${col}$$br$${std}"; \ + create_testsuite_report --maybe-color; \ + echo "$$col$$br$$std"; \ + if $$success; then :; else \ + echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ + if test -n "$(PACKAGE_BUGREPORT)"; then \ + echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ + fi; \ + echo "$$col$$br$$std"; \ + fi; \ + $$success || exit 1 + +check-TESTS: + @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list + @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + trs_list=`for i in $$bases; do echo $$i.trs; done`; \ + log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ + exit $$?; +recheck: all + @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + @set +e; $(am__set_TESTS_bases); \ + bases=`for i in $$bases; do echo $$i; done \ + | $(am__list_recheck_tests)` || exit 1; \ + log_list=`for i in $$bases; do echo $$i.log; done`; \ + log_list=`echo $$log_list`; \ + $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? +test-touchpad.log: test-touchpad$(EXEEXT) + @p='test-touchpad$(EXEEXT)'; \ + b='test-touchpad'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-touchpad-tap.log: test-touchpad-tap$(EXEEXT) + @p='test-touchpad-tap$(EXEEXT)'; \ + b='test-touchpad-tap'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-touchpad-buttons.log: test-touchpad-buttons$(EXEEXT) + @p='test-touchpad-buttons$(EXEEXT)'; \ + b='test-touchpad-buttons'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-device.log: test-device$(EXEEXT) + @p='test-device$(EXEEXT)'; \ + b='test-device'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-gestures.log: test-gestures$(EXEEXT) + @p='test-gestures$(EXEEXT)'; \ + b='test-gestures'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-pointer.log: test-pointer$(EXEEXT) + @p='test-pointer$(EXEEXT)'; \ + b='test-pointer'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-touch.log: test-touch$(EXEEXT) + @p='test-touch$(EXEEXT)'; \ + b='test-touch'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-trackpoint.log: test-trackpoint$(EXEEXT) + @p='test-trackpoint$(EXEEXT)'; \ + b='test-trackpoint'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-udev.log: test-udev$(EXEEXT) + @p='test-udev$(EXEEXT)'; \ + b='test-udev'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-path.log: test-path$(EXEEXT) + @p='test-path$(EXEEXT)'; \ + b='test-path'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-log.log: test-log$(EXEEXT) + @p='test-log$(EXEEXT)'; \ + b='test-log'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-misc.log: test-misc$(EXEEXT) + @p='test-misc$(EXEEXT)'; \ + b='test-misc'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-keyboard.log: test-keyboard$(EXEEXT) + @p='test-keyboard$(EXEEXT)'; \ + b='test-keyboard'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +test-litest-selftest.log: test-litest-selftest$(EXEEXT) + @p='test-litest-selftest$(EXEEXT)'; \ + b='test-litest-selftest'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +symbols-leak-test.log: symbols-leak-test + @p='symbols-leak-test'; \ + b='symbols-leak-test'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +.test.log: + @p='$<'; \ + $(am__set_b); \ + $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) +@am__EXEEXT_TRUE@.test$(EXEEXT).log: +@am__EXEEXT_TRUE@ @p='$<'; \ +@am__EXEEXT_TRUE@ $(am__set_b); \ +@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ +@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ +@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ +@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + +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 + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) +installdirs: +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: + -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) + -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) + -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) + +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-libtool clean-noinstLTLIBRARIES \ + clean-noinstPROGRAMS 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-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +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: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + clean-noinstPROGRAMS cscopelist-am ctags ctags-am 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-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am recheck tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + + +@BUILD_TESTS_TRUE@.NOTPARALLEL: + +@BUILD_TESTS_TRUE@@HAVE_VALGRIND_TRUE@valgrind: +@BUILD_TESTS_TRUE@@HAVE_VALGRIND_TRUE@ $(MAKE) check-TESTS LOG_COMPILER="$(VALGRIND)" LOG_FLAGS="$(VALGRIND_FLAGS)" CK_FORK=no USING_VALGRIND=yes + +@BUILD_TESTS_TRUE@@HAVE_VALGRIND_TRUE@check: valgrind + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru libinput-1.10.3/test/misc.c libinput-0.21.0/test/misc.c --- libinput-1.10.3/test/misc.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/misc.c 2015-08-03 03:44:47.000000000 +0000 @@ -0,0 +1,717 @@ +/* + * Copyright © 2014 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include "litest.h" + +static int open_restricted(const char *path, int flags, void *data) +{ + int fd = open(path, flags); + return fd < 0 ? -errno : fd; +} +static void close_restricted(int fd, void *data) +{ + close(fd); +} + +const struct libinput_interface simple_interface = { + .open_restricted = open_restricted, + .close_restricted = close_restricted, +}; + +static struct libevdev_uinput * +create_simple_test_device(const char *name, ...) +{ + va_list args; + struct libevdev_uinput *uinput; + struct libevdev *evdev; + unsigned int type, code; + int rc; + struct input_absinfo abs = { + .value = -1, + .minimum = 0, + .maximum = 100, + .fuzz = 0, + .flat = 0, + .resolution = 100, + }; + + evdev = libevdev_new(); + litest_assert_notnull(evdev); + libevdev_set_name(evdev, name); + + va_start(args, name); + + while ((type = va_arg(args, unsigned int)) != (unsigned int)-1 && + (code = va_arg(args, unsigned int)) != (unsigned int)-1) { + const struct input_absinfo *a = NULL; + if (type == EV_ABS) + a = &abs; + libevdev_enable_event_code(evdev, type, code, a); + } + + va_end(args); + + rc = libevdev_uinput_create_from_device(evdev, + LIBEVDEV_UINPUT_OPEN_MANAGED, + &uinput); + litest_assert_int_eq(rc, 0); + libevdev_free(evdev); + + return uinput; +} + +START_TEST(event_conversion_device_notify) +{ + struct libevdev_uinput *uinput; + struct libinput *li; + struct libinput_event *event; + int device_added = 0, device_removed = 0; + + uinput = create_simple_test_device("litest test device", + EV_REL, REL_X, + EV_REL, REL_Y, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_MIDDLE, + EV_KEY, BTN_LEFT, + -1, -1); + li = libinput_path_create_context(&simple_interface, NULL); + libinput_path_add_device(li, libevdev_uinput_get_devnode(uinput)); + + libinput_dispatch(li); + libinput_suspend(li); + libinput_resume(li); + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + + if (type == LIBINPUT_EVENT_DEVICE_ADDED || + type == LIBINPUT_EVENT_DEVICE_REMOVED) { + struct libinput_event_device_notify *dn; + struct libinput_event *base; + dn = libinput_event_get_device_notify_event(event); + base = libinput_event_device_notify_get_base_event(dn); + ck_assert(event == base); + + if (type == LIBINPUT_EVENT_DEVICE_ADDED) + device_added++; + else if (type == LIBINPUT_EVENT_DEVICE_REMOVED) + device_removed++; + + litest_disable_log_handler(li); + ck_assert(libinput_event_get_pointer_event(event) == NULL); + ck_assert(libinput_event_get_keyboard_event(event) == NULL); + ck_assert(libinput_event_get_touch_event(event) == NULL); + ck_assert(libinput_event_get_gesture_event(event) == NULL); + litest_restore_log_handler(li); + } + + libinput_event_destroy(event); + } + + libinput_unref(li); + libevdev_uinput_destroy(uinput); + + ck_assert_int_gt(device_added, 0); + ck_assert_int_gt(device_removed, 0); +} +END_TEST + +START_TEST(event_conversion_pointer) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + int motion = 0, button = 0; + + /* Queue at least two relative motion events as the first one may + * be absorbed by the pointer acceleration filter. */ + litest_event(dev, EV_REL, REL_X, -1); + litest_event(dev, EV_REL, REL_Y, -1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_REL, REL_X, -1); + litest_event(dev, EV_REL, REL_Y, -1); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + + if (type == LIBINPUT_EVENT_POINTER_MOTION || + type == LIBINPUT_EVENT_POINTER_BUTTON) { + struct libinput_event_pointer *p; + struct libinput_event *base; + p = libinput_event_get_pointer_event(event); + base = libinput_event_pointer_get_base_event(p); + ck_assert(event == base); + + if (type == LIBINPUT_EVENT_POINTER_MOTION) + motion++; + else if (type == LIBINPUT_EVENT_POINTER_BUTTON) + button++; + + litest_disable_log_handler(li); + ck_assert(libinput_event_get_device_notify_event(event) == NULL); + ck_assert(libinput_event_get_keyboard_event(event) == NULL); + ck_assert(libinput_event_get_touch_event(event) == NULL); + ck_assert(libinput_event_get_gesture_event(event) == NULL); + litest_restore_log_handler(li); + } + libinput_event_destroy(event); + } + + ck_assert_int_gt(motion, 0); + ck_assert_int_gt(button, 0); +} +END_TEST + +START_TEST(event_conversion_pointer_abs) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + int motion = 0, button = 0; + + litest_event(dev, EV_ABS, ABS_X, 10); + litest_event(dev, EV_ABS, ABS_Y, 50); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_ABS, ABS_X, 30); + litest_event(dev, EV_ABS, ABS_Y, 30); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + + if (type == LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE || + type == LIBINPUT_EVENT_POINTER_BUTTON) { + struct libinput_event_pointer *p; + struct libinput_event *base; + p = libinput_event_get_pointer_event(event); + base = libinput_event_pointer_get_base_event(p); + ck_assert(event == base); + + if (type == LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE) + motion++; + else if (type == LIBINPUT_EVENT_POINTER_BUTTON) + button++; + + litest_disable_log_handler(li); + ck_assert(libinput_event_get_device_notify_event(event) == NULL); + ck_assert(libinput_event_get_keyboard_event(event) == NULL); + ck_assert(libinput_event_get_touch_event(event) == NULL); + ck_assert(libinput_event_get_gesture_event(event) == NULL); + litest_restore_log_handler(li); + } + libinput_event_destroy(event); + } + + ck_assert_int_gt(motion, 0); + ck_assert_int_gt(button, 0); +} +END_TEST + +START_TEST(event_conversion_key) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + int key = 0; + + litest_event(dev, EV_KEY, KEY_A, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, KEY_A, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + + if (type == LIBINPUT_EVENT_KEYBOARD_KEY) { + struct libinput_event_keyboard *k; + struct libinput_event *base; + k = libinput_event_get_keyboard_event(event); + base = libinput_event_keyboard_get_base_event(k); + ck_assert(event == base); + + key++; + + litest_disable_log_handler(li); + ck_assert(libinput_event_get_device_notify_event(event) == NULL); + ck_assert(libinput_event_get_pointer_event(event) == NULL); + ck_assert(libinput_event_get_touch_event(event) == NULL); + ck_assert(libinput_event_get_gesture_event(event) == NULL); + litest_restore_log_handler(li); + } + libinput_event_destroy(event); + } + + ck_assert_int_gt(key, 0); +} +END_TEST + +START_TEST(event_conversion_touch) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + int touch = 0; + + libinput_dispatch(li); + + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); + litest_event(dev, EV_KEY, BTN_TOUCH, 1); + litest_event(dev, EV_ABS, ABS_X, 10); + litest_event(dev, EV_ABS, ABS_Y, 10); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 1); + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 10); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 10); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + + if (type >= LIBINPUT_EVENT_TOUCH_DOWN && + type <= LIBINPUT_EVENT_TOUCH_FRAME) { + struct libinput_event_touch *t; + struct libinput_event *base; + t = libinput_event_get_touch_event(event); + base = libinput_event_touch_get_base_event(t); + ck_assert(event == base); + + touch++; + + litest_disable_log_handler(li); + ck_assert(libinput_event_get_device_notify_event(event) == NULL); + ck_assert(libinput_event_get_pointer_event(event) == NULL); + ck_assert(libinput_event_get_keyboard_event(event) == NULL); + ck_assert(libinput_event_get_gesture_event(event) == NULL); + litest_restore_log_handler(li); + } + libinput_event_destroy(event); + } + + ck_assert_int_gt(touch, 0); +} +END_TEST + +START_TEST(event_conversion_gesture) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + int gestures = 0; + int i; + + libinput_dispatch(li); + + litest_touch_down(dev, 0, 70, 30); + litest_touch_down(dev, 1, 30, 70); + for (i = 0; i < 8; i++) { + litest_push_event_frame(dev); + litest_touch_move(dev, 0, 70 - i * 5, 30 + i * 5); + litest_touch_move(dev, 1, 30 + i * 5, 70 - i * 5); + litest_pop_event_frame(dev); + libinput_dispatch(li); + } + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + + if (type >= LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN && + type <= LIBINPUT_EVENT_GESTURE_PINCH_END) { + struct libinput_event_gesture *g; + struct libinput_event *base; + g = libinput_event_get_gesture_event(event); + base = libinput_event_gesture_get_base_event(g); + ck_assert(event == base); + + gestures++; + + litest_disable_log_handler(li); + ck_assert(libinput_event_get_device_notify_event(event) == NULL); + ck_assert(libinput_event_get_pointer_event(event) == NULL); + ck_assert(libinput_event_get_keyboard_event(event) == NULL); + ck_assert(libinput_event_get_touch_event(event) == NULL); + litest_restore_log_handler(li); + } + libinput_event_destroy(event); + } + + ck_assert_int_gt(gestures, 0); +} +END_TEST + +START_TEST(context_ref_counting) +{ + struct libinput *li; + + /* These tests rely on valgrind to detect memory leak and use after + * free errors. */ + + li = libinput_path_create_context(&simple_interface, NULL); + ck_assert_notnull(li); + ck_assert_ptr_eq(libinput_unref(li), NULL); + + li = libinput_path_create_context(&simple_interface, NULL); + ck_assert_notnull(li); + ck_assert_ptr_eq(libinput_ref(li), li); + ck_assert_ptr_eq(libinput_unref(li), li); + ck_assert_ptr_eq(libinput_unref(li), NULL); +} +END_TEST + +START_TEST(config_status_string) +{ + const char *strs[3]; + const char *invalid; + size_t i, j; + + strs[0] = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_SUCCESS); + strs[1] = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_UNSUPPORTED); + strs[2] = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_INVALID); + + for (i = 0; i < ARRAY_LENGTH(strs) - 1; i++) + for (j = i + 1; j < ARRAY_LENGTH(strs); j++) + ck_assert_str_ne(strs[i], strs[j]); + + invalid = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_INVALID + 1); + ck_assert(invalid == NULL); + invalid = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_SUCCESS - 1); + ck_assert(invalid == NULL); +} +END_TEST + +START_TEST(matrix_helpers) +{ + struct matrix m1, m2, m3; + float f[6] = { 1, 2, 3, 4, 5, 6 }; + int x, y; + int row, col; + + matrix_init_identity(&m1); + + for (row = 0; row < 3; row++) { + for (col = 0; col < 3; col++) { + ck_assert_int_eq(m1.val[row][col], + (row == col) ? 1 : 0); + } + } + ck_assert(matrix_is_identity(&m1)); + + matrix_from_farray6(&m2, f); + ck_assert_int_eq(m2.val[0][0], 1); + ck_assert_int_eq(m2.val[0][1], 2); + ck_assert_int_eq(m2.val[0][2], 3); + ck_assert_int_eq(m2.val[1][0], 4); + ck_assert_int_eq(m2.val[1][1], 5); + ck_assert_int_eq(m2.val[1][2], 6); + ck_assert_int_eq(m2.val[2][0], 0); + ck_assert_int_eq(m2.val[2][1], 0); + ck_assert_int_eq(m2.val[2][2], 1); + + x = 100; + y = 5; + matrix_mult_vec(&m1, &x, &y); + ck_assert_int_eq(x, 100); + ck_assert_int_eq(y, 5); + + matrix_mult(&m3, &m1, &m1); + ck_assert(matrix_is_identity(&m3)); + + matrix_init_scale(&m2, 2, 4); + ck_assert_int_eq(m2.val[0][0], 2); + ck_assert_int_eq(m2.val[0][1], 0); + ck_assert_int_eq(m2.val[0][2], 0); + ck_assert_int_eq(m2.val[1][0], 0); + ck_assert_int_eq(m2.val[1][1], 4); + ck_assert_int_eq(m2.val[1][2], 0); + ck_assert_int_eq(m2.val[2][0], 0); + ck_assert_int_eq(m2.val[2][1], 0); + ck_assert_int_eq(m2.val[2][2], 1); + + matrix_mult_vec(&m2, &x, &y); + ck_assert_int_eq(x, 200); + ck_assert_int_eq(y, 20); + + matrix_init_translate(&m2, 10, 100); + ck_assert_int_eq(m2.val[0][0], 1); + ck_assert_int_eq(m2.val[0][1], 0); + ck_assert_int_eq(m2.val[0][2], 10); + ck_assert_int_eq(m2.val[1][0], 0); + ck_assert_int_eq(m2.val[1][1], 1); + ck_assert_int_eq(m2.val[1][2], 100); + ck_assert_int_eq(m2.val[2][0], 0); + ck_assert_int_eq(m2.val[2][1], 0); + ck_assert_int_eq(m2.val[2][2], 1); + + matrix_mult_vec(&m2, &x, &y); + ck_assert_int_eq(x, 210); + ck_assert_int_eq(y, 120); + + matrix_to_farray6(&m2, f); + ck_assert_int_eq(f[0], 1); + ck_assert_int_eq(f[1], 0); + ck_assert_int_eq(f[2], 10); + ck_assert_int_eq(f[3], 0); + ck_assert_int_eq(f[4], 1); + ck_assert_int_eq(f[5], 100); +} +END_TEST + +START_TEST(ratelimit_helpers) +{ + struct ratelimit rl; + unsigned int i, j; + + /* 10 attempts every 100ms */ + ratelimit_init(&rl, ms2us(100), 10); + + for (j = 0; j < 3; ++j) { + /* a burst of 9 attempts must succeed */ + for (i = 0; i < 9; ++i) { + ck_assert_int_eq(ratelimit_test(&rl), + RATELIMIT_PASS); + } + + /* the 10th attempt reaches the threshold */ + ck_assert_int_eq(ratelimit_test(&rl), RATELIMIT_THRESHOLD); + + /* ..then further attempts must fail.. */ + ck_assert_int_eq(ratelimit_test(&rl), RATELIMIT_EXCEEDED); + + /* ..regardless of how often we try. */ + for (i = 0; i < 100; ++i) { + ck_assert_int_eq(ratelimit_test(&rl), + RATELIMIT_EXCEEDED); + } + + /* ..even after waiting 20ms */ + msleep(20); + for (i = 0; i < 100; ++i) { + ck_assert_int_eq(ratelimit_test(&rl), + RATELIMIT_EXCEEDED); + } + + /* but after 100ms the counter is reset */ + msleep(90); /* +10ms to account for time drifts */ + } +} +END_TEST + +struct parser_test { + char *tag; + int expected_value; +}; + +START_TEST(dpi_parser) +{ + struct parser_test tests[] = { + { "450 *1800 3200", 1800 }, + { "*450 1800 3200", 450 }, + { "450 1800 *3200", 3200 }, + { "450 1800 3200", 3200 }, + { "450 1800 failboat", 0 }, + { "450 1800 *failboat", 0 }, + { "0 450 1800 *3200", 0 }, + { "450@37 1800@12 *3200@6", 3200 }, + { "450@125 1800@125 *3200@125 ", 3200 }, + { "450@125 *1800@125 3200@125", 1800 }, + { "*this @string fails", 0 }, + { "12@34 *45@", 0 }, + { "12@a *45@", 0 }, + { "12@a *45@25", 0 }, + { " * 12, 450, 800", 0 }, + { " *12, 450, 800", 12 }, + { "*12, *450, 800", 12 }, + { "*-23412, 450, 800", 0 }, + { "112@125, 450@125, 800@125, 900@-125", 0 }, + { "", 0 }, + { " ", 0 }, + { "* ", 0 }, + { NULL, 0 } + }; + int i, dpi; + + for (i = 0; tests[i].tag != NULL; i++) { + dpi = parse_mouse_dpi_property(tests[i].tag); + ck_assert_int_eq(dpi, tests[i].expected_value); + } +} +END_TEST + +START_TEST(wheel_click_parser) +{ + struct parser_test tests[] = { + { "1", 1 }, + { "10", 10 }, + { "-12", -12 }, + { "360", 360 }, + { "66 ", 66 }, + { " 100 ", 100 }, + + { "0", 0 }, + { "-0", 0 }, + { "a", 0 }, + { "10a", 0 }, + { "10-", 0 }, + { "sadfasfd", 0 }, + { "361", 0 }, + { NULL, 0 } + }; + + int i, angle; + + for (i = 0; tests[i].tag != NULL; i++) { + angle = parse_mouse_wheel_click_angle_property(tests[i].tag); + ck_assert_int_eq(angle, tests[i].expected_value); + } +} +END_TEST + +struct parser_test_float { + char *tag; + double expected_value; +}; + +START_TEST(trackpoint_accel_parser) +{ + struct parser_test_float tests[] = { + { "0.5", 0.5 }, + { "1.0", 1.0 }, + { "2.0", 2.0 }, + { "fail1.0", 0.0 }, + { "1.0fail", 0.0 }, + { "0,5", 0.0 }, + { NULL, 0.0 } + }; + int i; + double accel; + + for (i = 0; tests[i].tag != NULL; i++) { + accel = parse_trackpoint_accel_property(tests[i].tag); + ck_assert(accel == tests[i].expected_value); + } +} +END_TEST + +struct parser_test_dimension { + char *tag; + bool success; + int x, y; +}; + +START_TEST(dimension_prop_parser) +{ + struct parser_test_dimension tests[] = { + { "10x10", true, 10, 10 }, + { "1x20", true, 1, 20 }, + { "1x8000", true, 1, 8000 }, + { "238492x428210", true, 238492, 428210 }, + { "0x0", true, 0, 0 }, + { "-10x10", false, 0, 0 }, + { "-1", false, 0, 0 }, + { "1x-99", false, 0, 0 }, + { "0", false, 0, 0 }, + { "100", false, 0, 0 }, + { "", false, 0, 0 }, + { "abd", false, 0, 0 }, + { "xabd", false, 0, 0 }, + { "0xaf", false, 0, 0 }, + { "0x0x", true, 0, 0 }, + { "x10", false, 0, 0 }, + { NULL, false, 0, 0 } + }; + int i; + size_t x, y; + bool success; + + for (i = 0; tests[i].tag != NULL; i++) { + x = y = 0xad; + success = parse_dimension_property(tests[i].tag, &x, &y); + ck_assert(success == tests[i].success); + if (success) { + ck_assert_int_eq(x, tests[i].x); + ck_assert_int_eq(y, tests[i].y); + } else { + ck_assert_int_eq(x, 0xad); + ck_assert_int_eq(y, 0xad); + } + } +} +END_TEST + +START_TEST(time_conversion) +{ + ck_assert_int_eq(us(10), 10); + ck_assert_int_eq(ns2us(10000), 10); + ck_assert_int_eq(ms2us(10), 10000); + ck_assert_int_eq(s2us(1), 1000000); + ck_assert_int_eq(us2ms(10000), 10); +} +END_TEST + +void +litest_setup_tests(void) +{ + litest_add_no_device("events:conversion", event_conversion_device_notify); + litest_add_for_device("events:conversion", event_conversion_pointer, LITEST_MOUSE); + litest_add_for_device("events:conversion", event_conversion_pointer, LITEST_MOUSE); + litest_add_for_device("events:conversion", event_conversion_pointer_abs, LITEST_XEN_VIRTUAL_POINTER); + litest_add_for_device("events:conversion", event_conversion_key, LITEST_KEYBOARD); + litest_add_for_device("events:conversion", event_conversion_touch, LITEST_WACOM_TOUCH); + litest_add_for_device("events:conversion", event_conversion_gesture, LITEST_BCM5974); + + litest_add_no_device("context:refcount", context_ref_counting); + litest_add_no_device("config:status string", config_status_string); + + litest_add_no_device("misc:matrix", matrix_helpers); + litest_add_no_device("misc:ratelimit", ratelimit_helpers); + litest_add_no_device("misc:parser", dpi_parser); + litest_add_no_device("misc:parser", wheel_click_parser); + litest_add_no_device("misc:parser", trackpoint_accel_parser); + litest_add_no_device("misc:parser", dimension_prop_parser); + litest_add_no_device("misc:time", time_conversion); +} diff -Nru libinput-1.10.3/test/path.c libinput-0.21.0/test/path.c --- libinput-1.10.3/test/path.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/path.c 2015-08-03 03:44:47.000000000 +0000 @@ -0,0 +1,902 @@ +/* + * Copyright © 2013 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include + +#include +#include +#include +#include +#include + +#include "litest.h" + +static int open_func_count = 0; +static int close_func_count = 0; + +static int open_restricted(const char *path, int flags, void *data) +{ + int fd; + open_func_count++; + fd = open(path, flags); + return fd < 0 ? -errno : fd; +} +static void close_restricted(int fd, void *data) +{ + close_func_count++; + close(fd); +} + +const struct libinput_interface simple_interface = { + .open_restricted = open_restricted, + .close_restricted = close_restricted, +}; + +START_TEST(path_create_NULL) +{ + struct libinput *li; + + open_func_count = 0; + close_func_count = 0; + + li = libinput_path_create_context(NULL, NULL); + ck_assert(li == NULL); + li = libinput_path_create_context(&simple_interface, NULL); + ck_assert(li != NULL); + libinput_unref(li); + + ck_assert_int_eq(open_func_count, 0); + ck_assert_int_eq(close_func_count, 0); + + open_func_count = 0; + close_func_count = 0; +} +END_TEST + +START_TEST(path_create_invalid) +{ + struct libinput *li; + struct libinput_device *device; + const char *path = "/tmp"; + + open_func_count = 0; + close_func_count = 0; + + li = libinput_path_create_context(&simple_interface, NULL); + ck_assert(li != NULL); + device = libinput_path_add_device(li, path); + ck_assert(device == NULL); + + ck_assert_int_eq(open_func_count, 0); + ck_assert_int_eq(close_func_count, 0); + + libinput_unref(li); + ck_assert_int_eq(close_func_count, 0); + + open_func_count = 0; + close_func_count = 0; +} +END_TEST + +START_TEST(path_create_destroy) +{ + struct libinput *li; + struct libinput_device *device; + struct libevdev_uinput *uinput; + int rc; + void *userdata = &rc; + + uinput = litest_create_uinput_device("test device", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_REL, REL_X, + EV_REL, REL_Y, + -1); + + li = libinput_path_create_context(&simple_interface, userdata); + ck_assert(li != NULL); + ck_assert(libinput_get_user_data(li) == userdata); + + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput)); + ck_assert(device != NULL); + + ck_assert_int_eq(open_func_count, 1); + + libevdev_uinput_destroy(uinput); + libinput_unref(li); + ck_assert_int_eq(close_func_count, 1); + + open_func_count = 0; + close_func_count = 0; +} +END_TEST + +START_TEST(path_set_user_data) +{ + struct libinput *li; + int data1, data2; + + li = libinput_path_create_context(&simple_interface, &data1); + ck_assert(li != NULL); + ck_assert(libinput_get_user_data(li) == &data1); + libinput_set_user_data(li, &data2); + ck_assert(libinput_get_user_data(li) == &data2); + + libinput_unref(li); +} +END_TEST + +START_TEST(path_added_seat) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_device *device; + struct libinput_seat *seat; + const char *seat_name; + enum libinput_event_type type; + + libinput_dispatch(li); + + event = libinput_get_event(li); + ck_assert(event != NULL); + + type = libinput_event_get_type(event); + ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); + + device = libinput_event_get_device(event); + seat = libinput_device_get_seat(device); + ck_assert(seat != NULL); + + seat_name = libinput_seat_get_logical_name(seat); + ck_assert_str_eq(seat_name, "default"); + + libinput_event_destroy(event); +} +END_TEST + +START_TEST(path_seat_change) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_device *device; + struct libinput_seat *seat1, *seat2; + const char *seat1_name; + const char *seat2_name = "new seat"; + int rc; + + libinput_dispatch(li); + + event = libinput_get_event(li); + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_DEVICE_ADDED); + + device = libinput_event_get_device(event); + libinput_device_ref(device); + + seat1 = libinput_device_get_seat(device); + libinput_seat_ref(seat1); + + seat1_name = libinput_seat_get_logical_name(seat1); + libinput_event_destroy(event); + + litest_drain_events(li); + + rc = libinput_device_set_seat_logical_name(device, + seat2_name); + ck_assert_int_eq(rc, 0); + + libinput_dispatch(li); + + event = libinput_get_event(li); + ck_assert(event != NULL); + + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_DEVICE_REMOVED); + + ck_assert(libinput_event_get_device(event) == device); + libinput_event_destroy(event); + + event = libinput_get_event(li); + ck_assert(event != NULL); + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_DEVICE_ADDED); + ck_assert(libinput_event_get_device(event) != device); + libinput_device_unref(device); + + device = libinput_event_get_device(event); + seat2 = libinput_device_get_seat(device); + + ck_assert_str_ne(libinput_seat_get_logical_name(seat2), + seat1_name); + ck_assert_str_eq(libinput_seat_get_logical_name(seat2), + seat2_name); + libinput_event_destroy(event); + + libinput_seat_unref(seat1); + + /* litest: swap the new device in, so cleanup works */ + libinput_device_unref(dev->libinput_device); + libinput_device_ref(device); + dev->libinput_device = device; +} +END_TEST + +START_TEST(path_added_device) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_device *device; + + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + + if (type == LIBINPUT_EVENT_DEVICE_ADDED) { + break; + } + + libinput_event_destroy(event); + } + + ck_assert(event != NULL); + + device = libinput_event_get_device(event); + ck_assert(device != NULL); + + libinput_event_destroy(event); +} +END_TEST + +START_TEST(path_add_device) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_device *device; + const char *sysname1 = NULL, *sysname2 = NULL; + + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + + if (type == LIBINPUT_EVENT_DEVICE_ADDED) { + ck_assert(sysname1 == NULL); + device = libinput_event_get_device(event); + ck_assert(device != NULL); + sysname1 = libinput_device_get_sysname(device); + } + + libinput_event_destroy(event); + } + + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(dev->uinput)); + ck_assert(device != NULL); + + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + + if (type == LIBINPUT_EVENT_DEVICE_ADDED) { + ck_assert(sysname2 == NULL); + device = libinput_event_get_device(event); + ck_assert(device != NULL); + sysname2 = libinput_device_get_sysname(device); + } + + libinput_event_destroy(event); + } + + ck_assert_str_eq(sysname1, sysname2); + + libinput_event_destroy(event); +} +END_TEST + +START_TEST(path_add_invalid_path) +{ + struct libinput *li; + struct libinput_event *event; + struct libinput_device *device; + + li = litest_create_context(); + + litest_disable_log_handler(li); + device = libinput_path_add_device(li, "/tmp/"); + litest_restore_log_handler(li); + ck_assert(device == NULL); + + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) + ck_abort(); + + libinput_unref(li); +} +END_TEST + +START_TEST(path_device_sysname) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_event *ev; + struct libinput_device *device; + const char *sysname; + + libinput_dispatch(dev->libinput); + + while ((ev = libinput_get_event(dev->libinput))) { + if (libinput_event_get_type(ev) != LIBINPUT_EVENT_DEVICE_ADDED) + continue; + + device = libinput_event_get_device(ev); + sysname = libinput_device_get_sysname(device); + ck_assert(sysname != NULL && strlen(sysname) > 1); + ck_assert(strchr(sysname, '/') == NULL); + ck_assert_int_eq(strncmp(sysname, "event", 5), 0); + + libinput_event_destroy(ev); + } +} +END_TEST + +START_TEST(path_remove_device) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_device *device; + int remove_event = 0; + + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(dev->uinput)); + ck_assert(device != NULL); + litest_drain_events(li); + + libinput_path_remove_device(device); + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + + if (type == LIBINPUT_EVENT_DEVICE_REMOVED) + remove_event++; + + libinput_event_destroy(event); + } + + ck_assert_int_eq(remove_event, 1); +} +END_TEST + +START_TEST(path_double_remove_device) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_device *device; + int remove_event = 0; + + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(dev->uinput)); + ck_assert(device != NULL); + litest_drain_events(li); + + libinput_path_remove_device(device); + libinput_path_remove_device(device); + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + + if (type == LIBINPUT_EVENT_DEVICE_REMOVED) + remove_event++; + + libinput_event_destroy(event); + } + + ck_assert_int_eq(remove_event, 1); +} +END_TEST + +START_TEST(path_suspend) +{ + struct libinput *li; + struct libinput_device *device; + struct libevdev_uinput *uinput; + int rc; + void *userdata = &rc; + + uinput = litest_create_uinput_device("test device", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_REL, REL_X, + EV_REL, REL_Y, + -1); + + li = libinput_path_create_context(&simple_interface, userdata); + ck_assert(li != NULL); + + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput)); + ck_assert(device != NULL); + + libinput_suspend(li); + libinput_resume(li); + + libevdev_uinput_destroy(uinput); + libinput_unref(li); + + open_func_count = 0; + close_func_count = 0; +} +END_TEST + +START_TEST(path_double_suspend) +{ + struct libinput *li; + struct libinput_device *device; + struct libevdev_uinput *uinput; + int rc; + void *userdata = &rc; + + uinput = litest_create_uinput_device("test device", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_REL, REL_X, + EV_REL, REL_Y, + -1); + + li = libinput_path_create_context(&simple_interface, userdata); + ck_assert(li != NULL); + + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput)); + ck_assert(device != NULL); + + libinput_suspend(li); + libinput_suspend(li); + libinput_resume(li); + + libevdev_uinput_destroy(uinput); + libinput_unref(li); + + open_func_count = 0; + close_func_count = 0; +} +END_TEST + +START_TEST(path_double_resume) +{ + struct libinput *li; + struct libinput_device *device; + struct libevdev_uinput *uinput; + int rc; + void *userdata = &rc; + + uinput = litest_create_uinput_device("test device", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_REL, REL_X, + EV_REL, REL_Y, + -1); + + li = libinput_path_create_context(&simple_interface, userdata); + ck_assert(li != NULL); + + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput)); + ck_assert(device != NULL); + + libinput_suspend(li); + libinput_resume(li); + libinput_resume(li); + + libevdev_uinput_destroy(uinput); + libinput_unref(li); + + open_func_count = 0; + close_func_count = 0; +} +END_TEST + +START_TEST(path_add_device_suspend_resume) +{ + struct libinput *li; + struct libinput_device *device; + struct libinput_event *event; + struct libevdev_uinput *uinput1, *uinput2; + int rc; + int nevents; + void *userdata = &rc; + + uinput1 = litest_create_uinput_device("test device", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_REL, REL_X, + EV_REL, REL_Y, + -1); + uinput2 = litest_create_uinput_device("test device 2", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_REL, REL_X, + EV_REL, REL_Y, + -1); + + li = libinput_path_create_context(&simple_interface, userdata); + ck_assert(li != NULL); + + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput1)); + ck_assert(device != NULL); + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput2)); + + libinput_dispatch(li); + + nevents = 0; + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); + libinput_event_destroy(event); + nevents++; + } + + ck_assert_int_eq(nevents, 2); + + libinput_suspend(li); + libinput_dispatch(li); + + nevents = 0; + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_REMOVED); + libinput_event_destroy(event); + nevents++; + } + + ck_assert_int_eq(nevents, 2); + + libinput_resume(li); + libinput_dispatch(li); + + nevents = 0; + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); + libinput_event_destroy(event); + nevents++; + } + + ck_assert_int_eq(nevents, 2); + + libevdev_uinput_destroy(uinput1); + libevdev_uinput_destroy(uinput2); + libinput_unref(li); + + open_func_count = 0; + close_func_count = 0; +} +END_TEST + +START_TEST(path_add_device_suspend_resume_fail) +{ + struct libinput *li; + struct libinput_device *device; + struct libinput_event *event; + struct libevdev_uinput *uinput1, *uinput2; + int rc; + int nevents; + void *userdata = &rc; + + uinput1 = litest_create_uinput_device("test device", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_REL, REL_X, + EV_REL, REL_Y, + -1); + uinput2 = litest_create_uinput_device("test device 2", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_REL, REL_X, + EV_REL, REL_Y, + -1); + + li = libinput_path_create_context(&simple_interface, userdata); + ck_assert(li != NULL); + + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput1)); + ck_assert(device != NULL); + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput2)); + ck_assert(device != NULL); + + libinput_dispatch(li); + + nevents = 0; + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); + libinput_event_destroy(event); + nevents++; + } + + ck_assert_int_eq(nevents, 2); + + libinput_suspend(li); + libinput_dispatch(li); + + nevents = 0; + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_REMOVED); + libinput_event_destroy(event); + nevents++; + } + + ck_assert_int_eq(nevents, 2); + + /* now drop one of the devices */ + libevdev_uinput_destroy(uinput1); + rc = libinput_resume(li); + ck_assert_int_eq(rc, -1); + + libinput_dispatch(li); + + nevents = 0; + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + /* We expect one device being added, second one fails, + * causing a removed event for the first one */ + if (type != LIBINPUT_EVENT_DEVICE_ADDED && + type != LIBINPUT_EVENT_DEVICE_REMOVED) + ck_abort(); + libinput_event_destroy(event); + nevents++; + } + + ck_assert_int_eq(nevents, 2); + + libevdev_uinput_destroy(uinput2); + libinput_unref(li); + + open_func_count = 0; + close_func_count = 0; +} +END_TEST + +START_TEST(path_add_device_suspend_resume_remove_device) +{ + struct libinput *li; + struct libinput_device *device; + struct libinput_event *event; + struct libevdev_uinput *uinput1, *uinput2; + int rc; + int nevents; + void *userdata = &rc; + + uinput1 = litest_create_uinput_device("test device", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_REL, REL_X, + EV_REL, REL_Y, + -1); + uinput2 = litest_create_uinput_device("test device 2", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_REL, REL_X, + EV_REL, REL_Y, + -1); + + li = libinput_path_create_context(&simple_interface, userdata); + ck_assert(li != NULL); + + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput1)); + ck_assert(device != NULL); + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput2)); + + libinput_device_ref(device); + libinput_dispatch(li); + + nevents = 0; + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); + libinput_event_destroy(event); + nevents++; + } + + ck_assert_int_eq(nevents, 2); + + libinput_suspend(li); + libinput_dispatch(li); + + nevents = 0; + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_REMOVED); + libinput_event_destroy(event); + nevents++; + } + + ck_assert_int_eq(nevents, 2); + + /* now drop and remove one of the devices */ + libevdev_uinput_destroy(uinput2); + libinput_path_remove_device(device); + libinput_device_unref(device); + + rc = libinput_resume(li); + ck_assert_int_eq(rc, 0); + + libinput_dispatch(li); + + nevents = 0; + while ((event = libinput_get_event(li))) { + enum libinput_event_type type; + type = libinput_event_get_type(event); + ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); + libinput_event_destroy(event); + nevents++; + } + + ck_assert_int_eq(nevents, 1); + + libevdev_uinput_destroy(uinput1); + libinput_unref(li); + + open_func_count = 0; + close_func_count = 0; +} +END_TEST + +START_TEST(path_seat_recycle) +{ + struct libinput *li; + struct libevdev_uinput *uinput; + int rc; + void *userdata = &rc; + struct libinput_event *ev; + struct libinput_device *device; + struct libinput_seat *saved_seat = NULL; + struct libinput_seat *seat; + int data = 0; + int found = 0; + void *user_data; + + uinput = litest_create_uinput_device("test device", NULL, + EV_KEY, BTN_LEFT, + EV_KEY, BTN_RIGHT, + EV_REL, REL_X, + EV_REL, REL_Y, + -1); + + li = libinput_path_create_context(&simple_interface, userdata); + ck_assert(li != NULL); + + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput)); + ck_assert(device != NULL); + + libinput_dispatch(li); + while ((ev = libinput_get_event(li))) { + switch (libinput_event_get_type(ev)) { + case LIBINPUT_EVENT_DEVICE_ADDED: + if (saved_seat) + break; + + device = libinput_event_get_device(ev); + ck_assert(device != NULL); + saved_seat = libinput_device_get_seat(device); + libinput_seat_set_user_data(saved_seat, &data); + libinput_seat_ref(saved_seat); + break; + default: + break; + } + + libinput_event_destroy(ev); + } + + ck_assert(saved_seat != NULL); + + libinput_suspend(li); + + litest_drain_events(li); + + libinput_resume(li); + + libinput_dispatch(li); + while ((ev = libinput_get_event(li))) { + switch (libinput_event_get_type(ev)) { + case LIBINPUT_EVENT_DEVICE_ADDED: + device = libinput_event_get_device(ev); + ck_assert(device != NULL); + + seat = libinput_device_get_seat(device); + user_data = libinput_seat_get_user_data(seat); + if (user_data == &data) { + found = 1; + ck_assert(seat == saved_seat); + } + break; + default: + break; + } + + libinput_event_destroy(ev); + } + + ck_assert(found == 1); + + libinput_unref(li); + + libevdev_uinput_destroy(uinput); +} +END_TEST + +void +litest_setup_tests(void) +{ + litest_add_no_device("path:create", path_create_NULL); + litest_add_no_device("path:create", path_create_invalid); + litest_add_no_device("path:create", path_create_destroy); + litest_add_no_device("path:create", path_set_user_data); + litest_add_no_device("path:suspend", path_suspend); + litest_add_no_device("path:suspend", path_double_suspend); + litest_add_no_device("path:suspend", path_double_resume); + litest_add_no_device("path:suspend", path_add_device_suspend_resume); + litest_add_no_device("path:suspend", path_add_device_suspend_resume_fail); + litest_add_no_device("path:suspend", path_add_device_suspend_resume_remove_device); + litest_add_for_device("path:seat", path_added_seat, LITEST_SYNAPTICS_CLICKPAD); + litest_add_for_device("path:seat", path_seat_change, LITEST_SYNAPTICS_CLICKPAD); + litest_add("path:device events", path_added_device, LITEST_ANY, LITEST_ANY); + litest_add("path:device events", path_device_sysname, LITEST_ANY, LITEST_ANY); + litest_add_for_device("path:device events", path_add_device, LITEST_SYNAPTICS_CLICKPAD); + litest_add_no_device("path:device events", path_add_invalid_path); + litest_add_for_device("path:device events", path_remove_device, LITEST_SYNAPTICS_CLICKPAD); + litest_add_for_device("path:device events", path_double_remove_device, LITEST_SYNAPTICS_CLICKPAD); + litest_add_no_device("path:seat", path_seat_recycle); +} diff -Nru libinput-1.10.3/test/pointer.c libinput-0.21.0/test/pointer.c --- libinput-1.10.3/test/pointer.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/pointer.c 2015-08-03 03:44:47.000000000 +0000 @@ -0,0 +1,1497 @@ +/* + * Copyright © 2013 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libinput-util.h" +#include "litest.h" + +static void +test_relative_event(struct litest_device *dev, int dx, int dy) +{ + struct libinput *li = dev->libinput; + struct libinput_event_pointer *ptrev; + struct libinput_event *event; + double ev_dx, ev_dy; + double expected_dir; + double expected_length; + double actual_dir; + double actual_length; + + litest_event(dev, EV_REL, REL_X, dx); + litest_event(dev, EV_REL, REL_Y, dy); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + + event = libinput_get_event(li); + ptrev = litest_is_motion_event(event); + + expected_length = sqrt(4 * dx*dx + 4 * dy*dy); + expected_dir = atan2(dx, dy); + + ev_dx = libinput_event_pointer_get_dx(ptrev); + ev_dy = libinput_event_pointer_get_dy(ptrev); + actual_length = sqrt(ev_dx*ev_dx + ev_dy*ev_dy); + actual_dir = atan2(ev_dx, ev_dy); + + /* Check the length of the motion vector (tolerate 1.0 indifference). */ + litest_assert(fabs(expected_length) >= actual_length); + + /* Check the direction of the motion vector (tolerate 2π/4 radians + * indifference). */ + litest_assert(fabs(expected_dir - actual_dir) < M_PI_2); + + libinput_event_destroy(event); + + litest_drain_events(dev->libinput); +} + +static void +disable_button_scrolling(struct litest_device *device) +{ + struct libinput_device *dev = device->libinput_device; + enum libinput_config_status status, + expected; + + status = libinput_device_config_scroll_set_method(dev, + LIBINPUT_CONFIG_SCROLL_NO_SCROLL); + + expected = LIBINPUT_CONFIG_STATUS_SUCCESS; + litest_assert_int_eq(status, expected); +} + +START_TEST(pointer_motion_relative) +{ + struct litest_device *dev = litest_current_device(); + + /* send a single event, the first movement + is always decelerated by 0.3 */ + litest_event(dev, EV_REL, REL_X, 1); + litest_event(dev, EV_REL, REL_Y, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(dev->libinput); + + litest_drain_events(dev->libinput); + + test_relative_event(dev, 1, 0); + test_relative_event(dev, 1, 1); + test_relative_event(dev, 1, -1); + test_relative_event(dev, 0, 1); + + test_relative_event(dev, -1, 0); + test_relative_event(dev, -1, 1); + test_relative_event(dev, -1, -1); + test_relative_event(dev, 0, -1); +} +END_TEST + +START_TEST(pointer_motion_relative_zero) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + int i; + + /* NOTE: this test does virtually nothing. The kernel should not + * allow 0/0 events to be passed to userspace. If it ever happens, + * let's hope this test fails if we do the wrong thing. + */ + litest_drain_events(li); + + for (i = 0; i < 5; i++) { + litest_event(dev, EV_REL, REL_X, 0); + litest_event(dev, EV_REL, REL_Y, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + } + litest_assert_empty_queue(li); + + /* send a single event, the first movement + is always decelerated by 0.3 */ + litest_event(dev, EV_REL, REL_X, 1); + litest_event(dev, EV_REL, REL_Y, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + libinput_event_destroy(libinput_get_event(li)); + litest_assert_empty_queue(li); + + for (i = 0; i < 5; i++) { + litest_event(dev, EV_REL, REL_X, 0); + litest_event(dev, EV_REL, REL_Y, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(dev->libinput); + } + litest_assert_empty_queue(li); + +} +END_TEST + +START_TEST(pointer_motion_relative_min_decel) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event_pointer *ptrev; + struct libinput_event *event; + double evx, evy; + int dx, dy; + int cardinal = _i; /* ranged test */ + double len; + + int deltas[8][2] = { + /* N, NE, E, ... */ + { 0, 1 }, + { 1, 1 }, + { 1, 0 }, + { 1, -1 }, + { 0, -1 }, + { -1, -1 }, + { -1, 0 }, + { -1, 1 }, + }; + + litest_drain_events(dev->libinput); + + dx = deltas[cardinal][0]; + dy = deltas[cardinal][1]; + + litest_event(dev, EV_REL, REL_X, dx); + litest_event(dev, EV_REL, REL_Y, dy); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + event = libinput_get_event(li); + ptrev = litest_is_motion_event(event); + evx = libinput_event_pointer_get_dx(ptrev); + evy = libinput_event_pointer_get_dy(ptrev); + + ck_assert((evx == 0.0) == (dx == 0)); + ck_assert((evy == 0.0) == (dy == 0)); + + len = hypot(evx, evy); + ck_assert(fabs(len) >= 0.3); + + libinput_event_destroy(event); +} +END_TEST + +static void +test_absolute_event(struct litest_device *dev, double x, double y) +{ + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + double ex, ey; + enum libinput_event_type type = LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE; + + litest_touch_down(dev, 0, x, y); + libinput_dispatch(li); + + event = libinput_get_event(li); + litest_assert_notnull(event); + litest_assert_int_eq(libinput_event_get_type(event), type); + + ptrev = libinput_event_get_pointer_event(event); + litest_assert(ptrev != NULL); + + ex = libinput_event_pointer_get_absolute_x_transformed(ptrev, 100); + ey = libinput_event_pointer_get_absolute_y_transformed(ptrev, 100); + litest_assert_int_eq((int)(ex + 0.5), (int)x); + litest_assert_int_eq((int)(ey + 0.5), (int)y); + + libinput_event_destroy(event); +} + +START_TEST(pointer_motion_absolute) +{ + struct litest_device *dev = litest_current_device(); + + litest_drain_events(dev->libinput); + + test_absolute_event(dev, 0, 100); + test_absolute_event(dev, 100, 0); + test_absolute_event(dev, 50, 50); +} +END_TEST + +START_TEST(pointer_absolute_initial_state) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *libinput1, *libinput2; + struct libinput_event *ev1, *ev2; + struct libinput_event_pointer *p1, *p2; + int axis = _i; /* looped test */ + + libinput1 = dev->libinput; + litest_touch_down(dev, 0, 40, 60); + litest_touch_up(dev, 0); + + /* device is now on some x/y value */ + litest_drain_events(libinput1); + + libinput2 = litest_create_context(); + libinput_path_add_device(libinput2, + libevdev_uinput_get_devnode(dev->uinput)); + litest_drain_events(libinput2); + + if (axis == ABS_X) + litest_touch_down(dev, 0, 40, 70); + else + litest_touch_down(dev, 0, 70, 60); + litest_touch_up(dev, 0); + + litest_wait_for_event(libinput1); + litest_wait_for_event(libinput2); + + while (libinput_next_event_type(libinput1)) { + ev1 = libinput_get_event(libinput1); + ev2 = libinput_get_event(libinput2); + + ck_assert_int_eq(libinput_event_get_type(ev1), + LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE); + ck_assert_int_eq(libinput_event_get_type(ev1), + libinput_event_get_type(ev2)); + + p1 = libinput_event_get_pointer_event(ev1); + p2 = libinput_event_get_pointer_event(ev2); + + ck_assert_int_eq(libinput_event_pointer_get_absolute_x(p1), + libinput_event_pointer_get_absolute_x(p2)); + ck_assert_int_eq(libinput_event_pointer_get_absolute_y(p1), + libinput_event_pointer_get_absolute_y(p2)); + + libinput_event_destroy(ev1); + libinput_event_destroy(ev2); + } + + libinput_unref(libinput2); +} +END_TEST + +static void +test_unaccel_event(struct litest_device *dev, int dx, int dy) +{ + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + double ev_dx, ev_dy; + + litest_event(dev, EV_REL, REL_X, dx); + litest_event(dev, EV_REL, REL_Y, dy); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + + event = libinput_get_event(li); + ptrev = litest_is_motion_event(event); + + ev_dx = libinput_event_pointer_get_dx_unaccelerated(ptrev); + ev_dy = libinput_event_pointer_get_dy_unaccelerated(ptrev); + + litest_assert_int_eq(dx, ev_dx); + litest_assert_int_eq(dy, ev_dy); + + libinput_event_destroy(event); + + litest_drain_events(dev->libinput); +} + +START_TEST(pointer_motion_unaccel) +{ + struct litest_device *dev = litest_current_device(); + + litest_drain_events(dev->libinput); + + test_unaccel_event(dev, 10, 0); + test_unaccel_event(dev, 10, 10); + test_unaccel_event(dev, 10, -10); + test_unaccel_event(dev, 0, 10); + + test_unaccel_event(dev, -10, 0); + test_unaccel_event(dev, -10, 10); + test_unaccel_event(dev, -10, -10); + test_unaccel_event(dev, 0, -10); +} +END_TEST + +static void +test_button_event(struct litest_device *dev, unsigned int button, int state) +{ + struct libinput *li = dev->libinput; + + litest_event(dev, EV_KEY, button, state); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, button, + state ? LIBINPUT_BUTTON_STATE_PRESSED : + LIBINPUT_BUTTON_STATE_RELEASED); +} + +START_TEST(pointer_button) +{ + struct litest_device *dev = litest_current_device(); + + disable_button_scrolling(dev); + + litest_drain_events(dev->libinput); + + test_button_event(dev, BTN_LEFT, 1); + test_button_event(dev, BTN_LEFT, 0); + + /* press it twice for good measure */ + test_button_event(dev, BTN_LEFT, 1); + test_button_event(dev, BTN_LEFT, 0); + + if (libevdev_has_event_code(dev->evdev, EV_KEY, BTN_RIGHT)) { + test_button_event(dev, BTN_RIGHT, 1); + test_button_event(dev, BTN_RIGHT, 0); + } + + /* Skip middle button test on trackpoints (used for scrolling) */ + if (libevdev_has_event_code(dev->evdev, EV_KEY, BTN_MIDDLE)) { + test_button_event(dev, BTN_MIDDLE, 1); + test_button_event(dev, BTN_MIDDLE, 0); + } +} +END_TEST + +START_TEST(pointer_button_auto_release) +{ + struct libinput *libinput; + struct litest_device *dev; + struct libinput_event *event; + enum libinput_event_type type; + struct libinput_event_pointer *pevent; + struct { + int code; + int released; + } buttons[] = { + { .code = BTN_LEFT, }, + { .code = BTN_MIDDLE, }, + { .code = BTN_EXTRA, }, + { .code = BTN_SIDE, }, + { .code = BTN_BACK, }, + { .code = BTN_FORWARD, }, + { .code = BTN_4, }, + }; + int events[2 * (ARRAY_LENGTH(buttons) + 1)]; + unsigned i; + int button; + int valid_code; + + /* Enable all tested buttons on the device */ + for (i = 0; i < 2 * ARRAY_LENGTH(buttons);) { + button = buttons[i / 2].code; + events[i++] = EV_KEY; + events[i++] = button; + } + events[i++] = -1; + events[i++] = -1; + + libinput = litest_create_context(); + dev = litest_add_device_with_overrides(libinput, + LITEST_MOUSE, + "Generic mouse", + NULL, NULL, events); + + litest_drain_events(libinput); + + /* Send pressed events, without releasing */ + for (i = 0; i < ARRAY_LENGTH(buttons); ++i) { + test_button_event(dev, buttons[i].code, 1); + } + + litest_drain_events(libinput); + + /* "Disconnect" device */ + litest_delete_device(dev); + + /* Mark all released buttons until device is removed */ + while (1) { + event = libinput_get_event(libinput); + ck_assert_notnull(event); + type = libinput_event_get_type(event); + + if (type == LIBINPUT_EVENT_DEVICE_REMOVED) { + libinput_event_destroy(event); + break; + } + + ck_assert_int_eq(type, LIBINPUT_EVENT_POINTER_BUTTON); + pevent = libinput_event_get_pointer_event(event); + ck_assert_int_eq(libinput_event_pointer_get_button_state(pevent), + LIBINPUT_BUTTON_STATE_RELEASED); + button = libinput_event_pointer_get_button(pevent); + + valid_code = 0; + for (i = 0; i < ARRAY_LENGTH(buttons); ++i) { + if (buttons[i].code == button) { + ck_assert_int_eq(buttons[i].released, 0); + buttons[i].released = 1; + valid_code = 1; + } + } + ck_assert_int_eq(valid_code, 1); + libinput_event_destroy(event); + } + + /* Check that all pressed buttons has been released. */ + for (i = 0; i < ARRAY_LENGTH(buttons); ++i) { + ck_assert_int_eq(buttons[i].released, 1); + } + + libinput_unref(libinput); +} +END_TEST + +static void +test_wheel_event(struct litest_device *dev, int which, int amount) +{ + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + enum libinput_pointer_axis axis; + + /* the current evdev implementation scales the scroll wheel events + up by a factor 15 */ + const int scroll_step = 15; + int expected = amount * scroll_step; + int discrete = amount; + + if (libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device)) { + expected *= -1; + discrete *= -1; + } + + /* mouse scroll wheels are 'upside down' */ + if (which == REL_WHEEL) + amount *= -1; + litest_event(dev, EV_REL, which, amount); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + + axis = (which == REL_WHEEL) ? + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL : + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL; + event = libinput_get_event(li); + ptrev = litest_is_axis_event(event, + axis, + LIBINPUT_POINTER_AXIS_SOURCE_WHEEL); + + litest_assert_int_eq(libinput_event_pointer_get_axis_value(ptrev, axis), + expected); + litest_assert_int_eq(libinput_event_pointer_get_axis_value_discrete(ptrev, axis), + discrete); + libinput_event_destroy(event); +} + +START_TEST(pointer_scroll_wheel) +{ + struct litest_device *dev = litest_current_device(); + + litest_drain_events(dev->libinput); + + /* make sure we hit at least one of the below two conditions */ + ck_assert(libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL) || + libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL)); + + if (libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) { + test_wheel_event(dev, REL_WHEEL, -1); + test_wheel_event(dev, REL_WHEEL, 1); + + test_wheel_event(dev, REL_WHEEL, -5); + test_wheel_event(dev, REL_WHEEL, 6); + } + + if (libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL)) { + test_wheel_event(dev, REL_HWHEEL, -1); + test_wheel_event(dev, REL_HWHEEL, 1); + + test_wheel_event(dev, REL_HWHEEL, -5); + test_wheel_event(dev, REL_HWHEEL, 6); + } +} +END_TEST + +START_TEST(pointer_scroll_natural_defaults) +{ + struct litest_device *dev = litest_current_device(); + + ck_assert_int_ge(libinput_device_config_scroll_has_natural_scroll(dev->libinput_device), 1); + ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); + ck_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), 0); +} +END_TEST + +START_TEST(pointer_scroll_natural_enable_config) +{ + struct litest_device *dev = litest_current_device(); + enum libinput_config_status status; + + status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 1); + + status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 0); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); +} +END_TEST + +START_TEST(pointer_scroll_natural_wheel) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + + litest_drain_events(dev->libinput); + + libinput_device_config_scroll_set_natural_scroll_enabled(device, 1); + + /* make sure we hit at least one of the below two conditions */ + ck_assert(libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL) || + libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL)); + + if (libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) { + test_wheel_event(dev, REL_WHEEL, -1); + test_wheel_event(dev, REL_WHEEL, 1); + + test_wheel_event(dev, REL_WHEEL, -5); + test_wheel_event(dev, REL_WHEEL, 6); + } + + if (libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL)) { + test_wheel_event(dev, REL_HWHEEL, -1); + test_wheel_event(dev, REL_HWHEEL, 1); + + test_wheel_event(dev, REL_HWHEEL, -5); + test_wheel_event(dev, REL_HWHEEL, 6); + } +} +END_TEST + +START_TEST(pointer_seat_button_count) +{ + const int num_devices = 4; + struct litest_device *devices[num_devices]; + struct libinput *libinput; + struct libinput_event *ev; + struct libinput_event_pointer *tev; + int i; + int seat_button_count = 0; + int expected_seat_button_count = 0; + char device_name[255]; + + libinput = litest_create_context(); + for (i = 0; i < num_devices; ++i) { + sprintf(device_name, "litest Generic mouse (%d)", i); + devices[i] = litest_add_device_with_overrides(libinput, + LITEST_MOUSE, + device_name, + NULL, NULL, NULL); + } + + for (i = 0; i < num_devices; ++i) + litest_button_click(devices[i], BTN_LEFT, true); + + libinput_dispatch(libinput); + while ((ev = libinput_get_event(libinput))) { + if (libinput_event_get_type(ev) != + LIBINPUT_EVENT_POINTER_BUTTON) { + libinput_event_destroy(ev); + libinput_dispatch(libinput); + continue; + } + + tev = libinput_event_get_pointer_event(ev); + ck_assert_notnull(tev); + ck_assert_int_eq(libinput_event_pointer_get_button(tev), + BTN_LEFT); + ck_assert_int_eq(libinput_event_pointer_get_button_state(tev), + LIBINPUT_BUTTON_STATE_PRESSED); + + ++expected_seat_button_count; + seat_button_count = + libinput_event_pointer_get_seat_button_count(tev); + ck_assert_int_eq(expected_seat_button_count, seat_button_count); + + libinput_event_destroy(ev); + libinput_dispatch(libinput); + } + + ck_assert_int_eq(seat_button_count, num_devices); + + for (i = 0; i < num_devices; ++i) + litest_button_click(devices[i], BTN_LEFT, false); + + libinput_dispatch(libinput); + while ((ev = libinput_get_event(libinput))) { + if (libinput_event_get_type(ev) != + LIBINPUT_EVENT_POINTER_BUTTON) { + libinput_event_destroy(ev); + libinput_dispatch(libinput); + continue; + } + + tev = libinput_event_get_pointer_event(ev); + ck_assert_notnull(tev); + ck_assert_int_eq(libinput_event_pointer_get_button(tev), + BTN_LEFT); + ck_assert_int_eq(libinput_event_pointer_get_button_state(tev), + LIBINPUT_BUTTON_STATE_RELEASED); + + --expected_seat_button_count; + seat_button_count = + libinput_event_pointer_get_seat_button_count(tev); + ck_assert_int_eq(expected_seat_button_count, seat_button_count); + + libinput_event_destroy(ev); + libinput_dispatch(libinput); + } + + ck_assert_int_eq(seat_button_count, 0); + + for (i = 0; i < num_devices; ++i) + litest_delete_device(devices[i]); + libinput_unref(libinput); +} +END_TEST + +START_TEST(pointer_no_calibration) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + enum libinput_config_status status; + int rc; + float calibration[6] = {0}; + + rc = libinput_device_config_calibration_has_matrix(d); + ck_assert_int_eq(rc, 0); + rc = libinput_device_config_calibration_get_matrix(d, calibration); + ck_assert_int_eq(rc, 0); + rc = libinput_device_config_calibration_get_default_matrix(d, + calibration); + ck_assert_int_eq(rc, 0); + + status = libinput_device_config_calibration_set_matrix(d, + calibration); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); +} +END_TEST + +START_TEST(pointer_left_handed_defaults) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + int rc; + + rc = libinput_device_config_left_handed_is_available(d); + ck_assert_int_ne(rc, 0); + + rc = libinput_device_config_left_handed_get(d); + ck_assert_int_eq(rc, 0); + + rc = libinput_device_config_left_handed_get_default(d); + ck_assert_int_eq(rc, 0); +} +END_TEST + +START_TEST(pointer_left_handed) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + struct libinput *li = dev->libinput; + enum libinput_config_status status; + + status = libinput_device_config_left_handed_set(d, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_drain_events(li); + litest_button_click(dev, BTN_LEFT, 1); + litest_button_click(dev, BTN_LEFT, 0); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_button_click(dev, BTN_RIGHT, 1); + litest_button_click(dev, BTN_RIGHT, 0); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + if (libevdev_has_event_code(dev->evdev, + EV_KEY, + BTN_MIDDLE)) { + litest_button_click(dev, BTN_MIDDLE, 1); + litest_button_click(dev, BTN_MIDDLE, 0); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + } +} +END_TEST + +START_TEST(pointer_left_handed_during_click) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + struct libinput *li = dev->libinput; + enum libinput_config_status status; + + litest_drain_events(li); + litest_button_click(dev, BTN_LEFT, 1); + libinput_dispatch(li); + + /* Change while button is down, expect correct release event */ + status = libinput_device_config_left_handed_set(d, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_button_click(dev, BTN_LEFT, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(pointer_left_handed_during_click_multiple_buttons) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + struct libinput *li = dev->libinput; + enum libinput_config_status status; + + litest_drain_events(li); + litest_button_click(dev, BTN_LEFT, 1); + libinput_dispatch(li); + + status = libinput_device_config_left_handed_set(d, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + /* No left-handed until all buttons were down */ + litest_button_click(dev, BTN_RIGHT, 1); + litest_button_click(dev, BTN_RIGHT, 0); + litest_button_click(dev, BTN_LEFT, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(pointer_scroll_button) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + /* Make left button switch to scrolling mode */ + libinput_device_config_scroll_set_method(dev->libinput_device, + LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); + libinput_device_config_scroll_set_button(dev->libinput_device, + BTN_LEFT); + + litest_drain_events(li); + + litest_button_scroll(dev, BTN_LEFT, 1, 6); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 6); + litest_button_scroll(dev, BTN_LEFT, 1, -7); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -7); + litest_button_scroll(dev, BTN_LEFT, 8, 1); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 8); + litest_button_scroll(dev, BTN_LEFT, -9, 1); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -9); + + /* scroll smaller than the threshold should not generate events */ + litest_button_scroll(dev, BTN_LEFT, 1, 1); + /* left press without movement should not generate events */ + litest_button_scroll(dev, BTN_LEFT, 0, 0); + + litest_assert_empty_queue(li); + + /* Restore default scroll behavior */ + libinput_device_config_scroll_set_method(dev->libinput_device, + libinput_device_config_scroll_get_default_method( + dev->libinput_device)); + libinput_device_config_scroll_set_button(dev->libinput_device, + libinput_device_config_scroll_get_default_button( + dev->libinput_device)); +} +END_TEST + +START_TEST(pointer_scroll_nowheel_defaults) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_scroll_method method; + uint32_t button; + + method = libinput_device_config_scroll_get_method(device); + ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); + + method = libinput_device_config_scroll_get_default_method(device); + ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); + + button = libinput_device_config_scroll_get_button(device); + ck_assert_int_eq(button, BTN_MIDDLE); + button = libinput_device_config_scroll_get_default_button(device); + ck_assert_int_eq(button, BTN_MIDDLE); +} +END_TEST + +START_TEST(pointer_accel_defaults) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_status status; + double speed; + + ck_assert(libinput_device_config_accel_is_available(device)); + ck_assert_double_eq(libinput_device_config_accel_get_default_speed(device), + 0.0); + ck_assert_double_eq(libinput_device_config_accel_get_speed(device), + 0.0); + + for (speed = -2.0; speed < -1.0; speed += 0.2) { + status = libinput_device_config_accel_set_speed(device, + speed); + ck_assert_int_eq(status, + LIBINPUT_CONFIG_STATUS_INVALID); + ck_assert_double_eq(libinput_device_config_accel_get_speed(device), + 0.0); + } + + for (speed = -1.0; speed <= 1.0; speed += 0.2) { + status = libinput_device_config_accel_set_speed(device, + speed); + ck_assert_int_eq(status, + LIBINPUT_CONFIG_STATUS_SUCCESS); + ck_assert_double_eq(libinput_device_config_accel_get_speed(device), + speed); + } + + for (speed = 1.2; speed <= -2.0; speed += 0.2) { + status = libinput_device_config_accel_set_speed(device, + speed); + ck_assert_int_eq(status, + LIBINPUT_CONFIG_STATUS_INVALID); + ck_assert_double_eq(libinput_device_config_accel_get_speed(device), + 1.0); + } + +} +END_TEST + +START_TEST(pointer_accel_invalid) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_status status; + + ck_assert(libinput_device_config_accel_is_available(device)); + + status = libinput_device_config_accel_set_speed(device, + NAN); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); + status = libinput_device_config_accel_set_speed(device, + INFINITY); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); +} +END_TEST + +START_TEST(pointer_accel_defaults_absolute) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_status status; + double speed; + + ck_assert(!libinput_device_config_accel_is_available(device)); + ck_assert_double_eq(libinput_device_config_accel_get_default_speed(device), + 0.0); + ck_assert_double_eq(libinput_device_config_accel_get_speed(device), + 0.0); + + for (speed = -2.0; speed <= 2.0; speed += 0.2) { + status = libinput_device_config_accel_set_speed(device, + speed); + if (speed >= -1.0 && speed <= 1.0) + ck_assert_int_eq(status, + LIBINPUT_CONFIG_STATUS_UNSUPPORTED); + else + ck_assert_int_eq(status, + LIBINPUT_CONFIG_STATUS_INVALID); + ck_assert_double_eq(libinput_device_config_accel_get_speed(device), + 0.0); + } +} +END_TEST + +START_TEST(pointer_accel_defaults_absolute_relative) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + + ck_assert(libinput_device_config_accel_is_available(device)); + ck_assert_double_eq(libinput_device_config_accel_get_default_speed(device), + 0.0); + ck_assert_double_eq(libinput_device_config_accel_get_speed(device), + 0.0); +} +END_TEST + +START_TEST(pointer_accel_direction_change) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *pev; + int i; + double delta; + + litest_drain_events(li); + + for (i = 0; i < 10; i++) { + litest_event(dev, EV_REL, REL_X, -1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + } + litest_event(dev, EV_REL, REL_X, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + litest_wait_for_event_of_type(li, + LIBINPUT_EVENT_POINTER_MOTION, + -1); + event = libinput_get_event(li); + do { + pev = libinput_event_get_pointer_event(event); + + delta = libinput_event_pointer_get_dx(pev); + ck_assert_double_le(delta, 0.0); + libinput_event_destroy(event); + event = libinput_get_event(li); + } while (libinput_next_event_type(li) != LIBINPUT_EVENT_NONE); + + pev = libinput_event_get_pointer_event(event); + delta = libinput_event_pointer_get_dx(pev); + ck_assert_double_gt(delta, 0.0); + libinput_event_destroy(event); +} +END_TEST + +START_TEST(middlebutton) +{ + struct litest_device *device = litest_current_device(); + struct libinput *li = device->libinput; + enum libinput_config_status status; + unsigned int i; + const int btn[][4] = { + { BTN_LEFT, BTN_RIGHT, BTN_LEFT, BTN_RIGHT }, + { BTN_LEFT, BTN_RIGHT, BTN_RIGHT, BTN_LEFT }, + { BTN_RIGHT, BTN_LEFT, BTN_LEFT, BTN_RIGHT }, + { BTN_RIGHT, BTN_LEFT, BTN_RIGHT, BTN_LEFT }, + }; + + disable_button_scrolling(device); + + status = libinput_device_config_middle_emulation_set_enabled( + device->libinput_device, + LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); + if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) + return; + + litest_drain_events(li); + + for (i = 0; i < ARRAY_LENGTH(btn); i++) { + litest_button_click(device, btn[i][0], true); + litest_button_click(device, btn[i][1], true); + + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + + litest_button_click(device, btn[i][2], false); + litest_button_click(device, btn[i][3], false); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_empty_queue(li); + } +} +END_TEST + +START_TEST(middlebutton_timeout) +{ + struct litest_device *device = litest_current_device(); + struct libinput *li = device->libinput; + enum libinput_config_status status; + unsigned int button; + + disable_button_scrolling(device); + + status = libinput_device_config_middle_emulation_set_enabled( + device->libinput_device, + LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); + if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) + return; + + for (button = BTN_LEFT; button <= BTN_RIGHT; button++) { + litest_drain_events(li); + litest_button_click(device, button, true); + litest_assert_empty_queue(li); + litest_timeout_middlebutton(); + + litest_assert_button_event(li, + button, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_button_click(device, button, false); + litest_assert_button_event(li, + button, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_empty_queue(li); + } +} +END_TEST + +START_TEST(middlebutton_doubleclick) +{ + struct litest_device *device = litest_current_device(); + struct libinput *li = device->libinput; + enum libinput_config_status status; + unsigned int i; + const int btn[][4] = { + { BTN_LEFT, BTN_RIGHT, BTN_LEFT, BTN_RIGHT }, + { BTN_LEFT, BTN_RIGHT, BTN_RIGHT, BTN_LEFT }, + { BTN_RIGHT, BTN_LEFT, BTN_LEFT, BTN_RIGHT }, + { BTN_RIGHT, BTN_LEFT, BTN_RIGHT, BTN_LEFT }, + }; + + disable_button_scrolling(device); + + status = libinput_device_config_middle_emulation_set_enabled( + device->libinput_device, + LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); + if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) + return; + + litest_drain_events(li); + + for (i = 0; i < ARRAY_LENGTH(btn); i++) { + litest_button_click(device, btn[i][0], true); + litest_button_click(device, btn[i][1], true); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + + litest_button_click(device, btn[i][2], false); + litest_button_click(device, btn[i][2], true); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_button_click(device, btn[i][3], false); + + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_empty_queue(li); + } +} +END_TEST + +START_TEST(middlebutton_middleclick) +{ + struct litest_device *device = litest_current_device(); + struct libinput *li = device->libinput; + enum libinput_config_status status; + unsigned int button; + + disable_button_scrolling(device); + + if (!libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE)) + return; + + status = libinput_device_config_middle_emulation_set_enabled( + device->libinput_device, + LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); + if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) + return; + + /* one button down, then middle -> release buttons */ + for (button = BTN_LEFT; button <= BTN_RIGHT; button++) { + /* release button before middle */ + litest_drain_events(li); + litest_button_click(device, button, true); + litest_button_click(device, BTN_MIDDLE, true); + litest_assert_button_event(li, + button, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + litest_button_click(device, button, false); + litest_assert_button_event(li, + button, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_button_click(device, BTN_MIDDLE, false); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_empty_queue(li); + + /* release middle before button */ + litest_button_click(device, button, true); + litest_button_click(device, BTN_MIDDLE, true); + litest_assert_button_event(li, + button, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + litest_button_click(device, BTN_MIDDLE, false); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_button_click(device, button, false); + litest_assert_button_event(li, + button, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_empty_queue(li); + } +} +END_TEST + +START_TEST(middlebutton_middleclick_during) +{ + struct litest_device *device = litest_current_device(); + struct libinput *li = device->libinput; + enum libinput_config_status status; + unsigned int button; + + disable_button_scrolling(device); + + if (!libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE)) + return; + + status = libinput_device_config_middle_emulation_set_enabled( + device->libinput_device, + LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); + if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) + return; + + litest_drain_events(li); + + /* trigger emulation, then real middle */ + for (button = BTN_LEFT; button <= BTN_RIGHT; button++) { + litest_button_click(device, BTN_LEFT, true); + litest_button_click(device, BTN_RIGHT, true); + + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_button_click(device, BTN_MIDDLE, true); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_assert_empty_queue(li); + + /* middle still down, release left/right */ + litest_button_click(device, button, false); + litest_assert_empty_queue(li); + litest_button_click(device, button, true); + litest_assert_button_event(li, + button, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + + /* release both */ + litest_button_click(device, BTN_LEFT, false); + litest_button_click(device, BTN_RIGHT, false); + litest_assert_button_event(li, + button, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_empty_queue(li); + + litest_button_click(device, BTN_MIDDLE, false); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_empty_queue(li); + } +} +END_TEST + +START_TEST(middlebutton_default_enabled) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_status status; + int available; + enum libinput_config_middle_emulation_state deflt, state; + + available = libinput_device_config_middle_emulation_is_available(device); + ck_assert(available); + + if (libevdev_has_event_code(dev->evdev, EV_KEY, BTN_MIDDLE)) + deflt = LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED; + else + deflt = LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED; + + state = libinput_device_config_middle_emulation_get_enabled(device); + ck_assert_int_eq(state, deflt); + + state = libinput_device_config_middle_emulation_get_default_enabled( + device); + ck_assert_int_eq(state, deflt); + + status = libinput_device_config_middle_emulation_set_enabled(device, + LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + status = libinput_device_config_middle_emulation_set_enabled(device, + LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + status = libinput_device_config_middle_emulation_set_enabled(device, 3); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); +} +END_TEST + +START_TEST(middlebutton_default_clickpad) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_status status; + enum libinput_config_middle_emulation_state state; + int available; + + available = libinput_device_config_middle_emulation_is_available(device); + ck_assert(!available); + + state = libinput_device_config_middle_emulation_get_enabled(device); + ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); + state = libinput_device_config_middle_emulation_get_default_enabled( + device); + ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); + + status = libinput_device_config_middle_emulation_set_enabled(device, + LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); + + status = libinput_device_config_middle_emulation_set_enabled(device, + LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + status = libinput_device_config_middle_emulation_set_enabled(device, 3); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); +} +END_TEST + +START_TEST(middlebutton_default_touchpad) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_middle_emulation_state state; + int available; + const char *name = libinput_device_get_name(dev->libinput_device); + + if (streq(name, "litest AlpsPS/2 ALPS GlidePoint") || + streq(name, "litest AlpsPS/2 ALPS DualPoint TouchPad")) + return; + + available = libinput_device_config_middle_emulation_is_available(device); + ck_assert(!available); + + if (libevdev_has_event_code(dev->evdev, EV_KEY, BTN_MIDDLE)) + return; + + state = libinput_device_config_middle_emulation_get_enabled( + device); + ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); + state = libinput_device_config_middle_emulation_get_default_enabled( + device); + ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); +} +END_TEST + +START_TEST(middlebutton_default_alps) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_middle_emulation_state state; + int available; + + available = libinput_device_config_middle_emulation_is_available(device); + ck_assert(available); + + state = libinput_device_config_middle_emulation_get_enabled( + device); + ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); + state = libinput_device_config_middle_emulation_get_default_enabled( + device); + ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); +} +END_TEST + +START_TEST(middlebutton_default_disabled) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_middle_emulation_state state; + enum libinput_config_status status; + int available; + + available = libinput_device_config_middle_emulation_is_available(device); + ck_assert(!available); + state = libinput_device_config_middle_emulation_get_enabled(device); + ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); + state = libinput_device_config_middle_emulation_get_default_enabled( + device); + ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); + status = libinput_device_config_middle_emulation_set_enabled(device, + LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + status = libinput_device_config_middle_emulation_set_enabled(device, + LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); +} +END_TEST + +START_TEST(pointer_time_usec) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event_pointer *ptrev; + struct libinput_event *event; + + litest_drain_events(dev->libinput); + + litest_event(dev, EV_REL, REL_X, 1); + litest_event(dev, EV_REL, REL_Y, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_wait_for_event(li); + + event = libinput_get_event(li); + ptrev = litest_is_motion_event(event); + + ck_assert_int_eq(libinput_event_pointer_get_time(ptrev), + libinput_event_pointer_get_time_usec(ptrev) / 1000); + + libinput_event_destroy(event); + litest_drain_events(dev->libinput); +} +END_TEST + +void +litest_setup_tests(void) +{ + struct range axis_range = {ABS_X, ABS_Y + 1}; + struct range compass = {0, 7}; /* cardinal directions */ + + litest_add("pointer:motion", pointer_motion_relative, LITEST_RELATIVE, LITEST_ANY); + litest_add_for_device("pointer:motion", pointer_motion_relative_zero, LITEST_MOUSE); + litest_add_ranged("pointer:motion", pointer_motion_relative_min_decel, LITEST_RELATIVE, LITEST_ANY, &compass); + litest_add("pointer:motion", pointer_motion_absolute, LITEST_ABSOLUTE, LITEST_ANY); + litest_add("pointer:motion", pointer_motion_unaccel, LITEST_RELATIVE, LITEST_ANY); + litest_add("pointer:button", pointer_button, LITEST_BUTTON, LITEST_CLICKPAD); + litest_add_no_device("pointer:button", pointer_button_auto_release); + litest_add_no_device("pointer:button", pointer_seat_button_count); + litest_add("pointer:scroll", pointer_scroll_wheel, LITEST_WHEEL, LITEST_ANY); + litest_add("pointer:scroll", pointer_scroll_button, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY); + litest_add("pointer:scroll", pointer_scroll_nowheel_defaults, LITEST_RELATIVE|LITEST_BUTTON, LITEST_WHEEL); + litest_add("pointer:scroll", pointer_scroll_natural_defaults, LITEST_WHEEL, LITEST_ANY); + litest_add("pointer:scroll", pointer_scroll_natural_enable_config, LITEST_WHEEL, LITEST_ANY); + litest_add("pointer:scroll", pointer_scroll_natural_wheel, LITEST_WHEEL, LITEST_ANY); + + litest_add("pointer:calibration", pointer_no_calibration, LITEST_ANY, LITEST_TOUCH|LITEST_SINGLE_TOUCH|LITEST_ABSOLUTE|LITEST_PROTOCOL_A); + + /* tests touchpads too */ + litest_add("pointer:left-handed", pointer_left_handed_defaults, LITEST_BUTTON, LITEST_ANY); + litest_add("pointer:left-handed", pointer_left_handed, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY); + litest_add("pointer:left-handed", pointer_left_handed_during_click, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY); + litest_add("pointer:left-handed", pointer_left_handed_during_click_multiple_buttons, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY); + + litest_add("pointer:accel", pointer_accel_defaults, LITEST_RELATIVE, LITEST_ANY); + litest_add("pointer:accel", pointer_accel_invalid, LITEST_RELATIVE, LITEST_ANY); + litest_add("pointer:accel", pointer_accel_defaults_absolute, LITEST_ABSOLUTE, LITEST_RELATIVE); + litest_add("pointer:accel", pointer_accel_defaults_absolute_relative, LITEST_ABSOLUTE|LITEST_RELATIVE, LITEST_ANY); + litest_add("pointer:accel", pointer_accel_direction_change, LITEST_RELATIVE, LITEST_ANY); + + litest_add("pointer:middlebutton", middlebutton, LITEST_BUTTON, LITEST_ANY); + litest_add("pointer:middlebutton", middlebutton_timeout, LITEST_BUTTON, LITEST_ANY); + litest_add("pointer:middlebutton", middlebutton_doubleclick, LITEST_BUTTON, LITEST_ANY); + litest_add("pointer:middlebutton", middlebutton_middleclick, LITEST_BUTTON, LITEST_ANY); + litest_add("pointer:middlebutton", middlebutton_middleclick_during, LITEST_BUTTON, LITEST_ANY); + litest_add("pointer:middlebutton", middlebutton_default_enabled, LITEST_BUTTON, LITEST_TOUCHPAD|LITEST_POINTINGSTICK); + litest_add("pointer:middlebutton", middlebutton_default_clickpad, LITEST_CLICKPAD, LITEST_ANY); + litest_add("pointer:middlebutton", middlebutton_default_touchpad, LITEST_TOUCHPAD, LITEST_CLICKPAD); + litest_add("pointer:middlebutton", middlebutton_default_disabled, LITEST_ANY, LITEST_BUTTON); + litest_add_for_device("pointer:middlebutton", middlebutton_default_alps, LITEST_ALPS_SEMI_MT); + + litest_add_ranged("pointer:state", pointer_absolute_initial_state, LITEST_ABSOLUTE, LITEST_ANY, &axis_range); + + litest_add("pointer:time", pointer_time_usec, LITEST_RELATIVE, LITEST_ANY); +} diff -Nru libinput-1.10.3/test/symbols-leak-test.in libinput-0.21.0/test/symbols-leak-test.in --- libinput-1.10.3/test/symbols-leak-test.in 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/symbols-leak-test.in 2015-07-09 02:52:56.000000000 +0000 @@ -2,17 +2,6 @@ ### simple check for exported symbols -# Allow running this after the configure.ac replacement or directly with an -# argument for the top_srcdir -TOP_SRCDIR="@top_srcdir@" -case "$TOP_SRCDIR" in -@*) - TOP_SRCDIR="$1" - ;; -*) - ;; -esac - # make bash exit if any command will exit with non-0 return value set -e @@ -20,9 +9,9 @@ cd `dirname $0` diff -a -u \ - <(cat "$TOP_SRCDIR"/src/libinput.sym | \ + <(cat @top_srcdir@/src/libinput.sym | \ grep '^\s\+libinput_.*' | \ sed -e 's/^\s\+\(.*\);/\1/' | sort) \ - <(cat "$TOP_SRCDIR"/src/*.c | \ + <(cat @top_srcdir@/src/*.c | \ grep LIBINPUT_EXPORT -A 1 | grep '^libinput_.*' | \ sed -e 's/(.*//' | sort) diff -Nru libinput-1.10.3/test/test-device.c libinput-0.21.0/test/test-device.c --- libinput-1.10.3/test/test-device.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-device.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1660 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include -#include -#include -#include -#include - -#include "litest.h" -#include "libinput-util.h" - -START_TEST(device_sendevents_config) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device; - uint32_t modes; - - device = dev->libinput_device; - - modes = libinput_device_config_send_events_get_modes(device); - ck_assert_int_eq(modes, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); -} -END_TEST - -START_TEST(device_sendevents_config_invalid) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device; - enum libinput_config_status status; - - device = dev->libinput_device; - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED | (1 << 4)); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); -} -END_TEST - -START_TEST(device_sendevents_config_touchpad) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device; - uint32_t modes, expected; - - expected = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED; - - /* The wacom devices in the test suite are external */ - if (libevdev_get_id_vendor(dev->evdev) != VENDOR_ID_WACOM && - !litest_touchpad_is_external(dev)) - expected |= - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE; - - device = dev->libinput_device; - - modes = libinput_device_config_send_events_get_modes(device); - ck_assert_int_eq(modes, expected); -} -END_TEST - -START_TEST(device_sendevents_config_touchpad_superset) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device; - enum libinput_config_status status; - uint32_t modes; - - /* The wacom devices in the test suite are external */ - if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM || - litest_touchpad_is_external(dev)) - return; - - device = dev->libinput_device; - - modes = LIBINPUT_CONFIG_SEND_EVENTS_DISABLED | - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE; - - status = libinput_device_config_send_events_set_mode(device, - modes); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - /* DISABLED supersedes the rest, expect the rest to be dropped */ - modes = libinput_device_config_send_events_get_mode(device); - ck_assert_int_eq(modes, LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); -} -END_TEST - -START_TEST(device_sendevents_config_default) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device; - uint32_t mode; - - device = dev->libinput_device; - - mode = libinput_device_config_send_events_get_mode(device); - ck_assert_int_eq(mode, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); - - mode = libinput_device_config_send_events_get_default_mode(device); - ck_assert_int_eq(mode, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); -} -END_TEST - -START_TEST(device_disable) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device; - enum libinput_config_status status; - struct libinput_event *event; - struct litest_device *tmp; - - device = dev->libinput_device; - - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - /* no event from disabling */ - litest_assert_empty_queue(li); - - /* no event from disabled device */ - litest_event(dev, EV_REL, REL_X, 10); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_assert_empty_queue(li); - - /* create a new device so the resumed fd isn't the same as the - suspended one */ - tmp = litest_add_device(li, LITEST_KEYBOARD); - ck_assert_notnull(tmp); - litest_drain_events(li); - - /* no event from resuming */ - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - litest_assert_empty_queue(li); - - /* event from renabled device */ - litest_event(dev, EV_REL, REL_X, 10); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - event = libinput_get_event(li); - ck_assert_notnull(event); - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_MOTION); - libinput_event_destroy(event); - - litest_delete_device(tmp); -} -END_TEST - -START_TEST(device_disable_touchpad) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device; - enum libinput_config_status status; - - device = dev->libinput_device; - - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - /* no event from disabling */ - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 90, 90, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); - - /* no event from resuming */ - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(device_disable_touch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device; - enum libinput_config_status status; - - device = dev->libinput_device; - - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - /* no event from disabling */ - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 90, 90, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); - - /* no event from resuming */ - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(device_disable_touch_during_touch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device; - enum libinput_config_status status; - struct libinput_event *event; - - device = dev->libinput_device; - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 90, 90, 10, 0); - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - /* after disabling sendevents we require a touch up */ - libinput_dispatch(li); - event = libinput_get_event(li); - litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_UP); - libinput_event_destroy(event); - - event = libinput_get_event(li); - litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_FRAME); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - - litest_touch_move_to(dev, 0, 90, 90, 50, 50, 10, 0); - litest_touch_up(dev, 0); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 90, 90, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); - - /* no event from resuming */ - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(device_disable_events_pending) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device; - enum libinput_config_status status; - struct libinput_event *event; - int i; - - device = dev->libinput_device; - - litest_drain_events(li); - - /* put a couple of events in the queue, enough to - feed the ptraccel trackers */ - for (i = 0; i < 10; i++) { - litest_event(dev, EV_REL, REL_X, 10); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - } - libinput_dispatch(li); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - /* expect above events */ - litest_wait_for_event(li); - while ((event = libinput_get_event(li)) != NULL) { - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_MOTION); - libinput_event_destroy(event); - } -} -END_TEST - -START_TEST(device_double_disable) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device; - enum libinput_config_status status; - - device = dev->libinput_device; - - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(device_double_enable) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device; - enum libinput_config_status status; - - device = dev->libinput_device; - - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(device_reenable_syspath_changed) -{ - struct libinput *li; - struct litest_device *litest_device; - struct libinput_device *device1; - enum libinput_config_status status; - struct libinput_event *event; - - li = litest_create_context(); - litest_device = litest_add_device(li, LITEST_MOUSE); - device1 = litest_device->libinput_device; - - libinput_device_ref(device1); - status = libinput_device_config_send_events_set_mode(device1, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - - litest_delete_device(litest_device); - litest_drain_events(li); - - litest_device = litest_add_device(li, LITEST_MOUSE); - - status = libinput_device_config_send_events_set_mode(device1, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - /* can't really check for much here, other than that if we pump - events through libinput, none of them should be from the first - device */ - litest_event(litest_device, EV_REL, REL_X, 1); - litest_event(litest_device, EV_REL, REL_Y, 1); - litest_event(litest_device, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - while ((event = libinput_get_event(li))) { - ck_assert(libinput_event_get_device(event) != device1); - libinput_event_destroy(event); - } - - litest_delete_device(litest_device); - libinput_device_unref(device1); - libinput_unref(li); -} -END_TEST - -START_TEST(device_reenable_device_removed) -{ - struct libinput *li; - struct litest_device *litest_device; - struct libinput_device *device; - enum libinput_config_status status; - - li = litest_create_context(); - litest_device = litest_add_device(li, LITEST_MOUSE); - device = litest_device->libinput_device; - - libinput_device_ref(device); - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - - litest_delete_device(litest_device); - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - /* can't really check for much here, this really just exercises the - code path. */ - litest_assert_empty_queue(li); - - libinput_device_unref(device); - libinput_unref(li); -} -END_TEST - -START_TEST(device_disable_release_buttons) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device; - struct libinput_event *event; - struct libinput_event_pointer *ptrevent; - enum libinput_config_status status; - - device = dev->libinput_device; - - litest_button_click_debounced(dev, li, BTN_LEFT, true); - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_wait_for_event(li); - event = libinput_get_event(li); - - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_BUTTON); - ptrevent = libinput_event_get_pointer_event(event); - ck_assert_int_eq(libinput_event_pointer_get_button(ptrevent), - BTN_LEFT); - ck_assert_int_eq(libinput_event_pointer_get_button_state(ptrevent), - LIBINPUT_BUTTON_STATE_RELEASED); - - libinput_event_destroy(event); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(device_disable_release_keys) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device; - struct libinput_event *event; - struct libinput_event_keyboard *kbdevent; - enum libinput_config_status status; - - device = dev->libinput_device; - - litest_keyboard_key(dev, KEY_A, true); - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_wait_for_event(li); - event = libinput_get_event(li); - - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_KEYBOARD_KEY); - kbdevent = libinput_event_get_keyboard_event(event); - ck_assert_int_eq(libinput_event_keyboard_get_key(kbdevent), - KEY_A); - ck_assert_int_eq(libinput_event_keyboard_get_key_state(kbdevent), - LIBINPUT_KEY_STATE_RELEASED); - - libinput_event_destroy(event); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(device_disable_release_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device; - enum libinput_config_status status; - - device = dev->libinput_device; - - libinput_device_config_tap_set_enabled(device, - LIBINPUT_CONFIG_TAP_ENABLED); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - /* tap happened before suspending, so we still expect the event */ - - litest_timeout_tap(); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); - - /* resume, make sure we don't get anything */ - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - libinput_dispatch(li); - litest_assert_empty_queue(li); - -} -END_TEST - -START_TEST(device_disable_release_tap_n_drag) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device; - enum libinput_config_status status; - - device = dev->libinput_device; - - libinput_device_config_tap_set_enabled(device, - LIBINPUT_CONFIG_TAP_ENABLED); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 50, 50); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - libinput_dispatch(li); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(device_disable_release_softbutton) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device; - enum libinput_config_status status; - - device = dev->libinput_device; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 90, 90); - litest_button_click_debounced(dev, li, BTN_LEFT, true); - - /* make sure softbutton works */ - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - /* disable */ - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); - - litest_button_click_debounced(dev, li, BTN_LEFT, false); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); - - /* resume, make sure we don't get anything */ - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - libinput_dispatch(li); - litest_assert_empty_queue(li); - -} -END_TEST - -START_TEST(device_disable_topsoftbutton) -{ - struct litest_device *dev = litest_current_device(); - struct litest_device *trackpoint; - struct libinput *li = dev->libinput; - struct libinput_device *device; - enum libinput_config_status status; - - struct libinput_event *event; - struct libinput_event_pointer *ptrevent; - - device = dev->libinput_device; - - trackpoint = litest_add_device(li, LITEST_TRACKPOINT); - - status = libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - litest_drain_events(li); - - litest_touch_down(dev, 0, 90, 10); - litest_button_click_debounced(dev, li, BTN_LEFT, true); - litest_button_click_debounced(dev, li, BTN_LEFT, false); - litest_touch_up(dev, 0); - - litest_wait_for_event(li); - event = libinput_get_event(li); - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_BUTTON); - ck_assert_ptr_eq(libinput_event_get_device(event), - trackpoint->libinput_device); - ptrevent = libinput_event_get_pointer_event(event); - ck_assert_int_eq(libinput_event_pointer_get_button(ptrevent), - BTN_RIGHT); - ck_assert_int_eq(libinput_event_pointer_get_button_state(ptrevent), - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - - event = libinput_get_event(li); - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_BUTTON); - ck_assert_ptr_eq(libinput_event_get_device(event), - trackpoint->libinput_device); - ptrevent = libinput_event_get_pointer_event(event); - ck_assert_int_eq(libinput_event_pointer_get_button(ptrevent), - BTN_RIGHT); - ck_assert_int_eq(libinput_event_pointer_get_button_state(ptrevent), - LIBINPUT_BUTTON_STATE_RELEASED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - - litest_delete_device(trackpoint); -} -END_TEST - -START_TEST(device_ids) -{ - struct litest_device *dev = litest_current_device(); - const char *name; - unsigned int pid, vid; - - name = libevdev_get_name(dev->evdev); - pid = libevdev_get_id_product(dev->evdev); - vid = libevdev_get_id_vendor(dev->evdev); - - ck_assert_str_eq(name, - libinput_device_get_name(dev->libinput_device)); - ck_assert_int_eq(pid, - libinput_device_get_id_product(dev->libinput_device)); - ck_assert_int_eq(vid, - libinput_device_get_id_vendor(dev->libinput_device)); -} -END_TEST - -START_TEST(device_get_udev_handle) -{ - struct litest_device *dev = litest_current_device(); - struct udev_device *udev_device; - - udev_device = libinput_device_get_udev_device(dev->libinput_device); - ck_assert_notnull(udev_device); - udev_device_unref(udev_device); -} -END_TEST - -START_TEST(device_context) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_seat *seat; - - ck_assert(dev->libinput == libinput_device_get_context(dev->libinput_device)); - seat = libinput_device_get_seat(dev->libinput_device); - ck_assert(dev->libinput == libinput_seat_get_context(seat)); -} -END_TEST - -START_TEST(device_user_data) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - void *userdata = &dev; /* not referenced */ - - ck_assert(libinput_device_get_user_data(device) == NULL); - libinput_device_set_user_data(device, userdata); - ck_assert_ptr_eq(libinput_device_get_user_data(device), userdata); - libinput_device_set_user_data(device, NULL); - ck_assert(libinput_device_get_user_data(device) == NULL); -} -END_TEST - -static int open_restricted(const char *path, int flags, void *data) -{ - int fd; - fd = open(path, flags); - return fd < 0 ? -errno : fd; -} -static void close_restricted(int fd, void *data) -{ - close(fd); -} - -const struct libinput_interface simple_interface = { - .open_restricted = open_restricted, - .close_restricted = close_restricted, -}; - -START_TEST(device_group_get) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device_group *group; - - int userdata = 10; - - group = libinput_device_get_device_group(dev->libinput_device); - ck_assert_notnull(group); - - libinput_device_group_ref(group); - - libinput_device_group_set_user_data(group, &userdata); - ck_assert_ptr_eq(&userdata, - libinput_device_group_get_user_data(group)); - - libinput_device_group_unref(group); -} -END_TEST - -START_TEST(device_group_ref) -{ - struct libinput *li = litest_create_context(); - struct litest_device *dev = litest_add_device(li, - LITEST_MOUSE); - struct libinput_device *device = dev->libinput_device; - struct libinput_device_group *group; - - group = libinput_device_get_device_group(device); - ck_assert_notnull(group); - libinput_device_group_ref(group); - - libinput_device_ref(device); - litest_drain_events(li); - litest_delete_device(dev); - litest_drain_events(li); - - /* make sure the device is dead but the group is still around */ - ck_assert(libinput_device_unref(device) == NULL); - - libinput_device_group_ref(group); - ck_assert_notnull(libinput_device_group_unref(group)); - ck_assert(libinput_device_group_unref(group) == NULL); - - libinput_unref(li); -} -END_TEST - -START_TEST(device_group_leak) -{ - struct libinput *li; - struct libinput_device *device; - struct libevdev_uinput *uinput; - struct libinput_device_group *group; - - uinput = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - - li = libinput_path_create_context(&simple_interface, NULL); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - - group = libinput_device_get_device_group(device); - libinput_device_group_ref(group); - - libinput_path_remove_device(device); - - libevdev_uinput_destroy(uinput); - libinput_unref(li); - - /* the device group leaks, check valgrind */ -} -END_TEST - -START_TEST(abs_device_no_absx) -{ - struct libevdev_uinput *uinput; - struct libinput *li; - struct libinput_device *device; - - uinput = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_ABS, ABS_Y, - -1); - li = litest_create_context(); - litest_disable_log_handler(li); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - litest_restore_log_handler(li); - ck_assert(device == NULL); - libinput_unref(li); - - libevdev_uinput_destroy(uinput); -} -END_TEST - -START_TEST(abs_device_no_absy) -{ - struct libevdev_uinput *uinput; - struct libinput *li; - struct libinput_device *device; - - uinput = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_ABS, ABS_X, - -1); - li = litest_create_context(); - litest_disable_log_handler(li); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - litest_restore_log_handler(li); - ck_assert(device == NULL); - libinput_unref(li); - - libevdev_uinput_destroy(uinput); -} -END_TEST - -START_TEST(abs_mt_device_no_absy) -{ - struct libevdev_uinput *uinput; - struct libinput *li; - struct libinput_device *device; - - uinput = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_ABS, ABS_X, - EV_ABS, ABS_Y, - EV_ABS, ABS_MT_SLOT, - EV_ABS, ABS_MT_POSITION_X, - -1); - li = litest_create_context(); - litest_disable_log_handler(li); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - litest_restore_log_handler(li); - ck_assert(device == NULL); - libinput_unref(li); - - libevdev_uinput_destroy(uinput); -} -END_TEST - -START_TEST(abs_mt_device_no_absx) -{ - struct libevdev_uinput *uinput; - struct libinput *li; - struct libinput_device *device; - - uinput = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_ABS, ABS_X, - EV_ABS, ABS_Y, - EV_ABS, ABS_MT_SLOT, - EV_ABS, ABS_MT_POSITION_Y, - -1); - li = litest_create_context(); - litest_disable_log_handler(li); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - litest_restore_log_handler(li); - ck_assert(device == NULL); - libinput_unref(li); - - libevdev_uinput_destroy(uinput); -} -END_TEST - -static void -assert_device_ignored(struct libinput *li, struct input_absinfo *absinfo) -{ - struct libevdev_uinput *uinput; - struct libinput_device *device; - - uinput = litest_create_uinput_abs_device("test device", NULL, - absinfo, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - -1); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - litest_assert_ptr_null(device); - libevdev_uinput_destroy(uinput); -} - -START_TEST(abs_device_no_range) -{ - struct libinput *li; - int code = _i; /* looped test */ - /* set x/y so libinput doesn't just reject for missing axes */ - struct input_absinfo absinfo[] = { - { ABS_X, 0, 10, 0, 0, 0 }, - { ABS_Y, 0, 10, 0, 0, 0 }, - { code, 0, 0, 0, 0, 0 }, - { -1, -1, -1, -1, -1, -1 } - }; - - li = litest_create_context(); - litest_disable_log_handler(li); - - assert_device_ignored(li, absinfo); - - litest_restore_log_handler(li); - libinput_unref(li); -} -END_TEST - -START_TEST(abs_mt_device_no_range) -{ - struct libinput *li; - int code = _i; /* looped test */ - /* set x/y so libinput doesn't just reject for missing axes */ - struct input_absinfo absinfo[] = { - { ABS_X, 0, 10, 0, 0, 0 }, - { ABS_Y, 0, 10, 0, 0, 0 }, - { ABS_MT_SLOT, 0, 10, 0, 0, 0 }, - { ABS_MT_TRACKING_ID, 0, 255, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 10, 0, 0, 0 }, - { ABS_MT_POSITION_Y, 0, 10, 0, 0, 0 }, - { code, 0, 0, 0, 0, 0 }, - { -1, -1, -1, -1, -1, -1 } - }; - - li = litest_create_context(); - litest_disable_log_handler(li); - - if (code != ABS_MT_TOOL_TYPE && - code != ABS_MT_TRACKING_ID) /* kernel overrides it */ - assert_device_ignored(li, absinfo); - - litest_restore_log_handler(li); - libinput_unref(li); -} -END_TEST - -START_TEST(abs_device_missing_res) -{ - struct libinput *li; - struct input_absinfo absinfo[] = { - { ABS_X, 0, 10, 0, 0, 10 }, - { ABS_Y, 0, 10, 0, 0, 0 }, - { -1, -1, -1, -1, -1, -1 } - }; - - li = litest_create_context(); - litest_disable_log_handler(li); - - assert_device_ignored(li, absinfo); - - absinfo[0].resolution = 0; - absinfo[1].resolution = 20; - - assert_device_ignored(li, absinfo); - - litest_restore_log_handler(li); - libinput_unref(li); -} -END_TEST - -START_TEST(abs_mt_device_missing_res) -{ - struct libinput *li; - struct input_absinfo absinfo[] = { - { ABS_X, 0, 10, 0, 0, 10 }, - { ABS_Y, 0, 10, 0, 0, 10 }, - { ABS_MT_SLOT, 0, 2, 0, 0, 0 }, - { ABS_MT_TRACKING_ID, 0, 255, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 10, 0, 0, 10 }, - { ABS_MT_POSITION_Y, 0, 10, 0, 0, 0 }, - { -1, -1, -1, -1, -1, -1 } - }; - - li = litest_create_context(); - litest_disable_log_handler(li); - assert_device_ignored(li, absinfo); - - absinfo[4].resolution = 0; - absinfo[5].resolution = 20; - - assert_device_ignored(li, absinfo); - - litest_restore_log_handler(li); - libinput_unref(li); - -} -END_TEST - -START_TEST(ignore_joystick) -{ - struct libinput *li; - struct libevdev_uinput *uinput; - struct libinput_device *device; - struct input_absinfo absinfo[] = { - { ABS_X, 0, 10, 0, 0, 10 }, - { ABS_Y, 0, 10, 0, 0, 10 }, - { ABS_RX, 0, 10, 0, 0, 10 }, - { ABS_RY, 0, 10, 0, 0, 10 }, - { ABS_THROTTLE, 0, 2, 0, 0, 0 }, - { ABS_RUDDER, 0, 255, 0, 0, 0 }, - { -1, -1, -1, -1, -1, -1 } - }; - - li = litest_create_context(); - litest_disable_log_handler(li); - litest_drain_events(li); - - uinput = litest_create_uinput_abs_device("joystick test device", NULL, - absinfo, - EV_KEY, BTN_TRIGGER, - EV_KEY, BTN_A, - -1); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - litest_assert_ptr_null(device); - libevdev_uinput_destroy(uinput); - litest_restore_log_handler(li); - libinput_unref(li); -} -END_TEST - -START_TEST(device_wheel_only) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - - ck_assert(libinput_device_has_capability(device, - LIBINPUT_DEVICE_CAP_POINTER)); -} -END_TEST - -START_TEST(device_accelerometer) -{ - struct libinput *li; - struct libevdev_uinput *uinput; - struct libinput_device *device; - - struct input_absinfo absinfo[] = { - { ABS_X, 0, 10, 0, 0, 10 }, - { ABS_Y, 0, 10, 0, 0, 10 }, - { ABS_Z, 0, 10, 0, 0, 10 }, - { -1, -1, -1, -1, -1, -1 } - }; - - li = litest_create_context(); - litest_disable_log_handler(li); - - uinput = litest_create_uinput_abs_device("test device", NULL, - absinfo, - -1); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - litest_assert_ptr_null(device); - libevdev_uinput_destroy(uinput); - litest_restore_log_handler(li); - libinput_unref(li); -} -END_TEST - -START_TEST(device_udev_tag_alps) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct udev_device *d; - const char *prop; - - d = libinput_device_get_udev_device(device); - prop = udev_device_get_property_value(d, - "LIBINPUT_MODEL_ALPS_TOUCHPAD"); - - if (strstr(libinput_device_get_name(device), "ALPS")) - ck_assert_notnull(prop); - else - ck_assert(prop == NULL); - - udev_device_unref(d); -} -END_TEST - -START_TEST(device_udev_tag_wacom) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct udev_device *d; - const char *prop; - - d = libinput_device_get_udev_device(device); - prop = udev_device_get_property_value(d, - "LIBINPUT_MODEL_WACOM_TOUCHPAD"); - - if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM) - ck_assert_notnull(prop); - else - ck_assert(prop == NULL); - - udev_device_unref(d); -} -END_TEST - -START_TEST(device_udev_tag_apple) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct udev_device *d; - const char *prop; - - d = libinput_device_get_udev_device(device); - prop = udev_device_get_property_value(d, - "LIBINPUT_MODEL_WACOM_TOUCHPAD"); - - if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM) - ck_assert_notnull(prop); - else - ck_assert(prop == NULL); - - udev_device_unref(d); -} -END_TEST - -START_TEST(device_udev_tag_synaptics_serial) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct udev_device *d; - const char *prop; - - d = libinput_device_get_udev_device(device); - prop = udev_device_get_property_value(d, - "LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD"); - - if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_SYNAPTICS_SERIAL && - libevdev_get_id_product(dev->evdev) == PRODUCT_ID_SYNAPTICS_SERIAL) - ck_assert_notnull(prop); - else - ck_assert(prop == NULL); - - udev_device_unref(d); -} -END_TEST - -START_TEST(device_udev_tag_wacom_tablet) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct udev_device *d; - const char *prop; - - d = libinput_device_get_udev_device(device); - prop = udev_device_get_property_value(d, - "ID_INPUT_TABLET"); - - ck_assert_notnull(prop); - udev_device_unref(d); -} -END_TEST - -START_TEST(device_nonpointer_rel) -{ - struct libevdev_uinput *uinput; - struct libinput *li; - struct libinput_device *device; - int i; - - uinput = litest_create_uinput_device("test device", - NULL, - EV_KEY, KEY_A, - EV_KEY, KEY_B, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - li = litest_create_context(); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - ck_assert(device != NULL); - - litest_disable_log_handler(li); - for (i = 0; i < 100; i++) { - libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1); - libevdev_uinput_write_event(uinput, EV_REL, REL_Y, -1); - libevdev_uinput_write_event(uinput, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - litest_restore_log_handler(li); - - libinput_unref(li); - libevdev_uinput_destroy(uinput); -} -END_TEST - -START_TEST(device_touchpad_rel) -{ - struct libevdev_uinput *uinput; - struct libinput *li; - struct libinput_device *device; - const struct input_absinfo abs[] = { - { ABS_X, 0, 10, 0, 0, 10 }, - { ABS_Y, 0, 10, 0, 0, 10 }, - { ABS_MT_SLOT, 0, 2, 0, 0, 0 }, - { ABS_MT_TRACKING_ID, 0, 255, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 10, 0, 0, 10 }, - { ABS_MT_POSITION_Y, 0, 10, 0, 0, 10 }, - { -1, -1, -1, -1, -1, -1 } - }; - int i; - - uinput = litest_create_uinput_abs_device("test device", - NULL, abs, - EV_KEY, BTN_TOOL_FINGER, - EV_KEY, BTN_TOUCH, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - li = litest_create_context(); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - ck_assert(device != NULL); - - for (i = 0; i < 100; i++) { - libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1); - libevdev_uinput_write_event(uinput, EV_REL, REL_Y, -1); - libevdev_uinput_write_event(uinput, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - - libinput_unref(li); - libevdev_uinput_destroy(uinput); -} -END_TEST - -START_TEST(device_touch_rel) -{ - struct libevdev_uinput *uinput; - struct libinput *li; - struct libinput_device *device; - const struct input_absinfo abs[] = { - { ABS_X, 0, 10, 0, 0, 10 }, - { ABS_Y, 0, 10, 0, 0, 10 }, - { ABS_MT_SLOT, 0, 2, 0, 0, 0 }, - { ABS_MT_TRACKING_ID, 0, 255, 0, 0, 0 }, - { ABS_MT_POSITION_X, 0, 10, 0, 0, 10 }, - { ABS_MT_POSITION_Y, 0, 10, 0, 0, 10 }, - { -1, -1, -1, -1, -1, -1 } - }; - int i; - - uinput = litest_create_uinput_abs_device("test device", - NULL, abs, - EV_KEY, BTN_TOUCH, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - li = litest_create_context(); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - ck_assert(device != NULL); - - litest_disable_log_handler(li); - for (i = 0; i < 100; i++) { - libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1); - libevdev_uinput_write_event(uinput, EV_REL, REL_Y, -1); - libevdev_uinput_write_event(uinput, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - litest_restore_log_handler(li); - - libinput_unref(li); - libevdev_uinput_destroy(uinput); -} -END_TEST - -START_TEST(device_abs_rel) -{ - struct libevdev_uinput *uinput; - struct libinput *li; - struct libinput_device *device; - const struct input_absinfo abs[] = { - { ABS_X, 0, 10, 0, 0, 10 }, - { ABS_Y, 0, 10, 0, 0, 10 }, - { -1, -1, -1, -1, -1, -1 } - }; - int i; - - uinput = litest_create_uinput_abs_device("test device", - NULL, abs, - EV_KEY, BTN_TOUCH, - EV_KEY, BTN_LEFT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - li = litest_create_context(); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - ck_assert(device != NULL); - - for (i = 0; i < 100; i++) { - libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1); - libevdev_uinput_write_event(uinput, EV_REL, REL_Y, -1); - libevdev_uinput_write_event(uinput, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - - libinput_unref(li); - libevdev_uinput_destroy(uinput); -} -END_TEST - -START_TEST(device_quirks_no_abs_mt_y) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *pev; - int code; - - litest_drain_events(li); - - litest_event(dev, EV_REL, REL_HWHEEL, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - pev = litest_is_axis_event(event, - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, - LIBINPUT_POINTER_AXIS_SOURCE_WHEEL); - libinput_event_destroy(libinput_event_pointer_get_base_event(pev)); - - for (code = ABS_MISC + 1; code < ABS_MAX; code++) { - litest_event(dev, EV_ABS, code, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_assert_empty_queue(li); - } - -} -END_TEST - -START_TEST(device_quirks_cyborg_rat_mode_button) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput *li = dev->libinput; - - ck_assert(!libinput_device_pointer_has_button(device, 0x118)); - ck_assert(!libinput_device_pointer_has_button(device, 0x119)); - ck_assert(!libinput_device_pointer_has_button(device, 0x11a)); - - litest_drain_events(li); - - litest_event(dev, EV_KEY, 0x118, 0); - litest_event(dev, EV_KEY, 0x119, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, 0x119, 0); - litest_event(dev, EV_KEY, 0x11a, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, 0x11a, 0); - litest_event(dev, EV_KEY, 0x118, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(device_quirks_apple_magicmouse) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - /* ensure we get no events from the touch */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 80, 80, 10, 0); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(device_quirks_logitech_marble_mouse) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - ck_assert(!libinput_device_pointer_has_button(dev->libinput_device, - BTN_MIDDLE)); -} -END_TEST - -START_TEST(device_capability_at_least_one) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_device_capability caps[] = { - LIBINPUT_DEVICE_CAP_KEYBOARD, - LIBINPUT_DEVICE_CAP_POINTER, - LIBINPUT_DEVICE_CAP_TOUCH, - LIBINPUT_DEVICE_CAP_TABLET_TOOL, - LIBINPUT_DEVICE_CAP_TABLET_PAD, - LIBINPUT_DEVICE_CAP_GESTURE, - LIBINPUT_DEVICE_CAP_SWITCH, - }; - enum libinput_device_capability *cap; - int ncaps = 0; - - ARRAY_FOR_EACH(caps, cap) { - if (libinput_device_has_capability(device, *cap)) - ncaps++; - } - ck_assert_int_gt(ncaps, 0); - -} -END_TEST - -START_TEST(device_capability_check_invalid) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - - ck_assert(!libinput_device_has_capability(device, -1)); - ck_assert(!libinput_device_has_capability(device, 7)); - ck_assert(!libinput_device_has_capability(device, 0xffff)); - -} -END_TEST - -START_TEST(device_has_size) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - double w, h; - int rc; - - rc = libinput_device_get_size(device, &w, &h); - ck_assert_int_eq(rc, 0); - /* This matches the current set of test devices but may fail if - * newer ones are added */ - ck_assert_double_gt(w, 40); - ck_assert_double_gt(h, 20); -} -END_TEST - -START_TEST(device_has_no_size) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - double w = 45, h = 67; - int rc; - - rc = libinput_device_get_size(device, &w, &h); - ck_assert_int_eq(rc, -1); - ck_assert_double_eq(w, 45); - ck_assert_double_eq(h, 67); -} -END_TEST - -START_TEST(device_get_output) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - const char *output_name; - - output_name = libinput_device_get_output_name(device); - ck_assert_str_eq(output_name, "myOutput"); -} -END_TEST - -START_TEST(device_no_output) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - const char *output_name; - - output_name = libinput_device_get_output_name(device); - ck_assert(output_name == NULL); -} -END_TEST - -START_TEST(device_seat_phys_name) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput_seat *seat = libinput_device_get_seat(device); - const char *seat_name; - - seat_name = libinput_seat_get_physical_name(seat); - ck_assert(streq(seat_name, "seat0")); -} -END_TEST - -void -litest_setup_tests_device(void) -{ - struct range abs_range = { 0, ABS_MISC }; - struct range abs_mt_range = { ABS_MT_SLOT + 1, ABS_CNT }; - - litest_add("device:sendevents", device_sendevents_config, LITEST_ANY, LITEST_TOUCHPAD|LITEST_TABLET); - litest_add("device:sendevents", device_sendevents_config_invalid, LITEST_ANY, LITEST_TABLET); - litest_add("device:sendevents", device_sendevents_config_touchpad, LITEST_TOUCHPAD, LITEST_TABLET); - litest_add("device:sendevents", device_sendevents_config_touchpad_superset, LITEST_TOUCHPAD, LITEST_TABLET); - litest_add("device:sendevents", device_sendevents_config_default, LITEST_ANY, LITEST_TABLET); - litest_add("device:sendevents", device_disable, LITEST_RELATIVE, LITEST_TABLET); - litest_add("device:sendevents", device_disable_touchpad, LITEST_TOUCHPAD, LITEST_TABLET); - litest_add("device:sendevents", device_disable_touch, LITEST_TOUCH, LITEST_ANY); - litest_add("device:sendevents", device_disable_touch_during_touch, LITEST_TOUCH, LITEST_ANY); - litest_add("device:sendevents", device_disable_touch, LITEST_SINGLE_TOUCH, LITEST_TOUCHPAD); - litest_add("device:sendevents", device_disable_touch_during_touch, LITEST_SINGLE_TOUCH, LITEST_TOUCHPAD); - litest_add("device:sendevents", device_disable_events_pending, LITEST_RELATIVE, LITEST_TOUCHPAD|LITEST_TABLET); - litest_add("device:sendevents", device_double_disable, LITEST_ANY, LITEST_TABLET); - litest_add("device:sendevents", device_double_enable, LITEST_ANY, LITEST_TABLET); - litest_add_no_device("device:sendevents", device_reenable_syspath_changed); - litest_add_no_device("device:sendevents", device_reenable_device_removed); - litest_add_for_device("device:sendevents", device_disable_release_buttons, LITEST_MOUSE); - litest_add_for_device("device:sendevents", device_disable_release_keys, LITEST_KEYBOARD); - litest_add("device:sendevents", device_disable_release_tap, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("device:sendevents", device_disable_release_tap_n_drag, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("device:sendevents", device_disable_release_softbutton, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - litest_add("device:sendevents", device_disable_topsoftbutton, LITEST_TOPBUTTONPAD, LITEST_ANY); - litest_add("device:id", device_ids, LITEST_ANY, LITEST_ANY); - litest_add_for_device("device:context", device_context, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_for_device("device:context", device_user_data, LITEST_SYNAPTICS_CLICKPAD_X220); - - litest_add("device:udev", device_get_udev_handle, LITEST_ANY, LITEST_ANY); - - litest_add("device:group", device_group_get, LITEST_ANY, LITEST_ANY); - litest_add_no_device("device:group", device_group_ref); - litest_add_no_device("device:group", device_group_leak); - - litest_add_no_device("device:invalid devices", abs_device_no_absx); - litest_add_no_device("device:invalid devices", abs_device_no_absy); - litest_add_no_device("device:invalid devices", abs_mt_device_no_absx); - litest_add_no_device("device:invalid devices", abs_mt_device_no_absy); - litest_add_ranged_no_device("device:invalid devices", abs_device_no_range, &abs_range); - litest_add_ranged_no_device("device:invalid devices", abs_mt_device_no_range, &abs_mt_range); - litest_add_no_device("device:invalid devices", abs_device_missing_res); - litest_add_no_device("device:invalid devices", abs_mt_device_missing_res); - litest_add_no_device("device:invalid devices", ignore_joystick); - - litest_add("device:wheel", device_wheel_only, LITEST_WHEEL, LITEST_RELATIVE|LITEST_ABSOLUTE|LITEST_TABLET); - litest_add_no_device("device:accelerometer", device_accelerometer); - - litest_add("device:udev tags", device_udev_tag_alps, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("device:udev tags", device_udev_tag_wacom, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("device:udev tags", device_udev_tag_apple, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("device:udev tags", device_udev_tag_synaptics_serial, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("device:udev tags", device_udev_tag_wacom_tablet, LITEST_TABLET, LITEST_ANY); - - litest_add_no_device("device:invalid rel events", device_nonpointer_rel); - litest_add_no_device("device:invalid rel events", device_touchpad_rel); - litest_add_no_device("device:invalid rel events", device_touch_rel); - litest_add_no_device("device:invalid rel events", device_abs_rel); - - litest_add_for_device("device:quirks", device_quirks_no_abs_mt_y, LITEST_ANKER_MOUSE_KBD); - litest_add_for_device("device:quirks", device_quirks_cyborg_rat_mode_button, LITEST_CYBORG_RAT); - litest_add_for_device("device:quirks", device_quirks_apple_magicmouse, LITEST_MAGICMOUSE); - litest_add_for_device("device:quirks", device_quirks_logitech_marble_mouse, LITEST_LOGITECH_TRACKBALL); - - litest_add("device:capability", device_capability_at_least_one, LITEST_ANY, LITEST_ANY); - litest_add("device:capability", device_capability_check_invalid, LITEST_ANY, LITEST_ANY); - - litest_add("device:size", device_has_size, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("device:size", device_has_size, LITEST_TABLET, LITEST_ANY); - litest_add("device:size", device_has_no_size, LITEST_ANY, - LITEST_TOUCHPAD|LITEST_TABLET|LITEST_TOUCH|LITEST_ABSOLUTE|LITEST_SINGLE_TOUCH); - - litest_add_for_device("device:output", device_get_output, LITEST_CALIBRATED_TOUCHSCREEN); - litest_add("device:output", device_no_output, LITEST_RELATIVE, LITEST_ANY); - litest_add("device:output", device_no_output, LITEST_KEYS, LITEST_ANY); - - litest_add("device:seat", device_seat_phys_name, LITEST_ANY, LITEST_ANY); -} diff -Nru libinput-1.10.3/test/test-gestures.c libinput-0.21.0/test/test-gestures.c --- libinput-1.10.3/test/test-gestures.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-gestures.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1084 +0,0 @@ -/* - * Copyright © 2015 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include - -#include "libinput-util.h" -#include "litest.h" - -START_TEST(gestures_cap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - - if (libevdev_has_property(dev->evdev, INPUT_PROP_SEMI_MT)) - ck_assert(!libinput_device_has_capability(device, - LIBINPUT_DEVICE_CAP_GESTURE)); - else - ck_assert(libinput_device_has_capability(device, - LIBINPUT_DEVICE_CAP_GESTURE)); -} -END_TEST - -START_TEST(gestures_nocap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - - ck_assert(!libinput_device_has_capability(device, - LIBINPUT_DEVICE_CAP_GESTURE)); -} -END_TEST - -START_TEST(gestures_swipe_3fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_gesture *gevent; - double dx, dy; - int cardinal = _i; /* ranged test */ - double dir_x, dir_y; - int cardinals[8][2] = { - { 0, 30 }, - { 30, 30 }, - { 30, 0 }, - { 30, -30 }, - { 0, -30 }, - { -30, -30 }, - { -30, 0 }, - { -30, 30 }, - }; - - if (libevdev_get_num_slots(dev->evdev) < 3) - return; - - dir_x = cardinals[cardinal][0]; - dir_y = cardinals[cardinal][1]; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 40, 40); - litest_touch_down(dev, 1, 50, 40); - litest_touch_down(dev, 2, 60, 40); - libinput_dispatch(li); - litest_touch_move_three_touches(dev, - 40, 40, - 50, 40, - 60, 40, - dir_x, dir_y, - 10, 2); - libinput_dispatch(li); - - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN, - 3); - dx = libinput_event_gesture_get_dx(gevent); - dy = libinput_event_gesture_get_dy(gevent); - ck_assert(dx == 0.0); - ck_assert(dy == 0.0); - libinput_event_destroy(event); - - while ((event = libinput_get_event(li)) != NULL) { - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, - 3); - - dx = libinput_event_gesture_get_dx(gevent); - dy = libinput_event_gesture_get_dy(gevent); - if (dir_x == 0.0) - ck_assert(dx == 0.0); - else if (dir_x < 0.0) - ck_assert(dx < 0.0); - else if (dir_x > 0.0) - ck_assert(dx > 0.0); - - if (dir_y == 0.0) - ck_assert(dy == 0.0); - else if (dir_y < 0.0) - ck_assert(dy < 0.0); - else if (dir_y > 0.0) - ck_assert(dy > 0.0); - - dx = libinput_event_gesture_get_dx_unaccelerated(gevent); - dy = libinput_event_gesture_get_dy_unaccelerated(gevent); - if (dir_x == 0.0) - ck_assert(dx == 0.0); - else if (dir_x < 0.0) - ck_assert(dx < 0.0); - else if (dir_x > 0.0) - ck_assert(dx > 0.0); - - if (dir_y == 0.0) - ck_assert(dy == 0.0); - else if (dir_y < 0.0) - ck_assert(dy < 0.0); - else if (dir_y > 0.0) - ck_assert(dy > 0.0); - - libinput_event_destroy(event); - } - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 2); - libinput_dispatch(li); - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_END, - 3); - ck_assert(!libinput_event_gesture_get_cancelled(gevent)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(gestures_swipe_3fg_btntool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_gesture *gevent; - double dx, dy; - int cardinal = _i; /* ranged test */ - double dir_x, dir_y; - int cardinals[8][2] = { - { 0, 30 }, - { 30, 30 }, - { 30, 0 }, - { 30, -30 }, - { 0, -30 }, - { -30, -30 }, - { -30, 0 }, - { -30, 30 }, - }; - - if (libevdev_get_num_slots(dev->evdev) > 2 || - !libinput_device_has_capability(dev->libinput_device, - LIBINPUT_DEVICE_CAP_GESTURE)) - return; - - dir_x = cardinals[cardinal][0]; - dir_y = cardinals[cardinal][1]; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 40, 40); - litest_touch_down(dev, 1, 50, 40); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - litest_touch_move_two_touches(dev, - 40, 40, - 50, 40, - dir_x, dir_y, - 10, 2); - libinput_dispatch(li); - - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN, - 3); - dx = libinput_event_gesture_get_dx(gevent); - dy = libinput_event_gesture_get_dy(gevent); - ck_assert(dx == 0.0); - ck_assert(dy == 0.0); - libinput_event_destroy(event); - - while ((event = libinput_get_event(li)) != NULL) { - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, - 3); - - dx = libinput_event_gesture_get_dx(gevent); - dy = libinput_event_gesture_get_dy(gevent); - if (dir_x == 0.0) - ck_assert(dx == 0.0); - else if (dir_x < 0.0) - ck_assert(dx < 0.0); - else if (dir_x > 0.0) - ck_assert(dx > 0.0); - - if (dir_y == 0.0) - ck_assert(dy == 0.0); - else if (dir_y < 0.0) - ck_assert(dy < 0.0); - else if (dir_y > 0.0) - ck_assert(dy > 0.0); - - dx = libinput_event_gesture_get_dx_unaccelerated(gevent); - dy = libinput_event_gesture_get_dy_unaccelerated(gevent); - if (dir_x == 0.0) - ck_assert(dx == 0.0); - else if (dir_x < 0.0) - ck_assert(dx < 0.0); - else if (dir_x > 0.0) - ck_assert(dx > 0.0); - - if (dir_y == 0.0) - ck_assert(dy == 0.0); - else if (dir_y < 0.0) - ck_assert(dy < 0.0); - else if (dir_y > 0.0) - ck_assert(dy > 0.0); - - libinput_event_destroy(event); - } - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - libinput_dispatch(li); - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_END, - 3); - ck_assert(!libinput_event_gesture_get_cancelled(gevent)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(gestures_swipe_4fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_gesture *gevent; - double dx, dy; - int cardinal = _i; /* ranged test */ - double dir_x, dir_y; - int cardinals[8][2] = { - { 0, 3 }, - { 3, 3 }, - { 3, 0 }, - { 3, -3 }, - { 0, -3 }, - { -3, -3 }, - { -3, 0 }, - { -3, 3 }, - }; - int i; - - if (libevdev_get_num_slots(dev->evdev) < 4) - return; - - dir_x = cardinals[cardinal][0]; - dir_y = cardinals[cardinal][1]; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 40, 40); - litest_touch_down(dev, 1, 50, 40); - litest_touch_down(dev, 2, 60, 40); - litest_touch_down(dev, 3, 70, 40); - libinput_dispatch(li); - - for (i = 0; i < 8; i++) { - litest_push_event_frame(dev); - - dir_x += cardinals[cardinal][0]; - dir_y += cardinals[cardinal][1]; - - litest_touch_move(dev, - 0, - 40 + dir_x, - 40 + dir_y); - litest_touch_move(dev, - 1, - 50 + dir_x, - 40 + dir_y); - litest_touch_move(dev, - 2, - 60 + dir_x, - 40 + dir_y); - litest_touch_move(dev, - 3, - 70 + dir_x, - 40 + dir_y); - litest_pop_event_frame(dev); - libinput_dispatch(li); - } - - libinput_dispatch(li); - - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN, - 4); - dx = libinput_event_gesture_get_dx(gevent); - dy = libinput_event_gesture_get_dy(gevent); - ck_assert(dx == 0.0); - ck_assert(dy == 0.0); - libinput_event_destroy(event); - - while ((event = libinput_get_event(li)) != NULL) { - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, - 4); - - dx = libinput_event_gesture_get_dx(gevent); - dy = libinput_event_gesture_get_dy(gevent); - if (dir_x == 0.0) - ck_assert(dx == 0.0); - else if (dir_x < 0.0) - ck_assert(dx < 0.0); - else if (dir_x > 0.0) - ck_assert(dx > 0.0); - - if (dir_y == 0.0) - ck_assert(dy == 0.0); - else if (dir_y < 0.0) - ck_assert(dy < 0.0); - else if (dir_y > 0.0) - ck_assert(dy > 0.0); - - dx = libinput_event_gesture_get_dx_unaccelerated(gevent); - dy = libinput_event_gesture_get_dy_unaccelerated(gevent); - if (dir_x == 0.0) - ck_assert(dx == 0.0); - else if (dir_x < 0.0) - ck_assert(dx < 0.0); - else if (dir_x > 0.0) - ck_assert(dx > 0.0); - - if (dir_y == 0.0) - ck_assert(dy == 0.0); - else if (dir_y < 0.0) - ck_assert(dy < 0.0); - else if (dir_y > 0.0) - ck_assert(dy > 0.0); - - libinput_event_destroy(event); - } - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 2); - litest_touch_up(dev, 3); - libinput_dispatch(li); - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_END, - 4); - ck_assert(!libinput_event_gesture_get_cancelled(gevent)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(gestures_swipe_4fg_btntool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_gesture *gevent; - double dx, dy; - int cardinal = _i; /* ranged test */ - double dir_x, dir_y; - int cardinals[8][2] = { - { 0, 30 }, - { 30, 30 }, - { 30, 0 }, - { 30, -30 }, - { 0, -30 }, - { -30, -30 }, - { -30, 0 }, - { -30, 30 }, - }; - - if (libevdev_get_num_slots(dev->evdev) > 2 || - !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP) || - !libinput_device_has_capability(dev->libinput_device, - LIBINPUT_DEVICE_CAP_GESTURE)) - return; - - dir_x = cardinals[cardinal][0]; - dir_y = cardinals[cardinal][1]; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 40, 40); - litest_touch_down(dev, 1, 50, 40); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - litest_touch_move_two_touches(dev, - 40, 40, - 50, 40, - dir_x, dir_y, - 10, 2); - libinput_dispatch(li); - - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN, - 4); - dx = libinput_event_gesture_get_dx(gevent); - dy = libinput_event_gesture_get_dy(gevent); - ck_assert(dx == 0.0); - ck_assert(dy == 0.0); - libinput_event_destroy(event); - - while ((event = libinput_get_event(li)) != NULL) { - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE, - 4); - - dx = libinput_event_gesture_get_dx(gevent); - dy = libinput_event_gesture_get_dy(gevent); - if (dir_x == 0.0) - ck_assert(dx == 0.0); - else if (dir_x < 0.0) - ck_assert(dx < 0.0); - else if (dir_x > 0.0) - ck_assert(dx > 0.0); - - if (dir_y == 0.0) - ck_assert(dy == 0.0); - else if (dir_y < 0.0) - ck_assert(dy < 0.0); - else if (dir_y > 0.0) - ck_assert(dy > 0.0); - - dx = libinput_event_gesture_get_dx_unaccelerated(gevent); - dy = libinput_event_gesture_get_dy_unaccelerated(gevent); - if (dir_x == 0.0) - ck_assert(dx == 0.0); - else if (dir_x < 0.0) - ck_assert(dx < 0.0); - else if (dir_x > 0.0) - ck_assert(dx > 0.0); - - if (dir_y == 0.0) - ck_assert(dy == 0.0); - else if (dir_y < 0.0) - ck_assert(dy < 0.0); - else if (dir_y > 0.0) - ck_assert(dy > 0.0); - - libinput_event_destroy(event); - } - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - libinput_dispatch(li); - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_END, - 4); - ck_assert(!libinput_event_gesture_get_cancelled(gevent)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(gestures_pinch_vertical_position) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int nfingers = _i; /* ranged test */ - - if (libevdev_get_num_slots(dev->evdev) < nfingers || - !libinput_device_has_capability(dev->libinput_device, - LIBINPUT_DEVICE_CAP_GESTURE)) - return; - - litest_disable_tap(dev->libinput_device); - litest_drain_events(li); - - litest_touch_down(dev, 0, 40, 30); - litest_touch_down(dev, 1, 50, 70); - litest_touch_down(dev, 2, 60, 70); - if (nfingers > 3) - litest_touch_down(dev, 3, 70, 70); - libinput_dispatch(li); - litest_timeout_gesture_scroll(); - libinput_dispatch(li); - - /* This is actually a small swipe gesture, all three fingers moving - * down but we're checking for the code that triggers based on - * finger position. */ - litest_touch_move_to(dev, 0, 40, 30, 40, 30.5, 1, 0); - litest_touch_move_to(dev, 1, 50, 70, 50, 70.5, 1, 0); - litest_touch_move_to(dev, 2, 60, 70, 60, 70.5, 1, 0); - if (nfingers > 3) - litest_touch_move_to(dev, 3, 70, 70, 70, 70.5, 1, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, - nfingers); - libinput_event_destroy(event); - - litest_touch_move_to(dev, 0, 40, 30.5, 40, 36, 5, 0); - litest_touch_move_to(dev, 1, 50, 70.5, 50, 76, 5, 0); - litest_touch_move_to(dev, 2, 60, 70.5, 60, 76, 5, 0); - if (nfingers > 3) - litest_touch_move_to(dev, 3, 70, 70.5, 60, 76, 5, 0); - libinput_dispatch(li); - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_GESTURE_PINCH_UPDATE); -} -END_TEST - -START_TEST(gestures_pinch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_gesture *gevent; - double dx, dy; - int cardinal = _i; /* ranged test */ - double dir_x, dir_y; - int i; - double scale, oldscale; - double angle; - int cardinals[8][2] = { - { 0, 30 }, - { 30, 30 }, - { 30, 0 }, - { 30, -30 }, - { 0, -30 }, - { -30, -30 }, - { -30, 0 }, - { -30, 30 }, - }; - - if (libevdev_get_num_slots(dev->evdev) < 2 || - !libinput_device_has_capability(dev->libinput_device, - LIBINPUT_DEVICE_CAP_GESTURE)) - return; - - dir_x = cardinals[cardinal][0]; - dir_y = cardinals[cardinal][1]; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y); - litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y); - libinput_dispatch(li); - - for (i = 0; i < 8; i++) { - litest_push_event_frame(dev); - if (dir_x > 0.0) - dir_x -= 2; - else if (dir_x < 0.0) - dir_x += 2; - if (dir_y > 0.0) - dir_y -= 2; - else if (dir_y < 0.0) - dir_y += 2; - litest_touch_move(dev, - 0, - 50 + dir_x, - 50 + dir_y); - litest_touch_move(dev, - 1, - 50 - dir_x, - 50 - dir_y); - litest_pop_event_frame(dev); - libinput_dispatch(li); - } - - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, - 2); - dx = libinput_event_gesture_get_dx(gevent); - dy = libinput_event_gesture_get_dy(gevent); - scale = libinput_event_gesture_get_scale(gevent); - ck_assert(dx == 0.0); - ck_assert(dy == 0.0); - ck_assert(scale == 1.0); - - libinput_event_destroy(event); - - while ((event = libinput_get_event(li)) != NULL) { - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, - 2); - - oldscale = scale; - scale = libinput_event_gesture_get_scale(gevent); - - ck_assert(scale < oldscale); - - angle = libinput_event_gesture_get_angle_delta(gevent); - ck_assert_double_le(fabs(angle), 1.0); - - libinput_event_destroy(event); - libinput_dispatch(li); - } - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - libinput_dispatch(li); - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_END, - 2); - ck_assert(!libinput_event_gesture_get_cancelled(gevent)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(gestures_pinch_3fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_gesture *gevent; - double dx, dy; - int cardinal = _i; /* ranged test */ - double dir_x, dir_y; - int i; - double scale, oldscale; - double angle; - int cardinals[8][2] = { - { 0, 30 }, - { 30, 30 }, - { 30, 0 }, - { 30, -30 }, - { 0, -30 }, - { -30, -30 }, - { -30, 0 }, - { -30, 30 }, - }; - - if (libevdev_get_num_slots(dev->evdev) < 3) - return; - - dir_x = cardinals[cardinal][0]; - dir_y = cardinals[cardinal][1]; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y); - litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y); - litest_touch_down(dev, 2, 51 - dir_x, 51 - dir_y); - libinput_dispatch(li); - - for (i = 0; i < 8; i++) { - litest_push_event_frame(dev); - if (dir_x > 0.0) - dir_x -= 2; - else if (dir_x < 0.0) - dir_x += 2; - if (dir_y > 0.0) - dir_y -= 2; - else if (dir_y < 0.0) - dir_y += 2; - litest_touch_move(dev, - 0, - 50 + dir_x, - 50 + dir_y); - litest_touch_move(dev, - 1, - 50 - dir_x, - 50 - dir_y); - litest_touch_move(dev, - 2, - 51 - dir_x, - 51 - dir_y); - litest_pop_event_frame(dev); - libinput_dispatch(li); - } - - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, - 3); - dx = libinput_event_gesture_get_dx(gevent); - dy = libinput_event_gesture_get_dy(gevent); - scale = libinput_event_gesture_get_scale(gevent); - ck_assert(dx == 0.0); - ck_assert(dy == 0.0); - ck_assert(scale == 1.0); - - libinput_event_destroy(event); - - while ((event = libinput_get_event(li)) != NULL) { - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, - 3); - - oldscale = scale; - scale = libinput_event_gesture_get_scale(gevent); - - ck_assert(scale < oldscale); - - angle = libinput_event_gesture_get_angle_delta(gevent); - ck_assert_double_le(fabs(angle), 1.0); - - libinput_event_destroy(event); - libinput_dispatch(li); - } - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 2); - libinput_dispatch(li); - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_END, - 3); - ck_assert(!libinput_event_gesture_get_cancelled(gevent)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(gestures_pinch_4fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_gesture *gevent; - double dx, dy; - int cardinal = _i; /* ranged test */ - double dir_x, dir_y; - int i; - double scale, oldscale; - double angle; - int cardinals[8][2] = { - { 0, 30 }, - { 30, 30 }, - { 30, 0 }, - { 30, -30 }, - { 0, -30 }, - { -30, -30 }, - { -30, 0 }, - { -30, 30 }, - }; - - if (libevdev_get_num_slots(dev->evdev) < 4) - return; - - dir_x = cardinals[cardinal][0]; - dir_y = cardinals[cardinal][1]; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y); - litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y); - litest_touch_down(dev, 2, 51 - dir_x, 51 - dir_y); - litest_touch_down(dev, 3, 52 - dir_x, 52 - dir_y); - libinput_dispatch(li); - - for (i = 0; i < 8; i++) { - litest_push_event_frame(dev); - if (dir_x > 0.0) - dir_x -= 2; - else if (dir_x < 0.0) - dir_x += 2; - if (dir_y > 0.0) - dir_y -= 2; - else if (dir_y < 0.0) - dir_y += 2; - litest_touch_move(dev, - 0, - 50 + dir_x, - 50 + dir_y); - litest_touch_move(dev, - 1, - 50 - dir_x, - 50 - dir_y); - litest_touch_move(dev, - 2, - 51 - dir_x, - 51 - dir_y); - litest_touch_move(dev, - 3, - 52 - dir_x, - 52 - dir_y); - litest_pop_event_frame(dev); - libinput_dispatch(li); - } - - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, - 4); - dx = libinput_event_gesture_get_dx(gevent); - dy = libinput_event_gesture_get_dy(gevent); - scale = libinput_event_gesture_get_scale(gevent); - ck_assert(dx == 0.0); - ck_assert(dy == 0.0); - ck_assert(scale == 1.0); - - libinput_event_destroy(event); - - while ((event = libinput_get_event(li)) != NULL) { - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, - 4); - - oldscale = scale; - scale = libinput_event_gesture_get_scale(gevent); - - ck_assert(scale < oldscale); - - angle = libinput_event_gesture_get_angle_delta(gevent); - ck_assert_double_le(fabs(angle), 1.0); - - libinput_event_destroy(event); - libinput_dispatch(li); - } - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 2); - litest_touch_up(dev, 3); - libinput_dispatch(li); - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_END, - 4); - ck_assert(!libinput_event_gesture_get_cancelled(gevent)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(gestures_spread) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_gesture *gevent; - double dx, dy; - int cardinal = _i; /* ranged test */ - double dir_x, dir_y; - int i; - double scale, oldscale; - double angle; - int cardinals[8][2] = { - { 0, 30 }, - { 30, 30 }, - { 30, 0 }, - { 30, -30 }, - { 0, -30 }, - { -30, -30 }, - { -30, 0 }, - { -30, 30 }, - }; - - if (libevdev_get_num_slots(dev->evdev) < 2 || - !libinput_device_has_capability(dev->libinput_device, - LIBINPUT_DEVICE_CAP_GESTURE)) - return; - - dir_x = cardinals[cardinal][0]; - dir_y = cardinals[cardinal][1]; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y); - litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y); - libinput_dispatch(li); - - for (i = 0; i < 15; i++) { - litest_push_event_frame(dev); - if (dir_x > 0.0) - dir_x += 1; - else if (dir_x < 0.0) - dir_x -= 1; - if (dir_y > 0.0) - dir_y += 1; - else if (dir_y < 0.0) - dir_y -= 1; - litest_touch_move(dev, - 0, - 50 + dir_x, - 50 + dir_y); - litest_touch_move(dev, - 1, - 50 - dir_x, - 50 - dir_y); - litest_pop_event_frame(dev); - libinput_dispatch(li); - } - - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_BEGIN, - 2); - dx = libinput_event_gesture_get_dx(gevent); - dy = libinput_event_gesture_get_dy(gevent); - scale = libinput_event_gesture_get_scale(gevent); - ck_assert(dx == 0.0); - ck_assert(dy == 0.0); - ck_assert(scale == 1.0); - - libinput_event_destroy(event); - - while ((event = libinput_get_event(li)) != NULL) { - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_UPDATE, - 2); - oldscale = scale; - scale = libinput_event_gesture_get_scale(gevent); - ck_assert(scale > oldscale); - - angle = libinput_event_gesture_get_angle_delta(gevent); - ck_assert_double_le(fabs(angle), 1.0); - - libinput_event_destroy(event); - libinput_dispatch(li); - } - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - libinput_dispatch(li); - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_PINCH_END, - 2); - ck_assert(!libinput_event_gesture_get_cancelled(gevent)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(gestures_time_usec) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_gesture *gevent; - uint64_t time_usec; - - if (libevdev_get_num_slots(dev->evdev) < 3) - return; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 40, 40); - litest_touch_down(dev, 1, 50, 40); - litest_touch_down(dev, 2, 60, 40); - libinput_dispatch(li); - litest_touch_move_three_touches(dev, - 40, 40, - 50, 40, - 60, 40, - 0, 30, - 10, 2); - - libinput_dispatch(li); - event = libinput_get_event(li); - gevent = litest_is_gesture_event(event, - LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN, - 3); - time_usec = libinput_event_gesture_get_time_usec(gevent); - ck_assert_int_eq(libinput_event_gesture_get_time(gevent), - (uint32_t) (time_usec / 1000)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(gestures_3fg_buttonarea_scroll) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_num_slots(dev->evdev) < 3) - return; - - litest_enable_buttonareas(dev); - litest_enable_2fg_scroll(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 40, 20); - litest_touch_down(dev, 1, 30, 20); - /* third finger in btnarea */ - litest_touch_down(dev, 2, 50, 99); - libinput_dispatch(li); - litest_touch_move_two_touches(dev, - 40, 20, - 30, 20, - 0, 40, - 10, 2); - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - libinput_dispatch(li); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 4); -} -END_TEST - -START_TEST(gestures_3fg_buttonarea_scroll_btntool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_num_slots(dev->evdev) > 2) - return; - - litest_enable_buttonareas(dev); - litest_enable_2fg_scroll(dev); - litest_drain_events(li); - - /* first finger in btnarea */ - litest_touch_down(dev, 0, 20, 99); - litest_touch_down(dev, 1, 30, 20); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_touch_move_to(dev, 1, 30, 20, 30, 70, 10, 1); - - litest_touch_up(dev, 1); - libinput_dispatch(li); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 4); -} -END_TEST - -void -litest_setup_tests_gestures(void) -{ - /* N, NE, ... */ - struct range cardinals = { 0, 8 }; - struct range fingers = { 3, 5 }; - - litest_add("gestures:cap", gestures_cap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("gestures:cap", gestures_nocap, LITEST_ANY, LITEST_TOUCHPAD); - - litest_add_ranged("gestures:swipe", gestures_swipe_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); - litest_add_ranged("gestures:swipe", gestures_swipe_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); - litest_add_ranged("gestures:swipe", gestures_swipe_4fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); - litest_add_ranged("gestures:swipe", gestures_swipe_4fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); - litest_add_ranged("gestures:pinch", gestures_pinch, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); - litest_add_ranged("gestures:pinch", gestures_pinch_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); - litest_add_ranged("gestures:pinch", gestures_pinch_4fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); - litest_add_ranged("gestures:pinch", gestures_spread, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals); - litest_add_ranged("gestures:pinch", gestures_pinch_vertical_position, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &fingers); - - litest_add("gestures:swipe", gestures_3fg_buttonarea_scroll, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH); - litest_add("gestures:swipe", gestures_3fg_buttonarea_scroll_btntool, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH); - - litest_add("gestures:time", gestures_time_usec, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); -} diff -Nru libinput-1.10.3/test/test-keyboard.c libinput-0.21.0/test/test-keyboard.c --- libinput-1.10.3/test/test-keyboard.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-keyboard.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,495 +0,0 @@ -/* - * Copyright © 2014 Jonas Ådahl - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include -#include - -#include "libinput-util.h" -#include "litest.h" - -START_TEST(keyboard_seat_key_count) -{ - const int num_devices = 4; - struct litest_device *devices[num_devices]; - struct libinput *libinput; - struct libinput_event *ev; - struct libinput_event_keyboard *kev; - int i; - int seat_key_count = 0; - int expected_key_button_count = 0; - char device_name[255]; - - libinput = litest_create_context(); - for (i = 0; i < num_devices; ++i) { - sprintf(device_name, "litest Generic keyboard (%d)", i); - devices[i] = litest_add_device_with_overrides(libinput, - LITEST_KEYBOARD, - device_name, - NULL, NULL, NULL); - } - - litest_drain_events(libinput); - - for (i = 0; i < num_devices; ++i) - litest_keyboard_key(devices[i], KEY_A, true); - - libinput_dispatch(libinput); - while ((ev = libinput_get_event(libinput))) { - kev = litest_is_keyboard_event(ev, - KEY_A, - LIBINPUT_KEY_STATE_PRESSED); - - ++expected_key_button_count; - seat_key_count = - libinput_event_keyboard_get_seat_key_count(kev); - ck_assert_int_eq(expected_key_button_count, seat_key_count); - - libinput_event_destroy(ev); - libinput_dispatch(libinput); - } - - ck_assert_int_eq(seat_key_count, num_devices); - - for (i = 0; i < num_devices; ++i) - litest_keyboard_key(devices[i], KEY_A, false); - - libinput_dispatch(libinput); - while ((ev = libinput_get_event(libinput))) { - kev = libinput_event_get_keyboard_event(ev); - ck_assert_notnull(kev); - ck_assert_int_eq(libinput_event_keyboard_get_key(kev), KEY_A); - ck_assert_int_eq(libinput_event_keyboard_get_key_state(kev), - LIBINPUT_KEY_STATE_RELEASED); - - --expected_key_button_count; - seat_key_count = - libinput_event_keyboard_get_seat_key_count(kev); - ck_assert_int_eq(expected_key_button_count, seat_key_count); - - libinput_event_destroy(ev); - libinput_dispatch(libinput); - } - - ck_assert_int_eq(seat_key_count, 0); - - for (i = 0; i < num_devices; ++i) - litest_delete_device(devices[i]); - libinput_unref(libinput); -} -END_TEST - -START_TEST(keyboard_ignore_no_pressed_release) -{ - struct litest_device *dev; - struct libinput *unused_libinput; - struct libinput *libinput; - struct libinput_event *event; - struct libinput_event_keyboard *kevent; - int events[] = { - EV_KEY, KEY_A, - -1, -1, - }; - enum libinput_key_state *state; - enum libinput_key_state expected_states[] = { - LIBINPUT_KEY_STATE_PRESSED, - LIBINPUT_KEY_STATE_RELEASED, - }; - - /* We can't send pressed -> released -> pressed events using uinput - * as such non-symmetric events are dropped. Work-around this by first - * adding the test device to the tested context after having sent an - * initial pressed event. */ - unused_libinput = litest_create_context(); - dev = litest_add_device_with_overrides(unused_libinput, - LITEST_KEYBOARD, - "Generic keyboard", - NULL, NULL, events); - - litest_keyboard_key(dev, KEY_A, true); - litest_drain_events(unused_libinput); - - libinput = litest_create_context(); - libinput_path_add_device(libinput, - libevdev_uinput_get_devnode(dev->uinput)); - litest_drain_events(libinput); - - litest_keyboard_key(dev, KEY_A, false); - litest_keyboard_key(dev, KEY_A, true); - litest_keyboard_key(dev, KEY_A, false); - - libinput_dispatch(libinput); - - ARRAY_FOR_EACH(expected_states, state) { - event = libinput_get_event(libinput); - ck_assert_notnull(event); - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_KEYBOARD_KEY); - kevent = libinput_event_get_keyboard_event(event); - ck_assert_int_eq(libinput_event_keyboard_get_key(kevent), - KEY_A); - ck_assert_int_eq(libinput_event_keyboard_get_key_state(kevent), - *state); - libinput_event_destroy(event); - libinput_dispatch(libinput); - } - - litest_assert_empty_queue(libinput); - litest_delete_device(dev); - libinput_unref(libinput); - libinput_unref(unused_libinput); -} -END_TEST - -START_TEST(keyboard_key_auto_release) -{ - struct libinput *libinput; - struct litest_device *dev; - struct libinput_event *event; - enum libinput_event_type type; - struct libinput_event_keyboard *kevent; - struct { - int code; - int released; - } keys[] = { - { .code = KEY_A, }, - { .code = KEY_S, }, - { .code = KEY_D, }, - { .code = KEY_G, }, - { .code = KEY_Z, }, - { .code = KEY_DELETE, }, - { .code = KEY_F24, }, - }; - int events[2 * (ARRAY_LENGTH(keys) + 1)]; - unsigned i; - int key; - int valid_code; - - /* Enable all tested keys on the device */ - i = 0; - while (i < 2 * ARRAY_LENGTH(keys)) { - key = keys[i / 2].code; - events[i++] = EV_KEY; - events[i++] = key; - } - events[i++] = -1; - events[i++] = -1; - - libinput = litest_create_context(); - dev = litest_add_device_with_overrides(libinput, - LITEST_KEYBOARD, - "Generic keyboard", - NULL, NULL, events); - - litest_drain_events(libinput); - - /* Send pressed events, without releasing */ - for (i = 0; i < ARRAY_LENGTH(keys); ++i) { - key = keys[i].code; - litest_event(dev, EV_KEY, key, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(libinput); - - event = libinput_get_event(libinput); - litest_is_keyboard_event(event, - key, - LIBINPUT_KEY_STATE_PRESSED); - libinput_event_destroy(event); - } - - litest_drain_events(libinput); - - /* "Disconnect" device */ - litest_delete_device(dev); - - /* Mark all released keys until device is removed */ - while (1) { - event = libinput_get_event(libinput); - ck_assert_notnull(event); - type = libinput_event_get_type(event); - - if (type == LIBINPUT_EVENT_DEVICE_REMOVED) { - libinput_event_destroy(event); - break; - } - - ck_assert_int_eq(type, LIBINPUT_EVENT_KEYBOARD_KEY); - kevent = libinput_event_get_keyboard_event(event); - ck_assert_int_eq(libinput_event_keyboard_get_key_state(kevent), - LIBINPUT_KEY_STATE_RELEASED); - key = libinput_event_keyboard_get_key(kevent); - - valid_code = 0; - for (i = 0; i < ARRAY_LENGTH(keys); ++i) { - if (keys[i].code == key) { - ck_assert_int_eq(keys[i].released, 0); - keys[i].released = 1; - valid_code = 1; - } - } - ck_assert_int_eq(valid_code, 1); - libinput_event_destroy(event); - } - - /* Check that all pressed keys has been released. */ - for (i = 0; i < ARRAY_LENGTH(keys); ++i) { - ck_assert_int_eq(keys[i].released, 1); - } - - libinput_unref(libinput); -} -END_TEST - -START_TEST(keyboard_has_key) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - unsigned int code; - int evdev_has, libinput_has; - - ck_assert(libinput_device_has_capability( - device, - LIBINPUT_DEVICE_CAP_KEYBOARD)); - - for (code = 0; code < KEY_CNT; code++) { - evdev_has = libevdev_has_event_code(dev->evdev, EV_KEY, code); - libinput_has = libinput_device_keyboard_has_key(device, code); - ck_assert_int_eq(evdev_has, libinput_has); - } -} -END_TEST - -START_TEST(keyboard_keys_bad_device) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - unsigned int code; - int has_key; - - if (libinput_device_has_capability(device, - LIBINPUT_DEVICE_CAP_KEYBOARD)) - return; - - for (code = 0; code < KEY_CNT; code++) { - has_key = libinput_device_keyboard_has_key(device, code); - ck_assert_int_eq(has_key, -1); - } -} -END_TEST - -START_TEST(keyboard_time_usec) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_keyboard *kev; - struct libinput_event *event; - uint64_t time_usec; - - if (!libevdev_has_event_code(dev->evdev, EV_KEY, KEY_A)) - return; - - litest_drain_events(dev->libinput); - - litest_keyboard_key(dev, KEY_A, true); - libinput_dispatch(li); - - event = libinput_get_event(li); - kev = litest_is_keyboard_event(event, - KEY_A, - LIBINPUT_KEY_STATE_PRESSED); - - time_usec = libinput_event_keyboard_get_time_usec(kev); - ck_assert_int_eq(libinput_event_keyboard_get_time(kev), - (uint32_t) (time_usec / 1000)); - - libinput_event_destroy(event); - litest_drain_events(dev->libinput); -} -END_TEST - -START_TEST(keyboard_no_buttons) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int code; - const char *name; - - litest_drain_events(dev->libinput); - - for (code = 0; code < KEY_MAX; code++) { - if (!libevdev_has_event_code(dev->evdev, EV_KEY, code)) - continue; - - name = libevdev_event_code_get_name(EV_KEY, code); - if (!name || !strneq(name, "KEY_", 4)) - continue; - - litest_keyboard_key(dev, code, true); - litest_keyboard_key(dev, code, false); - libinput_dispatch(li); - - event = libinput_get_event(li); - litest_is_keyboard_event(event, - code, - LIBINPUT_KEY_STATE_PRESSED); - libinput_event_destroy(event); - event = libinput_get_event(li); - litest_is_keyboard_event(event, - code, - LIBINPUT_KEY_STATE_RELEASED); - libinput_event_destroy(event); - } -} -END_TEST - -START_TEST(keyboard_frame_order) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!libevdev_has_event_code(dev->evdev, EV_KEY, KEY_A) || - !libevdev_has_event_code(dev->evdev, EV_KEY, KEY_LEFTSHIFT)) - return; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, KEY_LEFTSHIFT, 1); - litest_event(dev, EV_KEY, KEY_A, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_assert_key_event(li, - KEY_LEFTSHIFT, - LIBINPUT_KEY_STATE_PRESSED); - litest_assert_key_event(li, KEY_A, LIBINPUT_KEY_STATE_PRESSED); - - litest_event(dev, EV_KEY, KEY_LEFTSHIFT, 0); - litest_event(dev, EV_KEY, KEY_A, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_assert_key_event(li, - KEY_LEFTSHIFT, - LIBINPUT_KEY_STATE_RELEASED); - litest_assert_key_event(li, KEY_A, LIBINPUT_KEY_STATE_RELEASED); - - litest_event(dev, EV_KEY, KEY_A, 1); - litest_event(dev, EV_KEY, KEY_LEFTSHIFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_assert_key_event(li, KEY_A, LIBINPUT_KEY_STATE_PRESSED); - litest_assert_key_event(li, - KEY_LEFTSHIFT, - LIBINPUT_KEY_STATE_PRESSED); - - litest_event(dev, EV_KEY, KEY_A, 0); - litest_event(dev, EV_KEY, KEY_LEFTSHIFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_assert_key_event(li, KEY_A, LIBINPUT_KEY_STATE_RELEASED); - litest_assert_key_event(li, - KEY_LEFTSHIFT, - LIBINPUT_KEY_STATE_RELEASED); - - libinput_dispatch(li); -} -END_TEST - -START_TEST(keyboard_leds) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - - /* we can't actually test the results here without physically - * looking at the LEDs. So all we do is trigger the code for devices - * with and without LEDs and check that it doesn't go boom - */ - - libinput_device_led_update(device, - LIBINPUT_LED_NUM_LOCK); - libinput_device_led_update(device, - LIBINPUT_LED_CAPS_LOCK); - libinput_device_led_update(device, - LIBINPUT_LED_SCROLL_LOCK); - - libinput_device_led_update(device, - LIBINPUT_LED_NUM_LOCK| - LIBINPUT_LED_CAPS_LOCK); - libinput_device_led_update(device, - LIBINPUT_LED_NUM_LOCK| - LIBINPUT_LED_CAPS_LOCK | - LIBINPUT_LED_SCROLL_LOCK); - libinput_device_led_update(device, 0); - libinput_device_led_update(device, -1); -} -END_TEST - -START_TEST(keyboard_no_scroll) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_scroll_method method; - enum libinput_config_status status; - - method = libinput_device_config_scroll_get_method(device); - ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL); - method = libinput_device_config_scroll_get_default_method(device); - ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL); - - status = libinput_device_config_scroll_set_method(device, - LIBINPUT_CONFIG_SCROLL_2FG); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - status = libinput_device_config_scroll_set_method(device, - LIBINPUT_CONFIG_SCROLL_EDGE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - status = libinput_device_config_scroll_set_method(device, - LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - status = libinput_device_config_scroll_set_method(device, - LIBINPUT_CONFIG_SCROLL_NO_SCROLL); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); -} -END_TEST - -void -litest_setup_tests_keyboard(void) -{ - litest_add_no_device("keyboard:seat key count", keyboard_seat_key_count); - litest_add_no_device("keyboard:key counting", keyboard_ignore_no_pressed_release); - litest_add_no_device("keyboard:key counting", keyboard_key_auto_release); - litest_add("keyboard:keys", keyboard_has_key, LITEST_KEYS, LITEST_ANY); - litest_add("keyboard:keys", keyboard_keys_bad_device, LITEST_ANY, LITEST_ANY); - litest_add("keyboard:time", keyboard_time_usec, LITEST_KEYS, LITEST_ANY); - - litest_add("keyboard:events", keyboard_no_buttons, LITEST_KEYS, LITEST_ANY); - litest_add("keyboard:events", keyboard_frame_order, LITEST_KEYS, LITEST_ANY); - - litest_add("keyboard:leds", keyboard_leds, LITEST_ANY, LITEST_ANY); - - litest_add("keyboard:scroll", keyboard_no_scroll, LITEST_KEYS, LITEST_WHEEL); -} diff -Nru libinput-1.10.3/test/test-log.c libinput-0.21.0/test/test-log.c --- libinput-1.10.3/test/test-log.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-log.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,215 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include -#include -#include -#include -#include - -#include "litest.h" - -static int log_handler_called; -static struct libinput *log_handler_context; - -static int open_restricted(const char *path, int flags, void *data) -{ - int fd; - fd = open(path, flags); - return fd < 0 ? -errno : fd; -} -static void close_restricted(int fd, void *data) -{ - close(fd); -} - -static const struct libinput_interface simple_interface = { - .open_restricted = open_restricted, - .close_restricted = close_restricted, -}; - -static void -simple_log_handler(struct libinput *libinput, - enum libinput_log_priority priority, - const char *format, - va_list args) -{ - log_handler_called++; - if (log_handler_context) - litest_assert_ptr_eq(libinput, log_handler_context); - litest_assert_notnull(format); -} - -START_TEST(log_default_priority) -{ - enum libinput_log_priority pri; - struct libinput *li; - - li = libinput_path_create_context(&simple_interface, NULL); - pri = libinput_log_get_priority(li); - - ck_assert_int_eq(pri, LIBINPUT_LOG_PRIORITY_ERROR); - - libinput_unref(li); -} -END_TEST - -START_TEST(log_handler_invoked) -{ - struct libinput *li; - - log_handler_context = NULL; - log_handler_called = 0; - - li = libinput_path_create_context(&simple_interface, NULL); - - libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_DEBUG); - libinput_log_set_handler(li, simple_log_handler); - log_handler_context = li; - - libinput_path_add_device(li, "/tmp"); - - ck_assert_int_gt(log_handler_called, 0); - - libinput_unref(li); - - log_handler_context = NULL; - log_handler_called = 0; -} -END_TEST - -START_TEST(log_handler_NULL) -{ - struct libinput *li; - - log_handler_called = 0; - - li = libinput_path_create_context(&simple_interface, NULL); - libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_DEBUG); - libinput_log_set_handler(li, NULL); - - libinput_path_add_device(li, "/tmp"); - - ck_assert_int_eq(log_handler_called, 0); - - libinput_unref(li); - - log_handler_called = 0; -} -END_TEST - -START_TEST(log_priority) -{ - struct libinput *li; - - log_handler_context = NULL; - log_handler_called = 0; - - li = libinput_path_create_context(&simple_interface, NULL); - libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_ERROR); - libinput_log_set_handler(li, simple_log_handler); - log_handler_context = li; - - libinput_path_add_device(li, "/tmp"); - - ck_assert_int_eq(log_handler_called, 1); - - libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_INFO); - /* event0 exists on any box we care to run the test suite on and we - * currently prints *something* for each device */ - libinput_path_add_device(li, "/dev/input/event0"); - ck_assert_int_gt(log_handler_called, 1); - - libinput_unref(li); - - log_handler_context = NULL; - log_handler_called = 0; -} -END_TEST - -static int axisrange_log_handler_called = 0; - -static void -axisrange_warning_log_handler(struct libinput *libinput, - enum libinput_log_priority priority, - const char *format, - va_list args) -{ - const char *substr; - - axisrange_log_handler_called++; - litest_assert_notnull(format); - - substr = strstr(format, "is outside expected range"); - litest_assert_notnull(substr); -} - -START_TEST(log_axisrange_warning) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - const struct input_absinfo *abs; - int axis = _i; /* looped test */ - - litest_touch_down(dev, 0, 90, 100); - litest_drain_events(li); - - libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_INFO); - libinput_log_set_handler(li, axisrange_warning_log_handler); - - abs = libevdev_get_abs_info(dev->evdev, axis); - - for (int i = 0; i < 100; i++) { - litest_event(dev, EV_ABS, - ABS_MT_POSITION_X + axis, - abs->maximum * 2 + i); - litest_event(dev, EV_ABS, axis, abs->maximum * 2); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - - /* Expect only one message per 5 min */ - ck_assert_int_eq(axisrange_log_handler_called, 1); - - libinput_log_set_priority(li, LIBINPUT_LOG_PRIORITY_ERROR); - litest_restore_log_handler(li); - axisrange_log_handler_called = 0; -} -END_TEST - -void -litest_setup_tests_log(void) -{ - struct range axes = { ABS_X, ABS_Y + 1}; - - litest_add_no_device("log:defaults", log_default_priority); - litest_add_no_device("log:logging", log_handler_invoked); - litest_add_no_device("log:logging", log_handler_NULL); - litest_add_no_device("log:logging", log_priority); - - litest_add_ranged("log:warnings", log_axisrange_warning, LITEST_TOUCH, LITEST_ANY, &axes); - litest_add_ranged("log:warnings", log_axisrange_warning, LITEST_TOUCHPAD, LITEST_ANY, &axes); -} diff -Nru libinput-1.10.3/test/test-misc.c libinput-0.21.0/test/test-misc.c --- libinput-1.10.3/test/test-misc.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-misc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1537 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "litest.h" -#include "libinput-util.h" - -static int open_restricted(const char *path, int flags, void *data) -{ - int fd = open(path, flags); - return fd < 0 ? -errno : fd; -} -static void close_restricted(int fd, void *data) -{ - close(fd); -} - -static const struct libinput_interface simple_interface = { - .open_restricted = open_restricted, - .close_restricted = close_restricted, -}; - -static struct libevdev_uinput * -create_simple_test_device(const char *name, ...) -{ - va_list args; - struct libevdev_uinput *uinput; - struct libevdev *evdev; - unsigned int type, code; - int rc; - struct input_absinfo abs = { - .value = -1, - .minimum = 0, - .maximum = 100, - .fuzz = 0, - .flat = 0, - .resolution = 100, - }; - - evdev = libevdev_new(); - litest_assert_notnull(evdev); - libevdev_set_name(evdev, name); - - va_start(args, name); - - while ((type = va_arg(args, unsigned int)) != (unsigned int)-1 && - (code = va_arg(args, unsigned int)) != (unsigned int)-1) { - const struct input_absinfo *a = NULL; - if (type == EV_ABS) - a = &abs; - libevdev_enable_event_code(evdev, type, code, a); - } - - va_end(args); - - rc = libevdev_uinput_create_from_device(evdev, - LIBEVDEV_UINPUT_OPEN_MANAGED, - &uinput); - litest_assert_int_eq(rc, 0); - libevdev_free(evdev); - - return uinput; -} - -START_TEST(event_conversion_device_notify) -{ - struct libevdev_uinput *uinput; - struct libinput *li; - struct libinput_event *event; - int device_added = 0, device_removed = 0; - - uinput = create_simple_test_device("litest test device", - EV_REL, REL_X, - EV_REL, REL_Y, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_MIDDLE, - EV_KEY, BTN_LEFT, - -1, -1); - li = libinput_path_create_context(&simple_interface, NULL); - litest_restore_log_handler(li); /* use the default litest handler */ - libinput_path_add_device(li, libevdev_uinput_get_devnode(uinput)); - - libinput_dispatch(li); - libinput_suspend(li); - libinput_resume(li); - - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - - if (type == LIBINPUT_EVENT_DEVICE_ADDED || - type == LIBINPUT_EVENT_DEVICE_REMOVED) { - struct libinput_event_device_notify *dn; - struct libinput_event *base; - dn = libinput_event_get_device_notify_event(event); - base = libinput_event_device_notify_get_base_event(dn); - ck_assert(event == base); - - if (type == LIBINPUT_EVENT_DEVICE_ADDED) - device_added++; - else if (type == LIBINPUT_EVENT_DEVICE_REMOVED) - device_removed++; - - litest_disable_log_handler(li); - ck_assert(libinput_event_get_pointer_event(event) == NULL); - ck_assert(libinput_event_get_keyboard_event(event) == NULL); - ck_assert(libinput_event_get_touch_event(event) == NULL); - ck_assert(libinput_event_get_gesture_event(event) == NULL); - ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); - ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); - ck_assert(libinput_event_get_switch_event(event) == NULL); - litest_restore_log_handler(li); - } - - libinput_event_destroy(event); - } - - libinput_unref(li); - libevdev_uinput_destroy(uinput); - - ck_assert_int_gt(device_added, 0); - ck_assert_int_gt(device_removed, 0); -} -END_TEST - -START_TEST(event_conversion_pointer) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int motion = 0, button = 0; - - /* Queue at least two relative motion events as the first one may - * be absorbed by the pointer acceleration filter. */ - litest_event(dev, EV_REL, REL_X, -1); - litest_event(dev, EV_REL, REL_Y, -1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_REL, REL_X, -1); - litest_event(dev, EV_REL, REL_Y, -1); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - - if (type == LIBINPUT_EVENT_POINTER_MOTION || - type == LIBINPUT_EVENT_POINTER_BUTTON) { - struct libinput_event_pointer *p; - struct libinput_event *base; - p = libinput_event_get_pointer_event(event); - base = libinput_event_pointer_get_base_event(p); - ck_assert(event == base); - - if (type == LIBINPUT_EVENT_POINTER_MOTION) - motion++; - else if (type == LIBINPUT_EVENT_POINTER_BUTTON) - button++; - - litest_disable_log_handler(li); - ck_assert(libinput_event_get_device_notify_event(event) == NULL); - ck_assert(libinput_event_get_keyboard_event(event) == NULL); - ck_assert(libinput_event_get_touch_event(event) == NULL); - ck_assert(libinput_event_get_gesture_event(event) == NULL); - ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); - ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); - ck_assert(libinput_event_get_switch_event(event) == NULL); - litest_restore_log_handler(li); - } - libinput_event_destroy(event); - } - - ck_assert_int_gt(motion, 0); - ck_assert_int_gt(button, 0); -} -END_TEST - -START_TEST(event_conversion_pointer_abs) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int motion = 0, button = 0; - - litest_event(dev, EV_ABS, ABS_X, 10); - litest_event(dev, EV_ABS, ABS_Y, 50); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_ABS, ABS_X, 30); - litest_event(dev, EV_ABS, ABS_Y, 30); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - - if (type == LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE || - type == LIBINPUT_EVENT_POINTER_BUTTON) { - struct libinput_event_pointer *p; - struct libinput_event *base; - p = libinput_event_get_pointer_event(event); - base = libinput_event_pointer_get_base_event(p); - ck_assert(event == base); - - if (type == LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE) - motion++; - else if (type == LIBINPUT_EVENT_POINTER_BUTTON) - button++; - - litest_disable_log_handler(li); - ck_assert(libinput_event_get_device_notify_event(event) == NULL); - ck_assert(libinput_event_get_keyboard_event(event) == NULL); - ck_assert(libinput_event_get_touch_event(event) == NULL); - ck_assert(libinput_event_get_gesture_event(event) == NULL); - ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); - ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); - ck_assert(libinput_event_get_switch_event(event) == NULL); - litest_restore_log_handler(li); - } - libinput_event_destroy(event); - } - - ck_assert_int_gt(motion, 0); - ck_assert_int_gt(button, 0); -} -END_TEST - -START_TEST(event_conversion_key) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int key = 0; - - litest_event(dev, EV_KEY, KEY_A, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, KEY_A, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - - if (type == LIBINPUT_EVENT_KEYBOARD_KEY) { - struct libinput_event_keyboard *k; - struct libinput_event *base; - k = libinput_event_get_keyboard_event(event); - base = libinput_event_keyboard_get_base_event(k); - ck_assert(event == base); - - key++; - - litest_disable_log_handler(li); - ck_assert(libinput_event_get_device_notify_event(event) == NULL); - ck_assert(libinput_event_get_pointer_event(event) == NULL); - ck_assert(libinput_event_get_touch_event(event) == NULL); - ck_assert(libinput_event_get_gesture_event(event) == NULL); - ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); - ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); - ck_assert(libinput_event_get_switch_event(event) == NULL); - litest_restore_log_handler(li); - } - libinput_event_destroy(event); - } - - ck_assert_int_gt(key, 0); -} -END_TEST - -START_TEST(event_conversion_touch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int touch = 0; - - libinput_dispatch(li); - - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_event(dev, EV_ABS, ABS_X, 10); - litest_event(dev, EV_ABS, ABS_Y, 10); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 1); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 10); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 10); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - - if (type >= LIBINPUT_EVENT_TOUCH_DOWN && - type <= LIBINPUT_EVENT_TOUCH_FRAME) { - struct libinput_event_touch *t; - struct libinput_event *base; - t = libinput_event_get_touch_event(event); - base = libinput_event_touch_get_base_event(t); - ck_assert(event == base); - - touch++; - - litest_disable_log_handler(li); - ck_assert(libinput_event_get_device_notify_event(event) == NULL); - ck_assert(libinput_event_get_pointer_event(event) == NULL); - ck_assert(libinput_event_get_keyboard_event(event) == NULL); - ck_assert(libinput_event_get_gesture_event(event) == NULL); - ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); - ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); - ck_assert(libinput_event_get_switch_event(event) == NULL); - litest_restore_log_handler(li); - } - libinput_event_destroy(event); - } - - ck_assert_int_gt(touch, 0); -} -END_TEST - -START_TEST(event_conversion_gesture) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int gestures = 0; - int i; - - libinput_dispatch(li); - - litest_touch_down(dev, 0, 70, 30); - litest_touch_down(dev, 1, 30, 70); - for (i = 0; i < 8; i++) { - litest_push_event_frame(dev); - litest_touch_move(dev, 0, 70 - i * 5, 30 + i * 5); - litest_touch_move(dev, 1, 30 + i * 5, 70 - i * 5); - litest_pop_event_frame(dev); - libinput_dispatch(li); - } - - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - - if (type >= LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN && - type <= LIBINPUT_EVENT_GESTURE_PINCH_END) { - struct libinput_event_gesture *g; - struct libinput_event *base; - g = libinput_event_get_gesture_event(event); - base = libinput_event_gesture_get_base_event(g); - ck_assert(event == base); - - gestures++; - - litest_disable_log_handler(li); - ck_assert(libinput_event_get_device_notify_event(event) == NULL); - ck_assert(libinput_event_get_pointer_event(event) == NULL); - ck_assert(libinput_event_get_keyboard_event(event) == NULL); - ck_assert(libinput_event_get_touch_event(event) == NULL); - ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); - ck_assert(libinput_event_get_switch_event(event) == NULL); - litest_restore_log_handler(li); - } - libinput_event_destroy(event); - } - - ck_assert_int_gt(gestures, 0); -} -END_TEST - -START_TEST(event_conversion_tablet) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int events = 0; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { -1, -1 } - }; - - litest_tablet_proximity_in(dev, 50, 50, axes); - litest_tablet_motion(dev, 60, 50, axes); - litest_button_click(dev, BTN_STYLUS, true); - litest_button_click(dev, BTN_STYLUS, false); - - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - - if (type >= LIBINPUT_EVENT_TABLET_TOOL_AXIS && - type <= LIBINPUT_EVENT_TABLET_TOOL_BUTTON) { - struct libinput_event_tablet_tool *t; - struct libinput_event *base; - t = libinput_event_get_tablet_tool_event(event); - base = libinput_event_tablet_tool_get_base_event(t); - ck_assert(event == base); - - events++; - - litest_disable_log_handler(li); - ck_assert(libinput_event_get_device_notify_event(event) == NULL); - ck_assert(libinput_event_get_pointer_event(event) == NULL); - ck_assert(libinput_event_get_keyboard_event(event) == NULL); - ck_assert(libinput_event_get_touch_event(event) == NULL); - ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); - ck_assert(libinput_event_get_switch_event(event) == NULL); - litest_restore_log_handler(li); - } - libinput_event_destroy(event); - } - - ck_assert_int_gt(events, 0); -} -END_TEST - -START_TEST(event_conversion_tablet_pad) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int events = 0; - - litest_button_click(dev, BTN_0, true); - litest_pad_ring_start(dev, 10); - litest_pad_ring_end(dev); - - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - - if (type >= LIBINPUT_EVENT_TABLET_PAD_BUTTON && - type <= LIBINPUT_EVENT_TABLET_PAD_STRIP) { - struct libinput_event_tablet_pad *p; - struct libinput_event *base; - - p = libinput_event_get_tablet_pad_event(event); - base = libinput_event_tablet_pad_get_base_event(p); - ck_assert(event == base); - - events++; - - litest_disable_log_handler(li); - ck_assert(libinput_event_get_device_notify_event(event) == NULL); - ck_assert(libinput_event_get_pointer_event(event) == NULL); - ck_assert(libinput_event_get_keyboard_event(event) == NULL); - ck_assert(libinput_event_get_touch_event(event) == NULL); - ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); - ck_assert(libinput_event_get_switch_event(event) == NULL); - litest_restore_log_handler(li); - } - libinput_event_destroy(event); - } - - ck_assert_int_gt(events, 0); -} -END_TEST - -START_TEST(event_conversion_switch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int sw = 0; - - litest_switch_action(dev, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_ON); - litest_switch_action(dev, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_OFF); - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - - if (type == LIBINPUT_EVENT_SWITCH_TOGGLE) { - struct libinput_event_switch *s; - struct libinput_event *base; - s = libinput_event_get_switch_event(event); - base = libinput_event_switch_get_base_event(s); - ck_assert(event == base); - - sw++; - - litest_disable_log_handler(li); - ck_assert(libinput_event_get_device_notify_event(event) == NULL); - ck_assert(libinput_event_get_keyboard_event(event) == NULL); - ck_assert(libinput_event_get_pointer_event(event) == NULL); - ck_assert(libinput_event_get_touch_event(event) == NULL); - ck_assert(libinput_event_get_gesture_event(event) == NULL); - ck_assert(libinput_event_get_tablet_tool_event(event) == NULL); - ck_assert(libinput_event_get_tablet_pad_event(event) == NULL); - litest_restore_log_handler(li); - } - libinput_event_destroy(event); - } - - ck_assert_int_gt(sw, 0); -} -END_TEST - -START_TEST(bitfield_helpers) -{ - /* This value has a bit set on all of the word boundaries we want to - * test: 0, 1, 7, 8, 31, 32, and 33 - */ - unsigned char read_bitfield[] = { 0x83, 0x1, 0x0, 0x80, 0x3 }; - unsigned char write_bitfield[ARRAY_LENGTH(read_bitfield)] = {0}; - size_t i; - - /* Now check that the bitfield we wrote to came out to be the same as - * the bitfield we were writing from */ - for (i = 0; i < ARRAY_LENGTH(read_bitfield) * 8; i++) { - switch (i) { - case 0: - case 1: - case 7: - case 8: - case 31: - case 32: - case 33: - ck_assert(bit_is_set(read_bitfield, i)); - set_bit(write_bitfield, i); - break; - default: - ck_assert(!bit_is_set(read_bitfield, i)); - clear_bit(write_bitfield, i); - break; - } - } - - ck_assert_int_eq(memcmp(read_bitfield, - write_bitfield, - sizeof(read_bitfield)), - 0); -} -END_TEST - -START_TEST(context_ref_counting) -{ - struct libinput *li; - - /* These tests rely on valgrind to detect memory leak and use after - * free errors. */ - - li = libinput_path_create_context(&simple_interface, NULL); - ck_assert_notnull(li); - ck_assert_ptr_eq(libinput_unref(li), NULL); - - li = libinput_path_create_context(&simple_interface, NULL); - ck_assert_notnull(li); - ck_assert_ptr_eq(libinput_ref(li), li); - ck_assert_ptr_eq(libinput_unref(li), li); - ck_assert_ptr_eq(libinput_unref(li), NULL); -} -END_TEST - -START_TEST(config_status_string) -{ - const char *strs[3]; - const char *invalid; - size_t i, j; - - strs[0] = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_SUCCESS); - strs[1] = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - strs[2] = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_INVALID); - - for (i = 0; i < ARRAY_LENGTH(strs) - 1; i++) - for (j = i + 1; j < ARRAY_LENGTH(strs); j++) - ck_assert_str_ne(strs[i], strs[j]); - - invalid = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_INVALID + 1); - ck_assert(invalid == NULL); - invalid = libinput_config_status_to_str(LIBINPUT_CONFIG_STATUS_SUCCESS - 1); - ck_assert(invalid == NULL); -} -END_TEST - -START_TEST(matrix_helpers) -{ - struct matrix m1, m2, m3; - float f[6] = { 1, 2, 3, 4, 5, 6 }; - int x, y; - int row, col; - - matrix_init_identity(&m1); - - for (row = 0; row < 3; row++) { - for (col = 0; col < 3; col++) { - ck_assert_int_eq(m1.val[row][col], - (row == col) ? 1 : 0); - } - } - ck_assert(matrix_is_identity(&m1)); - - matrix_from_farray6(&m2, f); - ck_assert_int_eq(m2.val[0][0], 1); - ck_assert_int_eq(m2.val[0][1], 2); - ck_assert_int_eq(m2.val[0][2], 3); - ck_assert_int_eq(m2.val[1][0], 4); - ck_assert_int_eq(m2.val[1][1], 5); - ck_assert_int_eq(m2.val[1][2], 6); - ck_assert_int_eq(m2.val[2][0], 0); - ck_assert_int_eq(m2.val[2][1], 0); - ck_assert_int_eq(m2.val[2][2], 1); - - x = 100; - y = 5; - matrix_mult_vec(&m1, &x, &y); - ck_assert_int_eq(x, 100); - ck_assert_int_eq(y, 5); - - matrix_mult(&m3, &m1, &m1); - ck_assert(matrix_is_identity(&m3)); - - matrix_init_scale(&m2, 2, 4); - ck_assert_int_eq(m2.val[0][0], 2); - ck_assert_int_eq(m2.val[0][1], 0); - ck_assert_int_eq(m2.val[0][2], 0); - ck_assert_int_eq(m2.val[1][0], 0); - ck_assert_int_eq(m2.val[1][1], 4); - ck_assert_int_eq(m2.val[1][2], 0); - ck_assert_int_eq(m2.val[2][0], 0); - ck_assert_int_eq(m2.val[2][1], 0); - ck_assert_int_eq(m2.val[2][2], 1); - - matrix_mult_vec(&m2, &x, &y); - ck_assert_int_eq(x, 200); - ck_assert_int_eq(y, 20); - - matrix_init_translate(&m2, 10, 100); - ck_assert_int_eq(m2.val[0][0], 1); - ck_assert_int_eq(m2.val[0][1], 0); - ck_assert_int_eq(m2.val[0][2], 10); - ck_assert_int_eq(m2.val[1][0], 0); - ck_assert_int_eq(m2.val[1][1], 1); - ck_assert_int_eq(m2.val[1][2], 100); - ck_assert_int_eq(m2.val[2][0], 0); - ck_assert_int_eq(m2.val[2][1], 0); - ck_assert_int_eq(m2.val[2][2], 1); - - matrix_mult_vec(&m2, &x, &y); - ck_assert_int_eq(x, 210); - ck_assert_int_eq(y, 120); - - matrix_to_farray6(&m2, f); - ck_assert_int_eq(f[0], 1); - ck_assert_int_eq(f[1], 0); - ck_assert_int_eq(f[2], 10); - ck_assert_int_eq(f[3], 0); - ck_assert_int_eq(f[4], 1); - ck_assert_int_eq(f[5], 100); -} -END_TEST - -START_TEST(ratelimit_helpers) -{ - struct ratelimit rl; - unsigned int i, j; - - /* 10 attempts every 100ms */ - ratelimit_init(&rl, ms2us(100), 10); - - for (j = 0; j < 3; ++j) { - /* a burst of 9 attempts must succeed */ - for (i = 0; i < 9; ++i) { - ck_assert_int_eq(ratelimit_test(&rl), - RATELIMIT_PASS); - } - - /* the 10th attempt reaches the threshold */ - ck_assert_int_eq(ratelimit_test(&rl), RATELIMIT_THRESHOLD); - - /* ..then further attempts must fail.. */ - ck_assert_int_eq(ratelimit_test(&rl), RATELIMIT_EXCEEDED); - - /* ..regardless of how often we try. */ - for (i = 0; i < 100; ++i) { - ck_assert_int_eq(ratelimit_test(&rl), - RATELIMIT_EXCEEDED); - } - - /* ..even after waiting 20ms */ - msleep(20); - for (i = 0; i < 100; ++i) { - ck_assert_int_eq(ratelimit_test(&rl), - RATELIMIT_EXCEEDED); - } - - /* but after 100ms the counter is reset */ - msleep(90); /* +10ms to account for time drifts */ - } -} -END_TEST - -struct parser_test { - char *tag; - int expected_value; -}; - -START_TEST(dpi_parser) -{ - struct parser_test tests[] = { - { "450 *1800 3200", 1800 }, - { "*450 1800 3200", 450 }, - { "450 1800 *3200", 3200 }, - { "450 1800 3200", 3200 }, - { "450 1800 failboat", 0 }, - { "450 1800 *failboat", 0 }, - { "0 450 1800 *3200", 0 }, - { "450@37 1800@12 *3200@6", 3200 }, - { "450@125 1800@125 *3200@125 ", 3200 }, - { "450@125 *1800@125 3200@125", 1800 }, - { "*this @string fails", 0 }, - { "12@34 *45@", 0 }, - { "12@a *45@", 0 }, - { "12@a *45@25", 0 }, - { " * 12, 450, 800", 0 }, - { " *12, 450, 800", 12 }, - { "*12, *450, 800", 12 }, - { "*-23412, 450, 800", 0 }, - { "112@125, 450@125, 800@125, 900@-125", 0 }, - { "", 0 }, - { " ", 0 }, - { "* ", 0 }, - { NULL, 0 } - }; - int i, dpi; - - for (i = 0; tests[i].tag != NULL; i++) { - dpi = parse_mouse_dpi_property(tests[i].tag); - ck_assert_int_eq(dpi, tests[i].expected_value); - } - - dpi = parse_mouse_dpi_property(NULL); - ck_assert_int_eq(dpi, 0); -} -END_TEST - -START_TEST(wheel_click_parser) -{ - struct parser_test tests[] = { - { "1", 1 }, - { "10", 10 }, - { "-12", -12 }, - { "360", 360 }, - - { "0", 0 }, - { "-0", 0 }, - { "a", 0 }, - { "10a", 0 }, - { "10-", 0 }, - { "sadfasfd", 0 }, - { "361", 0 }, - { NULL, 0 } - }; - - int i, angle; - - for (i = 0; tests[i].tag != NULL; i++) { - angle = parse_mouse_wheel_click_angle_property(tests[i].tag); - ck_assert_int_eq(angle, tests[i].expected_value); - } -} -END_TEST - -START_TEST(wheel_click_count_parser) -{ - struct parser_test tests[] = { - { "1", 1 }, - { "10", 10 }, - { "-12", -12 }, - { "360", 360 }, - - { "0", 0 }, - { "-0", 0 }, - { "a", 0 }, - { "10a", 0 }, - { "10-", 0 }, - { "sadfasfd", 0 }, - { "361", 0 }, - { NULL, 0 } - }; - - int i, angle; - - for (i = 0; tests[i].tag != NULL; i++) { - angle = parse_mouse_wheel_click_count_property(tests[i].tag); - ck_assert_int_eq(angle, tests[i].expected_value); - } - - angle = parse_mouse_wheel_click_count_property(NULL); - ck_assert_int_eq(angle, 0); -} -END_TEST - -struct parser_test_float { - char *tag; - double expected_value; -}; - -START_TEST(trackpoint_accel_parser) -{ - struct parser_test_float tests[] = { - { "0.5", 0.5 }, - { "1.0", 1.0 }, - { "2.0", 2.0 }, - { "fail1.0", 0.0 }, - { "1.0fail", 0.0 }, - { "0,5", 0.0 }, - { NULL, 0.0 } - }; - int i; - double accel; - - for (i = 0; tests[i].tag != NULL; i++) { - accel = parse_trackpoint_accel_property(tests[i].tag); - ck_assert(accel == tests[i].expected_value); - } - - accel = parse_trackpoint_accel_property(NULL); - ck_assert_double_eq(accel, 0.0); -} -END_TEST - -struct parser_test_dimension { - char *tag; - bool success; - int x, y; -}; - -START_TEST(dimension_prop_parser) -{ - struct parser_test_dimension tests[] = { - { "10x10", true, 10, 10 }, - { "1x20", true, 1, 20 }, - { "1x8000", true, 1, 8000 }, - { "238492x428210", true, 238492, 428210 }, - { "0x0", true, 0, 0 }, - { "-10x10", false, 0, 0 }, - { "-1", false, 0, 0 }, - { "1x-99", false, 0, 0 }, - { "0", false, 0, 0 }, - { "100", false, 0, 0 }, - { "", false, 0, 0 }, - { "abd", false, 0, 0 }, - { "xabd", false, 0, 0 }, - { "0xaf", false, 0, 0 }, - { "0x0x", true, 0, 0 }, - { "x10", false, 0, 0 }, - { NULL, false, 0, 0 } - }; - int i; - size_t x, y; - bool success; - - for (i = 0; tests[i].tag != NULL; i++) { - x = y = 0xad; - success = parse_dimension_property(tests[i].tag, &x, &y); - ck_assert(success == tests[i].success); - if (success) { - ck_assert_int_eq(x, tests[i].x); - ck_assert_int_eq(y, tests[i].y); - } else { - ck_assert_int_eq(x, 0xad); - ck_assert_int_eq(y, 0xad); - } - } - - success = parse_dimension_property(NULL, &x, &y); - ck_assert(success == false); -} -END_TEST - -struct parser_test_reliability { - char *tag; - bool success; - enum switch_reliability reliability; -}; - -START_TEST(reliability_prop_parser) -{ - struct parser_test_reliability tests[] = { - { "reliable", true, RELIABILITY_RELIABLE }, - { "unreliable", false, 0 }, - { "", false, 0 }, - { "0", false, 0 }, - { "1", false, 0 }, - { NULL, false, 0, } - }; - enum switch_reliability r; - bool success; - int i; - - for (i = 0; tests[i].tag != NULL; i++) { - r = 0xaf; - success = parse_switch_reliability_property(tests[i].tag, &r); - ck_assert(success == tests[i].success); - if (success) - ck_assert_int_eq(r, tests[i].reliability); - else - ck_assert_int_eq(r, 0xaf); - } - - success = parse_switch_reliability_property(NULL, &r); - ck_assert(success == true); - ck_assert_int_eq(r, RELIABILITY_UNKNOWN); - - success = parse_switch_reliability_property("foo", NULL); - ck_assert(success == false); -} -END_TEST - -struct parser_test_calibration { - char *prop; - bool success; - float values[6]; -}; - -START_TEST(calibration_prop_parser) -{ -#define DEFAULT_VALUES { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 } - const float untouched[6] = DEFAULT_VALUES; - struct parser_test_calibration tests[] = { - { "", false, DEFAULT_VALUES }, - { "banana", false, DEFAULT_VALUES }, - { "1 2 3 a 5 6", false, DEFAULT_VALUES }, - { "2", false, DEFAULT_VALUES }, - { "2 3 4 5 6", false, DEFAULT_VALUES }, - { "1 2 3 4 5 6", true, DEFAULT_VALUES }, - { "6.00012 3.244 4.238 5.2421 6.0134 8.860", true, - { 6.00012, 3.244, 4.238, 5.2421, 6.0134, 8.860 }}, - { "0xff 2 3 4 5 6", true, - { 255, 2, 3, 4, 5, 6 }}, - { NULL, false, DEFAULT_VALUES } - }; - bool success; - float calibration[6]; - int rc; - int i; - - for (i = 0; tests[i].prop != NULL; i++) { - memcpy(calibration, untouched, sizeof(calibration)); - - success = parse_calibration_property(tests[i].prop, - calibration); - ck_assert_int_eq(success, tests[i].success); - if (success) - rc = memcmp(tests[i].values, - calibration, - sizeof(calibration)); - else - rc = memcmp(untouched, - calibration, - sizeof(calibration)); - ck_assert_int_eq(rc, 0); - } - - memcpy(calibration, untouched, sizeof(calibration)); - - success = parse_calibration_property(NULL, calibration); - ck_assert(success == false); - rc = memcmp(untouched, calibration, sizeof(calibration)); - ck_assert_int_eq(rc, 0); -} -END_TEST - -struct parser_test_range { - char *tag; - bool success; - int hi, lo; -}; - -START_TEST(range_prop_parser) -{ - struct parser_test_range tests[] = { - { "10:8", true, 10, 8 }, - { "100:-1", true, 100, -1 }, - { "-203813:-502023", true, -203813, -502023 }, - { "238492:28210", true, 238492, 28210 }, - { "none", true, 0, 0 }, - { "0:0", false, 0, 0 }, - { "", false, 0, 0 }, - { "abcd", false, 0, 0 }, - { "10:30:10", false, 0, 0 }, - { NULL, false, 0, 0 } - }; - int i; - int hi, lo; - bool success; - - for (i = 0; tests[i].tag != NULL; i++) { - hi = lo = 0xad; - success = parse_range_property(tests[i].tag, &hi, &lo); - ck_assert(success == tests[i].success); - if (success) { - ck_assert_int_eq(hi, tests[i].hi); - ck_assert_int_eq(lo, tests[i].lo); - } else { - ck_assert_int_eq(hi, 0xad); - ck_assert_int_eq(lo, 0xad); - } - } - - success = parse_range_property(NULL, NULL, NULL); - ck_assert(success == false); -} -END_TEST - -START_TEST(palm_pressure_parser) -{ - struct parser_test tests[] = { - { "1", 1 }, - { "10", 10 }, - { "255", 255 }, - - { "-12", 0 }, - { "360", 0 }, - { "0", 0 }, - { "-0", 0 }, - { "a", 0 }, - { "10a", 0 }, - { "10-", 0 }, - { "sadfasfd", 0 }, - { "361", 0 }, - { NULL, 0 } - }; - - int i, angle; - - for (i = 0; tests[i].tag != NULL; i++) { - angle = parse_palm_pressure_property(tests[i].tag); - ck_assert_int_eq(angle, tests[i].expected_value); - } -} -END_TEST - -START_TEST(time_conversion) -{ - ck_assert_int_eq(us(10), 10); - ck_assert_int_eq(ns2us(10000), 10); - ck_assert_int_eq(ms2us(10), 10000); - ck_assert_int_eq(s2us(1), 1000000); - ck_assert_int_eq(us2ms(10000), 10); -} -END_TEST - -struct atoi_test { - char *str; - bool success; - int val; -}; - -START_TEST(safe_atoi_test) -{ - struct atoi_test tests[] = { - { "10", true, 10 }, - { "20", true, 20 }, - { "-1", true, -1 }, - { "2147483647", true, 2147483647 }, - { "-2147483648", true, -2147483648 }, - { "4294967295", false, 0 }, - { "0x0", false, 0 }, - { "-10x10", false, 0 }, - { "1x-99", false, 0 }, - { "", false, 0 }, - { "abd", false, 0 }, - { "xabd", false, 0 }, - { "0xaf", false, 0 }, - { "0x0x", false, 0 }, - { "x10", false, 0 }, - { NULL, false, 0 } - }; - int v; - bool success; - - for (int i = 0; tests[i].str != NULL; i++) { - v = 0xad; - success = safe_atoi(tests[i].str, &v); - ck_assert(success == tests[i].success); - if (success) - ck_assert_int_eq(v, tests[i].val); - else - ck_assert_int_eq(v, 0xad); - } -} -END_TEST - -START_TEST(safe_atoi_base_16_test) -{ - struct atoi_test tests[] = { - { "10", true, 0x10 }, - { "20", true, 0x20 }, - { "-1", true, -1 }, - { "0x10", true, 0x10 }, - { "0xff", true, 0xff }, - { "abc", true, 0xabc }, - { "-10", true, -0x10 }, - { "0x0", true, 0 }, - { "0", true, 0 }, - { "0x-99", false, 0 }, - { "0xak", false, 0 }, - { "0x", false, 0 }, - { "x10", false, 0 }, - { NULL, false, 0 } - }; - - int v; - bool success; - - for (int i = 0; tests[i].str != NULL; i++) { - v = 0xad; - success = safe_atoi_base(tests[i].str, &v, 16); - ck_assert(success == tests[i].success); - if (success) - ck_assert_int_eq(v, tests[i].val); - else - ck_assert_int_eq(v, 0xad); - } -} -END_TEST - -START_TEST(safe_atoi_base_8_test) -{ - struct atoi_test tests[] = { - { "7", true, 07 }, - { "10", true, 010 }, - { "20", true, 020 }, - { "-1", true, -1 }, - { "010", true, 010 }, - { "0ff", false, 0 }, - { "abc", false, 0}, - { "0xabc", false, 0}, - { "-10", true, -010 }, - { "0", true, 0 }, - { "00", true, 0 }, - { "0x0", false, 0 }, - { "0x-99", false, 0 }, - { "0xak", false, 0 }, - { "0x", false, 0 }, - { "x10", false, 0 }, - { NULL, false, 0 } - }; - - int v; - bool success; - - for (int i = 0; tests[i].str != NULL; i++) { - v = 0xad; - success = safe_atoi_base(tests[i].str, &v, 8); - ck_assert(success == tests[i].success); - if (success) - ck_assert_int_eq(v, tests[i].val); - else - ck_assert_int_eq(v, 0xad); - } -} -END_TEST - -struct atod_test { - char *str; - bool success; - double val; -}; - -START_TEST(safe_atod_test) -{ - struct atod_test tests[] = { - { "10", true, 10 }, - { "20", true, 20 }, - { "-1", true, -1 }, - { "2147483647", true, 2147483647 }, - { "-2147483648", true, -2147483648 }, - { "4294967295", true, 4294967295 }, - { "0x0", true, 0 }, - { "0x10", true, 0x10 }, - { "0xaf", true, 0xaf }, - { "x80", false, 0 }, - { "0.0", true, 0.0 }, - { "0.1", true, 0.1 }, - { "1.2", true, 1.2 }, - { "-324.9", true, -324.9 }, - { "9324.9", true, 9324.9 }, - { "NAN", false, 0 }, - { "INFINITY", false, 0 }, - { "-10x10", false, 0 }, - { "1x-99", false, 0 }, - { "", false, 0 }, - { "abd", false, 0 }, - { "xabd", false, 0 }, - { "0x0x", false, 0 }, - { NULL, false, 0 } - }; - double v; - bool success; - - for (int i = 0; tests[i].str != NULL; i++) { - v = 0xad; - success = safe_atod(tests[i].str, &v); - ck_assert(success == tests[i].success); - if (success) - ck_assert_int_eq(v, tests[i].val); - else - ck_assert_int_eq(v, 0xad); - } -} -END_TEST - -struct strsplit_test { - const char *string; - const char *delim; - const char *results[10]; -}; - -START_TEST(strsplit_test) -{ - struct strsplit_test tests[] = { - { "one two three", " ", { "one", "two", "three", NULL } }, - { "one", " ", { "one", NULL } }, - { "one two ", " ", { "one", "two", NULL } }, - { "one two", " ", { "one", "two", NULL } }, - { " one two", " ", { "one", "two", NULL } }, - { "one", "\t \r", { "one", NULL } }, - { "one two three", " t", { "one", "wo", "hree", NULL } }, - { " one two three", "te", { " on", " ", "wo ", "hr", NULL } }, - { "one", "ne", { "o", NULL } }, - { "onene", "ne", { "o", NULL } }, - { NULL, NULL, { NULL }} - }; - struct strsplit_test *t = tests; - - while (t->string) { - char **strv; - int idx = 0; - strv = strv_from_string(t->string, t->delim); - while (t->results[idx]) { - ck_assert_str_eq(t->results[idx], strv[idx]); - idx++; - } - ck_assert_ptr_eq(strv[idx], NULL); - strv_free(strv); - t++; - } - - /* Special cases */ - ck_assert_ptr_eq(strv_from_string("", " "), NULL); - ck_assert_ptr_eq(strv_from_string(" ", " "), NULL); - ck_assert_ptr_eq(strv_from_string(" ", " "), NULL); - ck_assert_ptr_eq(strv_from_string("oneoneone", "one"), NULL); -} -END_TEST - -static int open_restricted_leak(const char *path, int flags, void *data) -{ - return *(int*)data; -} - -static void close_restricted_leak(int fd, void *data) -{ - /* noop */ -} - -const struct libinput_interface leak_interface = { - .open_restricted = open_restricted_leak, - .close_restricted = close_restricted_leak, -}; - -START_TEST(fd_no_event_leak) -{ - struct libevdev_uinput *uinput; - struct libinput *li; - struct libinput_device *device; - int fd = -1; - const char *path; - struct libinput_event *event; - - uinput = create_simple_test_device("litest test device", - EV_REL, REL_X, - EV_REL, REL_Y, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_MIDDLE, - EV_KEY, BTN_LEFT, - -1, -1); - path = libevdev_uinput_get_devnode(uinput); - - fd = open(path, O_RDWR | O_NONBLOCK | O_CLOEXEC); - ck_assert_int_gt(fd, -1); - - li = libinput_path_create_context(&leak_interface, &fd); - litest_restore_log_handler(li); /* use the default litest handler */ - - /* Add the device, trigger an event, then remove it again. - * Without it, we get a SYN_DROPPED immediately and no events. - */ - device = libinput_path_add_device(li, path); - libevdev_uinput_write_event(uinput, EV_REL, REL_X, 1); - libevdev_uinput_write_event(uinput, EV_SYN, SYN_REPORT, 0); - libinput_path_remove_device(device); - libinput_dispatch(li); - litest_drain_events(li); - - /* Device is removed, but fd is still open. Queue an event, add a - * new device with the same fd, the queued event must be discarded - * by libinput */ - libevdev_uinput_write_event(uinput, EV_REL, REL_Y, 1); - libevdev_uinput_write_event(uinput, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - libinput_path_add_device(li, path); - libinput_dispatch(li); - event = libinput_get_event(li); - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_DEVICE_ADDED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - - close(fd); - libinput_unref(li); - libevdev_uinput_destroy(uinput); -} -END_TEST - -START_TEST(library_version) -{ - const char *version = LIBINPUT_LT_VERSION; - int C, R, A; - int rc; - - rc = sscanf(version, "%d:%d:%d", &C, &R, &A); - ck_assert_int_eq(rc, 3); - - ck_assert_int_ge(C, 17); - ck_assert_int_ge(R, 0); - ck_assert_int_ge(A, 7); - - /* Binary compatibility broken? */ - ck_assert(R != 0 || A != 0); - - /* The first stable API in 0.12 had 10:0:0 */ - ck_assert_int_eq(C - A, 10); -} -END_TEST - -static void timer_offset_warning(struct libinput *libinput, - enum libinput_log_priority priority, - const char *format, - va_list args) -{ - int *warning_triggered = (int*)libinput_get_user_data(libinput); - - if (priority == LIBINPUT_LOG_PRIORITY_ERROR && - strstr(format, "offset negative")) - (*warning_triggered)++; -} - -START_TEST(timer_offset_bug_warning) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int warning_triggered = 0; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - - litest_timeout_tap(); - - libinput_set_user_data(li, &warning_triggered); - libinput_log_set_handler(li, timer_offset_warning); - libinput_dispatch(li); - - /* triggered for touch down and touch up */ - ck_assert_int_eq(warning_triggered, 2); - litest_restore_log_handler(li); -} -END_TEST - -START_TEST(timer_flush) -{ - struct libinput *li; - struct litest_device *keyboard, *touchpad; - - li = litest_create_context(); - - touchpad = litest_add_device(li, LITEST_SYNAPTICS_TOUCHPAD); - litest_enable_tap(touchpad->libinput_device); - libinput_dispatch(li); - keyboard = litest_add_device(li, LITEST_KEYBOARD); - libinput_dispatch(li); - litest_drain_events(li); - - /* make sure tapping works */ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_up(touchpad, 0); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); - - /* make sure dwt-tap is ignored */ - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - libinput_dispatch(li); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_up(touchpad, 0); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - /* Ingore 'timer offset negative' warnings */ - litest_disable_log_handler(li); - - /* now mess with the timing - - send a key event - - expire dwt - - send a tap - and then call libinput_dispatch(). libinput should notice that - the tap event came in after the timeout and thus acknowledge the - tap. - */ - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_timeout_dwt_long(); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_up(touchpad, 0); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - litest_restore_log_handler(li); - - litest_assert_key_event(li, KEY_A, LIBINPUT_KEY_STATE_PRESSED); - litest_assert_key_event(li, KEY_A, LIBINPUT_KEY_STATE_RELEASED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_delete_device(keyboard); - litest_delete_device(touchpad); - libinput_unref(li); -} -END_TEST - -void -litest_setup_tests_misc(void) -{ - litest_add_no_device("events:conversion", event_conversion_device_notify); - litest_add_for_device("events:conversion", event_conversion_pointer, LITEST_MOUSE); - litest_add_for_device("events:conversion", event_conversion_pointer, LITEST_MOUSE); - litest_add_for_device("events:conversion", event_conversion_pointer_abs, LITEST_XEN_VIRTUAL_POINTER); - litest_add_for_device("events:conversion", event_conversion_key, LITEST_KEYBOARD); - litest_add_for_device("events:conversion", event_conversion_touch, LITEST_WACOM_TOUCH); - litest_add_for_device("events:conversion", event_conversion_gesture, LITEST_BCM5974); - litest_add_for_device("events:conversion", event_conversion_tablet, LITEST_WACOM_CINTIQ); - litest_add_for_device("events:conversion", event_conversion_tablet_pad, LITEST_WACOM_INTUOS5_PAD); - litest_add_for_device("events:conversion", event_conversion_switch, LITEST_LID_SWITCH); - litest_add_no_device("misc:bitfield_helpers", bitfield_helpers); - - litest_add_no_device("context:refcount", context_ref_counting); - litest_add_no_device("config:status string", config_status_string); - - litest_add_for_device("timer:offset-warning", timer_offset_bug_warning, LITEST_SYNAPTICS_TOUCHPAD); - litest_add_no_device("timer:flush", timer_flush); - - litest_add_no_device("misc:matrix", matrix_helpers); - litest_add_no_device("misc:ratelimit", ratelimit_helpers); - litest_add_no_device("misc:parser", dpi_parser); - litest_add_no_device("misc:parser", wheel_click_parser); - litest_add_no_device("misc:parser", wheel_click_count_parser); - litest_add_no_device("misc:parser", trackpoint_accel_parser); - litest_add_no_device("misc:parser", dimension_prop_parser); - litest_add_no_device("misc:parser", reliability_prop_parser); - litest_add_no_device("misc:parser", calibration_prop_parser); - litest_add_no_device("misc:parser", range_prop_parser); - litest_add_no_device("misc:parser", palm_pressure_parser); - litest_add_no_device("misc:parser", safe_atoi_test); - litest_add_no_device("misc:parser", safe_atoi_base_16_test); - litest_add_no_device("misc:parser", safe_atoi_base_8_test); - litest_add_no_device("misc:parser", safe_atod_test); - litest_add_no_device("misc:parser", strsplit_test); - litest_add_no_device("misc:time", time_conversion); - - litest_add_no_device("misc:fd", fd_no_event_leak); - - litest_add_no_device("misc:library_version", library_version); -} diff -Nru libinput-1.10.3/test/test-pad.c libinput-0.21.0/test/test-pad.c --- libinput-1.10.3/test/test-pad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-pad.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,813 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the copyright holders not be used in - * advertising or publicity pertaining to distribution of the software - * without specific, written prior permission. The copyright holders make - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include -#include -#include -#include -#include -#include - -#include "libinput-util.h" -#include "litest.h" - -START_TEST(pad_cap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - - ck_assert(libinput_device_has_capability(device, - LIBINPUT_DEVICE_CAP_TABLET_PAD)); - -} -END_TEST - -START_TEST(pad_no_cap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - - ck_assert(!libinput_device_has_capability(device, - LIBINPUT_DEVICE_CAP_TABLET_PAD)); -} -END_TEST - -START_TEST(pad_time) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *ev; - struct libinput_event_tablet_pad *pev; - unsigned int code; - uint64_t time, time_usec, oldtime; - - litest_drain_events(li); - - for (code = BTN_0; code < KEY_MAX; code++) { - if (!libevdev_has_event_code(dev->evdev, EV_KEY, code)) - continue; - - litest_button_click(dev, code, 1); - litest_button_click(dev, code, 0); - libinput_dispatch(li); - - switch (code) { - case BTN_STYLUS: - litest_assert_empty_queue(li); - continue; - default: - break; - } - - break; - } - - ev = libinput_get_event(li); - pev = litest_is_pad_button_event(ev, - 0, - LIBINPUT_BUTTON_STATE_PRESSED); - time = libinput_event_tablet_pad_get_time(pev); - time_usec = libinput_event_tablet_pad_get_time_usec(pev); - - ck_assert(time != 0); - ck_assert(time == time_usec/1000); - - libinput_event_destroy(ev); - - litest_drain_events(li); - msleep(10); - - litest_button_click(dev, code, 1); - litest_button_click(dev, code, 0); - libinput_dispatch(li); - - ev = libinput_get_event(li); - pev = litest_is_pad_button_event(ev, - 0, - LIBINPUT_BUTTON_STATE_PRESSED); - - oldtime = time; - time = libinput_event_tablet_pad_get_time(pev); - time_usec = libinput_event_tablet_pad_get_time_usec(pev); - - ck_assert(time > oldtime); - ck_assert(time != 0); - ck_assert(time == time_usec/1000); - - libinput_event_destroy(ev); -} -END_TEST - -START_TEST(pad_num_buttons) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - unsigned int code; - unsigned int nbuttons = 0; - - for (code = BTN_0; code < KEY_MAX; code++) { - /* BTN_STYLUS is set for compatibility reasons but not - * actually hooked up */ - if (code == BTN_STYLUS) - continue; - - if (libevdev_has_event_code(dev->evdev, EV_KEY, code)) - nbuttons++; - } - - ck_assert_int_eq(libinput_device_tablet_pad_get_num_buttons(device), - nbuttons); -} -END_TEST - -START_TEST(pad_button) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - unsigned int code; - unsigned int expected_number = 0; - struct libinput_event *ev; - struct libinput_event_tablet_pad *pev; - - litest_drain_events(li); - - for (code = BTN_0; code < KEY_MAX; code++) { - if (!libevdev_has_event_code(dev->evdev, EV_KEY, code)) - continue; - - litest_button_click(dev, code, 1); - litest_button_click(dev, code, 0); - libinput_dispatch(li); - - switch (code) { - case BTN_STYLUS: - litest_assert_empty_queue(li); - continue; - default: - break; - } - - ev = libinput_get_event(li); - pev = litest_is_pad_button_event(ev, - expected_number, - LIBINPUT_BUTTON_STATE_PRESSED); - ev = libinput_event_tablet_pad_get_base_event(pev); - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - pev = litest_is_pad_button_event(ev, - expected_number, - LIBINPUT_BUTTON_STATE_RELEASED); - ev = libinput_event_tablet_pad_get_base_event(pev); - libinput_event_destroy(ev); - - expected_number++; - } - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(pad_button_mode_groups) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - unsigned int code; - unsigned int expected_number = 0; - struct libinput_event *ev; - struct libinput_event_tablet_pad *pev; - - litest_drain_events(li); - - for (code = BTN_0; code < KEY_MAX; code++) { - unsigned int mode, index; - struct libinput_tablet_pad_mode_group *group; - - if (!libevdev_has_event_code(dev->evdev, EV_KEY, code)) - continue; - - litest_button_click(dev, code, 1); - litest_button_click(dev, code, 0); - libinput_dispatch(li); - - switch (code) { - case BTN_STYLUS: - litest_assert_empty_queue(li); - continue; - default: - break; - } - - ev = libinput_get_event(li); - pev = litest_is_pad_button_event(ev, - expected_number, - LIBINPUT_BUTTON_STATE_PRESSED); - - /* litest virtual devices don't have modes */ - mode = libinput_event_tablet_pad_get_mode(pev); - ck_assert_int_eq(mode, 0); - group = libinput_event_tablet_pad_get_mode_group(pev); - index = libinput_tablet_pad_mode_group_get_index(group); - ck_assert_int_eq(index, 0); - - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - pev = litest_is_pad_button_event(ev, - expected_number, - LIBINPUT_BUTTON_STATE_RELEASED); - mode = libinput_event_tablet_pad_get_mode(pev); - ck_assert_int_eq(mode, 0); - group = libinput_event_tablet_pad_get_mode_group(pev); - index = libinput_tablet_pad_mode_group_get_index(group); - ck_assert_int_eq(index, 0); - libinput_event_destroy(ev); - - expected_number++; - } - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(pad_has_ring) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - int nrings; - - nrings = libinput_device_tablet_pad_get_num_rings(device); - ck_assert_int_ge(nrings, 1); -} -END_TEST - -START_TEST(pad_ring) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *ev; - struct libinput_event_tablet_pad *pev; - int val; - double degrees, expected; - int min, max; - int step_size; - int nevents = 0; - - litest_pad_ring_start(dev, 10); - - litest_drain_events(li); - - /* Wacom's 0 value is at 275 degrees */ - expected = 270; - - min = libevdev_get_abs_minimum(dev->evdev, ABS_WHEEL); - max = libevdev_get_abs_maximum(dev->evdev, ABS_WHEEL); - step_size = 360/(max - min + 1); - - /* This is a bit strange because we rely on kernel filtering here. - The litest_*() functions take a percentage, but mapping this to - the pads 72 or 36 range pad ranges is lossy and a bit - unpredictable. So instead we increase by a small percentage, - expecting *most* events to be filtered by the kernel because they - resolve to the same integer value as the previous event. Whenever - an event gets through, we expect that to be the next integer - value in the range and thus the next step on the circle. - */ - for (val = 0; val < 100.0; val += 1) { - litest_pad_ring_change(dev, val); - libinput_dispatch(li); - - ev = libinput_get_event(li); - if (!ev) - continue; - - nevents++; - pev = litest_is_pad_ring_event(ev, - 0, - LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER); - - degrees = libinput_event_tablet_pad_get_ring_position(pev); - ck_assert_double_ge(degrees, 0.0); - ck_assert_double_lt(degrees, 360.0); - - ck_assert_double_eq(degrees, expected); - - libinput_event_destroy(ev); - expected = fmod(degrees + step_size, 360); - } - - ck_assert_int_eq(nevents, 360/step_size - 1); - - litest_pad_ring_end(dev); -} -END_TEST - -START_TEST(pad_ring_finger_up) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *ev; - struct libinput_event_tablet_pad *pev; - double degrees; - - litest_pad_ring_start(dev, 10); - - litest_drain_events(li); - - litest_pad_ring_end(dev); - libinput_dispatch(li); - - ev = libinput_get_event(li); - pev = litest_is_pad_ring_event(ev, - 0, - LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER); - - degrees = libinput_event_tablet_pad_get_ring_position(pev); - ck_assert_double_eq(degrees, -1.0); - libinput_event_destroy(ev); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(pad_has_strip) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - int nstrips; - - nstrips = libinput_device_tablet_pad_get_num_strips(device); - ck_assert_int_ge(nstrips, 1); -} -END_TEST - -START_TEST(pad_strip) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *ev; - struct libinput_event_tablet_pad *pev; - int val; - double pos, expected; - - litest_pad_strip_start(dev, 10); - - litest_drain_events(li); - - expected = 0; - - /* 9.5 works with the generic axis scaling without jumping over a - * value. */ - for (val = 0; val < 100; val += 9.5) { - litest_pad_strip_change(dev, val); - libinput_dispatch(li); - - ev = libinput_get_event(li); - pev = litest_is_pad_strip_event(ev, - 0, - LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER); - - pos = libinput_event_tablet_pad_get_strip_position(pev); - ck_assert_double_ge(pos, 0.0); - ck_assert_double_lt(pos, 1.0); - - /* rounding errors, mostly caused by small physical range */ - ck_assert_double_ge(pos, expected - 0.02); - ck_assert_double_le(pos, expected + 0.02); - - libinput_event_destroy(ev); - - expected = pos + 0.08; - } - - litest_pad_strip_change(dev, 100); - libinput_dispatch(li); - - ev = libinput_get_event(li); - pev = litest_is_pad_strip_event(ev, - 0, - LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER); - pos = libinput_event_tablet_pad_get_strip_position(pev); - ck_assert_double_eq(pos, 1.0); - libinput_event_destroy(ev); - - litest_pad_strip_end(dev); -} -END_TEST - -START_TEST(pad_strip_finger_up) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *ev; - struct libinput_event_tablet_pad *pev; - double pos; - - litest_pad_strip_start(dev, 10); - litest_drain_events(li); - - litest_pad_strip_end(dev); - libinput_dispatch(li); - - ev = libinput_get_event(li); - pev = litest_is_pad_strip_event(ev, - 0, - LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER); - - pos = libinput_event_tablet_pad_get_strip_position(pev); - ck_assert_double_eq(pos, -1.0); - libinput_event_destroy(ev); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(pad_left_handed_default) -{ -#if HAVE_LIBWACOM - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - - ck_assert(libinput_device_config_left_handed_is_available(device)); - - ck_assert_int_eq(libinput_device_config_left_handed_get_default(device), - 0); - ck_assert_int_eq(libinput_device_config_left_handed_get(device), - 0); - - status = libinput_device_config_left_handed_set(dev->libinput_device, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - ck_assert_int_eq(libinput_device_config_left_handed_get(device), - 1); - ck_assert_int_eq(libinput_device_config_left_handed_get_default(device), - 0); - - status = libinput_device_config_left_handed_set(dev->libinput_device, 0); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - ck_assert_int_eq(libinput_device_config_left_handed_get(device), - 0); - ck_assert_int_eq(libinput_device_config_left_handed_get_default(device), - 0); - -#endif -} -END_TEST - -START_TEST(pad_no_left_handed) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - - ck_assert(!libinput_device_config_left_handed_is_available(device)); - - ck_assert_int_eq(libinput_device_config_left_handed_get_default(device), - 0); - ck_assert_int_eq(libinput_device_config_left_handed_get(device), - 0); - - status = libinput_device_config_left_handed_set(dev->libinput_device, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - - ck_assert_int_eq(libinput_device_config_left_handed_get(device), - 0); - ck_assert_int_eq(libinput_device_config_left_handed_get_default(device), - 0); - - status = libinput_device_config_left_handed_set(dev->libinput_device, 0); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - - ck_assert_int_eq(libinput_device_config_left_handed_get(device), - 0); - ck_assert_int_eq(libinput_device_config_left_handed_get_default(device), - 0); -} -END_TEST - -START_TEST(pad_left_handed_ring) -{ -#if HAVE_LIBWACOM - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *ev; - struct libinput_event_tablet_pad *pev; - int val; - double degrees, expected; - - libinput_device_config_left_handed_set(dev->libinput_device, 1); - - litest_pad_ring_start(dev, 10); - - litest_drain_events(li); - - /* Wacom's 0 value is at 275 degrees -> 90 in left-handed mode*/ - expected = 90; - - for (val = 0; val < 100; val += 10) { - litest_pad_ring_change(dev, val); - libinput_dispatch(li); - - ev = libinput_get_event(li); - pev = litest_is_pad_ring_event(ev, - 0, - LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER); - - degrees = libinput_event_tablet_pad_get_ring_position(pev); - ck_assert_double_ge(degrees, 0.0); - ck_assert_double_lt(degrees, 360.0); - - /* rounding errors, mostly caused by small physical range */ - ck_assert_double_ge(degrees, expected - 2); - ck_assert_double_le(degrees, expected + 2); - - libinput_event_destroy(ev); - - expected = fmod(degrees + 36, 360); - } - - litest_pad_ring_end(dev); -#endif -} -END_TEST - -START_TEST(pad_mode_groups) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput_tablet_pad_mode_group *group; - int ngroups; - int i; - - ngroups = libinput_device_tablet_pad_get_num_mode_groups(device); - ck_assert_int_eq(ngroups, 1); - - for (i = 0; i < ngroups; i++) { - group = libinput_device_tablet_pad_get_mode_group(device, i); - ck_assert_notnull(group); - ck_assert_int_eq(libinput_tablet_pad_mode_group_get_index(group), - i); - } - - group = libinput_device_tablet_pad_get_mode_group(device, ngroups); - ck_assert(group == NULL); - group = libinput_device_tablet_pad_get_mode_group(device, ngroups + 1); - ck_assert(group == NULL); -} -END_TEST - -START_TEST(pad_mode_groups_userdata) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput_tablet_pad_mode_group *group; - int rc; - void *userdata = &rc; - - group = libinput_device_tablet_pad_get_mode_group(device, 0); - ck_assert(libinput_tablet_pad_mode_group_get_user_data(group) == - NULL); - libinput_tablet_pad_mode_group_set_user_data(group, userdata); - ck_assert(libinput_tablet_pad_mode_group_get_user_data(group) == - &rc); - - libinput_tablet_pad_mode_group_set_user_data(group, NULL); - ck_assert(libinput_tablet_pad_mode_group_get_user_data(group) == - NULL); -} -END_TEST - -START_TEST(pad_mode_groups_ref) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput_tablet_pad_mode_group *group, *g; - - group = libinput_device_tablet_pad_get_mode_group(device, 0); - g = libinput_tablet_pad_mode_group_ref(group); - ck_assert_ptr_eq(g, group); - - /* We don't expect this to be freed. Any leaks should be caught by - * valgrind. */ - g = libinput_tablet_pad_mode_group_unref(group); - ck_assert_ptr_eq(g, group); -} -END_TEST - -START_TEST(pad_mode_group_mode) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput_tablet_pad_mode_group *group; - int ngroups; - unsigned int nmodes, mode; - - ngroups = libinput_device_tablet_pad_get_num_mode_groups(device); - ck_assert_int_ge(ngroups, 1); - - group = libinput_device_tablet_pad_get_mode_group(device, 0); - - nmodes = libinput_tablet_pad_mode_group_get_num_modes(group); - ck_assert_int_eq(nmodes, 1); - - mode = libinput_tablet_pad_mode_group_get_mode(group); - ck_assert_int_lt(mode, nmodes); -} -END_TEST - -START_TEST(pad_mode_group_has) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput_tablet_pad_mode_group *group; - int ngroups, nbuttons, nrings, nstrips; - int i, b, r, s; - - ngroups = libinput_device_tablet_pad_get_num_mode_groups(device); - ck_assert_int_ge(ngroups, 1); - - nbuttons = libinput_device_tablet_pad_get_num_buttons(device); - nrings = libinput_device_tablet_pad_get_num_rings(device); - nstrips = libinput_device_tablet_pad_get_num_strips(device); - - for (b = 0; b < nbuttons; b++) { - bool found = false; - for (i = 0; i < ngroups; i++) { - group = libinput_device_tablet_pad_get_mode_group(device, - i); - if (libinput_tablet_pad_mode_group_has_button(group, - b)) { - ck_assert(!found); - found = true; - } - } - ck_assert(found); - } - - for (s = 0; s < nstrips; s++) { - bool found = false; - for (i = 0; i < ngroups; i++) { - group = libinput_device_tablet_pad_get_mode_group(device, - i); - if (libinput_tablet_pad_mode_group_has_strip(group, - s)) { - ck_assert(!found); - found = true; - } - } - ck_assert(found); - } - - for (r = 0; r < nrings; r++) { - bool found = false; - for (i = 0; i < ngroups; i++) { - group = libinput_device_tablet_pad_get_mode_group(device, - i); - if (libinput_tablet_pad_mode_group_has_ring(group, - r)) { - ck_assert(!found); - found = true; - } - } - ck_assert(found); - } -} -END_TEST - -START_TEST(pad_mode_group_has_invalid) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput_tablet_pad_mode_group* group; - int ngroups, nbuttons, nrings, nstrips; - int i; - int rc; - - ngroups = libinput_device_tablet_pad_get_num_mode_groups(device); - ck_assert_int_ge(ngroups, 1); - - nbuttons = libinput_device_tablet_pad_get_num_buttons(device); - nrings = libinput_device_tablet_pad_get_num_rings(device); - nstrips = libinput_device_tablet_pad_get_num_strips(device); - - for (i = 0; i < ngroups; i++) { - group = libinput_device_tablet_pad_get_mode_group(device, i); - rc = libinput_tablet_pad_mode_group_has_button(group, - nbuttons); - ck_assert_int_eq(rc, 0); - rc = libinput_tablet_pad_mode_group_has_button(group, - nbuttons + 1); - ck_assert_int_eq(rc, 0); - rc = libinput_tablet_pad_mode_group_has_button(group, - 0x1000000); - ck_assert_int_eq(rc, 0); - } - - for (i = 0; i < ngroups; i++) { - group = libinput_device_tablet_pad_get_mode_group(device, i); - rc = libinput_tablet_pad_mode_group_has_strip(group, - nstrips); - ck_assert_int_eq(rc, 0); - rc = libinput_tablet_pad_mode_group_has_strip(group, - nstrips + 1); - ck_assert_int_eq(rc, 0); - rc = libinput_tablet_pad_mode_group_has_strip(group, - 0x1000000); - ck_assert_int_eq(rc, 0); - } - - for (i = 0; i < ngroups; i++) { - group = libinput_device_tablet_pad_get_mode_group(device, i); - rc = libinput_tablet_pad_mode_group_has_ring(group, - nrings); - ck_assert_int_eq(rc, 0); - rc = libinput_tablet_pad_mode_group_has_ring(group, - nrings + 1); - ck_assert_int_eq(rc, 0); - rc = libinput_tablet_pad_mode_group_has_ring(group, - 0x1000000); - ck_assert_int_eq(rc, 0); - } -} -END_TEST - -START_TEST(pad_mode_group_has_no_toggle) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput_tablet_pad_mode_group* group; - int ngroups, nbuttons; - int i, b; - - ngroups = libinput_device_tablet_pad_get_num_mode_groups(device); - ck_assert_int_ge(ngroups, 1); - - /* Button must not be toggle buttons */ - nbuttons = libinput_device_tablet_pad_get_num_buttons(device); - for (i = 0; i < ngroups; i++) { - group = libinput_device_tablet_pad_get_mode_group(device, i); - for (b = 0; b < nbuttons; b++) { - ck_assert(!libinput_tablet_pad_mode_group_button_is_toggle( - group, - b)); - } - } -} -END_TEST - -void -litest_setup_tests_pad(void) -{ - litest_add("pad:cap", pad_cap, LITEST_TABLET_PAD, LITEST_ANY); - litest_add("pad:cap", pad_no_cap, LITEST_ANY, LITEST_TABLET_PAD); - - litest_add("pad:time", pad_time, LITEST_TABLET_PAD, LITEST_ANY); - - litest_add("pad:button", pad_num_buttons, LITEST_TABLET_PAD, LITEST_ANY); - litest_add("pad:button", pad_button, LITEST_TABLET_PAD, LITEST_ANY); - litest_add("pad:button", pad_button_mode_groups, LITEST_TABLET_PAD, LITEST_ANY); - - litest_add("pad:ring", pad_has_ring, LITEST_RING, LITEST_ANY); - litest_add("pad:ring", pad_ring, LITEST_RING, LITEST_ANY); - litest_add("pad:ring", pad_ring_finger_up, LITEST_RING, LITEST_ANY); - - litest_add("pad:strip", pad_has_strip, LITEST_STRIP, LITEST_ANY); - litest_add("pad:strip", pad_strip, LITEST_STRIP, LITEST_ANY); - litest_add("pad:strip", pad_strip_finger_up, LITEST_STRIP, LITEST_ANY); - - litest_add_for_device("pad:left_handed", pad_left_handed_default, LITEST_WACOM_INTUOS5_PAD); - litest_add_for_device("pad:left_handed", pad_no_left_handed, LITEST_WACOM_INTUOS3_PAD); - litest_add_for_device("pad:left_handed", pad_left_handed_ring, LITEST_WACOM_INTUOS5_PAD); - /* None of the current strip tablets are left-handed */ - - litest_add("pad:modes", pad_mode_groups, LITEST_TABLET_PAD, LITEST_ANY); - litest_add("pad:modes", pad_mode_groups_userdata, LITEST_TABLET_PAD, LITEST_ANY); - litest_add("pad:modes", pad_mode_groups_ref, LITEST_TABLET_PAD, LITEST_ANY); - litest_add("pad:modes", pad_mode_group_mode, LITEST_TABLET_PAD, LITEST_ANY); - litest_add("pad:modes", pad_mode_group_has, LITEST_TABLET_PAD, LITEST_ANY); - litest_add("pad:modes", pad_mode_group_has_invalid, LITEST_TABLET_PAD, LITEST_ANY); - litest_add("pad:modes", pad_mode_group_has_no_toggle, LITEST_TABLET_PAD, LITEST_ANY); -} diff -Nru libinput-1.10.3/test/test-path.c libinput-0.21.0/test/test-path.c --- libinput-1.10.3/test/test-path.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-path.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1012 +0,0 @@ -/* - * Copyright © 2013 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "litest.h" -#include "libinput-util.h" - -struct counter { - int open_func_count; - int close_func_count; -}; - -static int -open_restricted_count(const char *path, int flags, void *data) -{ - struct counter *c = data; - int fd; - - c->open_func_count++; - - fd = open(path, flags); - return fd < 0 ? -errno : fd; -} - -static void -close_restricted_count(int fd, void *data) -{ - struct counter *c = data; - - c->close_func_count++; - close(fd); -} - -static const struct libinput_interface counting_interface = { - .open_restricted = open_restricted_count, - .close_restricted = close_restricted_count, -}; - -static int -open_restricted(const char *path, int flags, void *data) -{ - int fd = open(path, flags); - return fd < 0 ? -errno : fd; -} - -static void -close_restricted(int fd, void *data) -{ - close(fd); -} - -static const struct libinput_interface simple_interface = { - .open_restricted = open_restricted, - .close_restricted = close_restricted, -}; - -START_TEST(path_create_NULL) -{ - struct libinput *li; - struct counter counter; - - counter.open_func_count = 0; - counter.close_func_count = 0; - - li = libinput_path_create_context(NULL, NULL); - ck_assert(li == NULL); - li = libinput_path_create_context(&counting_interface, &counter); - ck_assert(li != NULL); - libinput_unref(li); - - ck_assert_int_eq(counter.open_func_count, 0); - ck_assert_int_eq(counter.close_func_count, 0); -} -END_TEST - -START_TEST(path_create_invalid) -{ - struct libinput *li; - struct libinput_device *device; - const char *path = "/tmp"; - struct counter counter; - - counter.open_func_count = 0; - counter.close_func_count = 0; - - li = libinput_path_create_context(&counting_interface, &counter); - ck_assert(li != NULL); - - litest_disable_log_handler(li); - - device = libinput_path_add_device(li, path); - ck_assert(device == NULL); - - ck_assert_int_eq(counter.open_func_count, 0); - ck_assert_int_eq(counter.close_func_count, 0); - - litest_restore_log_handler(li); - libinput_unref(li); - ck_assert_int_eq(counter.close_func_count, 0); -} -END_TEST - -START_TEST(path_create_invalid_kerneldev) -{ - struct libinput *li; - struct libinput_device *device; - const char *path = "/dev/uinput"; - struct counter counter; - - counter.open_func_count = 0; - counter.close_func_count = 0; - - li = libinput_path_create_context(&counting_interface, &counter); - ck_assert(li != NULL); - - litest_disable_log_handler(li); - - device = libinput_path_add_device(li, path); - ck_assert(device == NULL); - - ck_assert_int_eq(counter.open_func_count, 1); - ck_assert_int_eq(counter.close_func_count, 1); - - litest_restore_log_handler(li); - libinput_unref(li); - ck_assert_int_eq(counter.close_func_count, 1); -} -END_TEST - -START_TEST(path_create_invalid_file) -{ - struct libinput *li; - struct libinput_device *device; - char path[] = "/tmp/litest_path_XXXXXX"; - int fd; - struct counter counter; - - umask(002); - fd = mkstemp(path); - ck_assert_int_ge(fd, 0); - close(fd); - - counter.open_func_count = 0; - counter.close_func_count = 0; - - li = libinput_path_create_context(&counting_interface, &counter); - unlink(path); - - litest_disable_log_handler(li); - - ck_assert(li != NULL); - device = libinput_path_add_device(li, path); - ck_assert(device == NULL); - - ck_assert_int_eq(counter.open_func_count, 0); - ck_assert_int_eq(counter.close_func_count, 0); - - litest_restore_log_handler(li); - libinput_unref(li); - ck_assert_int_eq(counter.close_func_count, 0); -} -END_TEST - -START_TEST(path_create_destroy) -{ - struct libinput *li; - struct libinput_device *device; - struct libevdev_uinput *uinput; - struct counter counter; - - counter.open_func_count = 0; - counter.close_func_count = 0; - - uinput = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - - li = libinput_path_create_context(&counting_interface, &counter); - ck_assert(li != NULL); - - litest_disable_log_handler(li); - - ck_assert(libinput_get_user_data(li) == &counter); - - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - ck_assert(device != NULL); - - ck_assert_int_eq(counter.open_func_count, 1); - - libevdev_uinput_destroy(uinput); - libinput_unref(li); - ck_assert_int_eq(counter.close_func_count, 1); -} -END_TEST - -START_TEST(path_force_destroy) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li; - struct libinput_device *device; - - li = libinput_path_create_context(&simple_interface, NULL); - ck_assert_notnull(li); - libinput_ref(li); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(dev->uinput)); - ck_assert_notnull(device); - - while (libinput_unref(li) != NULL) - ; -} -END_TEST - -START_TEST(path_set_user_data) -{ - struct libinput *li; - int data1, data2; - - li = libinput_path_create_context(&simple_interface, &data1); - ck_assert(li != NULL); - ck_assert(libinput_get_user_data(li) == &data1); - libinput_set_user_data(li, &data2); - ck_assert(libinput_get_user_data(li) == &data2); - - libinput_unref(li); -} -END_TEST - -START_TEST(path_added_seat) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_device *device; - struct libinput_seat *seat; - const char *seat_name; - enum libinput_event_type type; - - libinput_dispatch(li); - - event = libinput_get_event(li); - ck_assert(event != NULL); - - type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); - - device = libinput_event_get_device(event); - seat = libinput_device_get_seat(device); - ck_assert(seat != NULL); - - seat_name = libinput_seat_get_logical_name(seat); - ck_assert_str_eq(seat_name, "default"); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(path_seat_change) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_device *device; - struct libinput_seat *seat1, *seat2; - const char *seat1_name; - const char *seat2_name = "new seat"; - int rc; - - libinput_dispatch(li); - - event = libinput_get_event(li); - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_DEVICE_ADDED); - - device = libinput_event_get_device(event); - libinput_device_ref(device); - - seat1 = libinput_device_get_seat(device); - libinput_seat_ref(seat1); - - seat1_name = libinput_seat_get_logical_name(seat1); - libinput_event_destroy(event); - - litest_drain_events(li); - - rc = libinput_device_set_seat_logical_name(device, - seat2_name); - ck_assert_int_eq(rc, 0); - - libinput_dispatch(li); - - event = libinput_get_event(li); - ck_assert(event != NULL); - - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_DEVICE_REMOVED); - - ck_assert(libinput_event_get_device(event) == device); - libinput_event_destroy(event); - - event = libinput_get_event(li); - ck_assert(event != NULL); - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_DEVICE_ADDED); - ck_assert(libinput_event_get_device(event) != device); - libinput_device_unref(device); - - device = libinput_event_get_device(event); - seat2 = libinput_device_get_seat(device); - - ck_assert_str_ne(libinput_seat_get_logical_name(seat2), - seat1_name); - ck_assert_str_eq(libinput_seat_get_logical_name(seat2), - seat2_name); - libinput_event_destroy(event); - - libinput_seat_unref(seat1); - - /* litest: swap the new device in, so cleanup works */ - libinput_device_unref(dev->libinput_device); - libinput_device_ref(device); - dev->libinput_device = device; -} -END_TEST - -START_TEST(path_added_device) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_device *device; - enum libinput_event_type type; - - libinput_dispatch(li); - - event = libinput_get_event(li); - ck_assert_notnull(event); - type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); - device = libinput_event_get_device(event); - ck_assert_notnull(device); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(path_add_device) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_device *device; - char *sysname1 = NULL, *sysname2 = NULL; - enum libinput_event_type type; - - libinput_dispatch(li); - - event = libinput_get_event(li); - ck_assert_notnull(event); - type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); - device = libinput_event_get_device(event); - ck_assert_notnull(device); - sysname1 = safe_strdup(libinput_device_get_sysname(device)); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(dev->uinput)); - ck_assert(device != NULL); - - libinput_dispatch(li); - - event = libinput_get_event(li); - ck_assert_notnull(event); - type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); - device = libinput_event_get_device(event); - ck_assert_notnull(device); - sysname2 = safe_strdup(libinput_device_get_sysname(device)); - libinput_event_destroy(event); - - ck_assert_str_eq(sysname1, sysname2); - - free(sysname1); - free(sysname2); -} -END_TEST - -START_TEST(path_add_invalid_path) -{ - struct libinput *li; - struct libinput_event *event; - struct libinput_device *device; - - li = litest_create_context(); - - litest_disable_log_handler(li); - device = libinput_path_add_device(li, "/tmp/"); - litest_restore_log_handler(li); - ck_assert(device == NULL); - - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) - ck_abort(); - - libinput_unref(li); -} -END_TEST - -START_TEST(path_device_sysname) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_event *ev; - struct libinput_device *device; - const char *sysname; - enum libinput_event_type type; - - libinput_dispatch(dev->libinput); - - ev = libinput_get_event(dev->libinput); - ck_assert_notnull(ev); - type = libinput_event_get_type(ev); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); - device = libinput_event_get_device(ev); - ck_assert_notnull(device); - sysname = libinput_device_get_sysname(device); - - ck_assert(sysname != NULL && strlen(sysname) > 1); - ck_assert(strchr(sysname, '/') == NULL); - ck_assert_int_eq(strncmp(sysname, "event", 5), 0); - - libinput_event_destroy(ev); -} -END_TEST - -START_TEST(path_remove_device) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_device *device; - int remove_event = 0; - - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(dev->uinput)); - ck_assert(device != NULL); - litest_drain_events(li); - - libinput_path_remove_device(device); - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - - if (type == LIBINPUT_EVENT_DEVICE_REMOVED) - remove_event++; - - libinput_event_destroy(event); - } - - ck_assert_int_eq(remove_event, 1); -} -END_TEST - -START_TEST(path_double_remove_device) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_device *device; - int remove_event = 0; - - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(dev->uinput)); - ck_assert(device != NULL); - litest_drain_events(li); - - libinput_path_remove_device(device); - libinput_path_remove_device(device); - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - - if (type == LIBINPUT_EVENT_DEVICE_REMOVED) - remove_event++; - - libinput_event_destroy(event); - } - - ck_assert_int_eq(remove_event, 1); -} -END_TEST - -START_TEST(path_suspend) -{ - struct libinput *li; - struct libinput_device *device; - struct libevdev_uinput *uinput; - int rc; - void *userdata = &rc; - - uinput = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - - li = libinput_path_create_context(&simple_interface, userdata); - ck_assert(li != NULL); - - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - ck_assert(device != NULL); - - libinput_suspend(li); - libinput_resume(li); - - libevdev_uinput_destroy(uinput); - libinput_unref(li); -} -END_TEST - -START_TEST(path_double_suspend) -{ - struct libinput *li; - struct libinput_device *device; - struct libevdev_uinput *uinput; - int rc; - void *userdata = &rc; - - uinput = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - - li = libinput_path_create_context(&simple_interface, userdata); - ck_assert(li != NULL); - - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - ck_assert(device != NULL); - - libinput_suspend(li); - libinput_suspend(li); - libinput_resume(li); - - libevdev_uinput_destroy(uinput); - libinput_unref(li); -} -END_TEST - -START_TEST(path_double_resume) -{ - struct libinput *li; - struct libinput_device *device; - struct libevdev_uinput *uinput; - int rc; - void *userdata = &rc; - - uinput = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - - li = libinput_path_create_context(&simple_interface, userdata); - ck_assert(li != NULL); - - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - ck_assert(device != NULL); - - libinput_suspend(li); - libinput_resume(li); - libinput_resume(li); - - libevdev_uinput_destroy(uinput); - libinput_unref(li); -} -END_TEST - -START_TEST(path_add_device_suspend_resume) -{ - struct libinput *li; - struct libinput_device *device; - struct libinput_event *event; - struct libevdev_uinput *uinput1, *uinput2; - int rc; - int nevents; - void *userdata = &rc; - - uinput1 = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - uinput2 = litest_create_uinput_device("test device 2", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - - li = libinput_path_create_context(&simple_interface, userdata); - ck_assert(li != NULL); - - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput1)); - ck_assert(device != NULL); - libinput_path_add_device(li, libevdev_uinput_get_devnode(uinput2)); - - libinput_dispatch(li); - - nevents = 0; - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); - libinput_event_destroy(event); - nevents++; - } - - ck_assert_int_eq(nevents, 2); - - libinput_suspend(li); - libinput_dispatch(li); - - nevents = 0; - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_REMOVED); - libinput_event_destroy(event); - nevents++; - } - - ck_assert_int_eq(nevents, 2); - - libinput_resume(li); - libinput_dispatch(li); - - nevents = 0; - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); - libinput_event_destroy(event); - nevents++; - } - - ck_assert_int_eq(nevents, 2); - - libevdev_uinput_destroy(uinput1); - libevdev_uinput_destroy(uinput2); - libinput_unref(li); -} -END_TEST - -START_TEST(path_add_device_suspend_resume_fail) -{ - struct libinput *li; - struct libinput_device *device; - struct libinput_event *event; - struct libevdev_uinput *uinput1, *uinput2; - int rc; - int nevents; - void *userdata = &rc; - - uinput1 = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - uinput2 = litest_create_uinput_device("test device 2", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - - li = libinput_path_create_context(&simple_interface, userdata); - ck_assert(li != NULL); - - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput1)); - ck_assert(device != NULL); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput2)); - ck_assert(device != NULL); - - libinput_dispatch(li); - - nevents = 0; - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); - libinput_event_destroy(event); - nevents++; - } - - ck_assert_int_eq(nevents, 2); - - libinput_suspend(li); - libinput_dispatch(li); - - nevents = 0; - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_REMOVED); - libinput_event_destroy(event); - nevents++; - } - - ck_assert_int_eq(nevents, 2); - - /* now drop one of the devices */ - libevdev_uinput_destroy(uinput1); - rc = libinput_resume(li); - ck_assert_int_eq(rc, -1); - - libinput_dispatch(li); - - nevents = 0; - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - /* We expect one device being added, second one fails, - * causing a removed event for the first one */ - if (type != LIBINPUT_EVENT_DEVICE_ADDED && - type != LIBINPUT_EVENT_DEVICE_REMOVED) - ck_abort(); - libinput_event_destroy(event); - nevents++; - } - - ck_assert_int_eq(nevents, 2); - - libevdev_uinput_destroy(uinput2); - libinput_unref(li); -} -END_TEST - -START_TEST(path_add_device_suspend_resume_remove_device) -{ - struct libinput *li; - struct libinput_device *device; - struct libinput_event *event; - struct libevdev_uinput *uinput1, *uinput2; - int rc; - int nevents; - void *userdata = &rc; - - uinput1 = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - uinput2 = litest_create_uinput_device("test device 2", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - - li = libinput_path_create_context(&simple_interface, userdata); - ck_assert(li != NULL); - - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput1)); - ck_assert(device != NULL); - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput2)); - - libinput_device_ref(device); - libinput_dispatch(li); - - nevents = 0; - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); - libinput_event_destroy(event); - nevents++; - } - - ck_assert_int_eq(nevents, 2); - - libinput_suspend(li); - libinput_dispatch(li); - - nevents = 0; - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_REMOVED); - libinput_event_destroy(event); - nevents++; - } - - ck_assert_int_eq(nevents, 2); - - /* now drop and remove one of the devices */ - libevdev_uinput_destroy(uinput2); - libinput_path_remove_device(device); - libinput_device_unref(device); - - rc = libinput_resume(li); - ck_assert_int_eq(rc, 0); - - libinput_dispatch(li); - - nevents = 0; - while ((event = libinput_get_event(li))) { - enum libinput_event_type type; - type = libinput_event_get_type(event); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); - libinput_event_destroy(event); - nevents++; - } - - ck_assert_int_eq(nevents, 1); - - libevdev_uinput_destroy(uinput1); - libinput_unref(li); -} -END_TEST - -START_TEST(path_seat_recycle) -{ - struct libinput *li; - struct libevdev_uinput *uinput; - int rc; - void *userdata = &rc; - struct libinput_event *ev; - struct libinput_device *device; - struct libinput_seat *saved_seat = NULL; - struct libinput_seat *seat; - int data = 0; - int found = 0; - void *user_data; - enum libinput_event_type type; - - uinput = litest_create_uinput_device("test device", NULL, - EV_KEY, BTN_LEFT, - EV_KEY, BTN_RIGHT, - EV_REL, REL_X, - EV_REL, REL_Y, - -1); - - li = libinput_path_create_context(&simple_interface, userdata); - ck_assert(li != NULL); - - device = libinput_path_add_device(li, - libevdev_uinput_get_devnode(uinput)); - ck_assert(device != NULL); - - libinput_dispatch(li); - - ev = libinput_get_event(li); - ck_assert_notnull(ev); - type = libinput_event_get_type(ev); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); - device = libinput_event_get_device(ev); - ck_assert(device != NULL); - saved_seat = libinput_device_get_seat(device); - libinput_seat_set_user_data(saved_seat, &data); - libinput_seat_ref(saved_seat); - libinput_event_destroy(ev); - ck_assert(saved_seat != NULL); - - litest_assert_empty_queue(li); - - libinput_suspend(li); - - litest_drain_events(li); - - libinput_resume(li); - - libinput_dispatch(li); - ev = libinput_get_event(li); - ck_assert_notnull(ev); - type = libinput_event_get_type(ev); - ck_assert_int_eq(type, LIBINPUT_EVENT_DEVICE_ADDED); - device = libinput_event_get_device(ev); - ck_assert(device != NULL); - - seat = libinput_device_get_seat(device); - user_data = libinput_seat_get_user_data(seat); - if (user_data == &data) { - found = 1; - ck_assert(seat == saved_seat); - } - - libinput_event_destroy(ev); - ck_assert(found == 1); - - libinput_unref(li); - - libevdev_uinput_destroy(uinput); -} -END_TEST - -START_TEST(path_udev_assign_seat) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int rc; - - litest_set_log_handler_bug(li); - rc = libinput_udev_assign_seat(li, "foo"); - ck_assert_int_eq(rc, -1); - litest_restore_log_handler(li); -} -END_TEST - -START_TEST(path_ignore_device) -{ - struct litest_device *dev; - struct libinput *li; - struct libinput_device *device; - const char *path; - - dev = litest_create(LITEST_IGNORED_MOUSE, NULL, NULL, NULL, NULL); - path = libevdev_uinput_get_devnode(dev->uinput); - ck_assert_notnull(path); - - li = litest_create_context(); - device = libinput_path_add_device(li, path); - ck_assert(device == NULL); - - libinput_unref(li); - litest_delete_device(dev); -} -END_TEST - -void -litest_setup_tests_path(void) -{ - litest_add_no_device("path:create", path_create_NULL); - litest_add_no_device("path:create", path_create_invalid); - litest_add_no_device("path:create", path_create_invalid_file); - litest_add_no_device("path:create", path_create_invalid_kerneldev); - litest_add_no_device("path:create", path_create_destroy); - litest_add("path:create", path_force_destroy, LITEST_ANY, LITEST_ANY); - litest_add_no_device("path:create", path_set_user_data); - litest_add_no_device("path:suspend", path_suspend); - litest_add_no_device("path:suspend", path_double_suspend); - litest_add_no_device("path:suspend", path_double_resume); - litest_add_no_device("path:suspend", path_add_device_suspend_resume); - litest_add_no_device("path:suspend", path_add_device_suspend_resume_fail); - litest_add_no_device("path:suspend", path_add_device_suspend_resume_remove_device); - litest_add_for_device("path:seat", path_added_seat, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_for_device("path:seat", path_seat_change, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add("path:device events", path_added_device, LITEST_ANY, LITEST_ANY); - litest_add("path:device events", path_device_sysname, LITEST_ANY, LITEST_ANY); - litest_add_for_device("path:device events", path_add_device, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_no_device("path:device events", path_add_invalid_path); - litest_add_for_device("path:device events", path_remove_device, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_for_device("path:device events", path_double_remove_device, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_no_device("path:seat", path_seat_recycle); - litest_add_for_device("path:udev", path_udev_assign_seat, LITEST_SYNAPTICS_CLICKPAD_X220); - - litest_add_no_device("path:ignore", path_ignore_device); -} diff -Nru libinput-1.10.3/test/test-pointer.c libinput-0.21.0/test/test-pointer.c --- libinput-1.10.3/test/test-pointer.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-pointer.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2612 +0,0 @@ -/* - * Copyright © 2013 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libinput-util.h" -#include "litest.h" - -static void -test_relative_event(struct litest_device *dev, int dx, int dy) -{ - struct libinput *li = dev->libinput; - struct libinput_event_pointer *ptrev; - struct libinput_event *event; - double ev_dx, ev_dy; - double expected_dir; - double expected_length; - double actual_dir; - double actual_length; - - litest_event(dev, EV_REL, REL_X, dx); - litest_event(dev, EV_REL, REL_Y, dy); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - event = libinput_get_event(li); - ptrev = litest_is_motion_event(event); - - expected_length = sqrt(4 * dx*dx + 4 * dy*dy); - expected_dir = atan2(dx, dy); - - ev_dx = libinput_event_pointer_get_dx(ptrev); - ev_dy = libinput_event_pointer_get_dy(ptrev); - actual_length = sqrt(ev_dx*ev_dx + ev_dy*ev_dy); - actual_dir = atan2(ev_dx, ev_dy); - - /* Check the length of the motion vector (tolerate 1.0 indifference). */ - litest_assert(fabs(expected_length) >= actual_length); - - /* Check the direction of the motion vector (tolerate 2π/4 radians - * indifference). */ - litest_assert(fabs(expected_dir - actual_dir) < M_PI_2); - - libinput_event_destroy(event); - - litest_drain_events(dev->libinput); -} - -static void -disable_button_scrolling(struct litest_device *device) -{ - struct libinput_device *dev = device->libinput_device; - enum libinput_config_status status, - expected; - - status = libinput_device_config_scroll_set_method(dev, - LIBINPUT_CONFIG_SCROLL_NO_SCROLL); - - expected = LIBINPUT_CONFIG_STATUS_SUCCESS; - litest_assert_int_eq(status, expected); -} - -START_TEST(pointer_motion_relative) -{ - struct litest_device *dev = litest_current_device(); - - /* send a single event, the first movement - is always decelerated by 0.3 */ - litest_event(dev, EV_REL, REL_X, 1); - litest_event(dev, EV_REL, REL_Y, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(dev->libinput); - - litest_drain_events(dev->libinput); - - test_relative_event(dev, 1, 0); - test_relative_event(dev, 1, 1); - test_relative_event(dev, 1, -1); - test_relative_event(dev, 0, 1); - - test_relative_event(dev, -1, 0); - test_relative_event(dev, -1, 1); - test_relative_event(dev, -1, -1); - test_relative_event(dev, 0, -1); -} -END_TEST - -START_TEST(pointer_motion_relative_zero) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i; - - /* NOTE: this test does virtually nothing. The kernel should not - * allow 0/0 events to be passed to userspace. If it ever happens, - * let's hope this test fails if we do the wrong thing. - */ - litest_drain_events(li); - - for (i = 0; i < 5; i++) { - litest_event(dev, EV_REL, REL_X, 0); - litest_event(dev, EV_REL, REL_Y, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - litest_assert_empty_queue(li); - - /* send a single event, the first movement - is always decelerated by 0.3 */ - litest_event(dev, EV_REL, REL_X, 1); - litest_event(dev, EV_REL, REL_Y, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - libinput_event_destroy(libinput_get_event(li)); - litest_assert_empty_queue(li); - - for (i = 0; i < 5; i++) { - litest_event(dev, EV_REL, REL_X, 0); - litest_event(dev, EV_REL, REL_Y, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(dev->libinput); - } - litest_assert_empty_queue(li); - -} -END_TEST - -START_TEST(pointer_motion_relative_min_decel) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_pointer *ptrev; - struct libinput_event *event; - double evx, evy; - int dx, dy; - int cardinal = _i; /* ranged test */ - double len; - - int deltas[8][2] = { - /* N, NE, E, ... */ - { 0, 1 }, - { 1, 1 }, - { 1, 0 }, - { 1, -1 }, - { 0, -1 }, - { -1, -1 }, - { -1, 0 }, - { -1, 1 }, - }; - - litest_drain_events(dev->libinput); - - dx = deltas[cardinal][0]; - dy = deltas[cardinal][1]; - - litest_event(dev, EV_REL, REL_X, dx); - litest_event(dev, EV_REL, REL_Y, dy); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - ptrev = litest_is_motion_event(event); - evx = libinput_event_pointer_get_dx(ptrev); - evy = libinput_event_pointer_get_dy(ptrev); - - ck_assert((evx == 0.0) == (dx == 0)); - ck_assert((evy == 0.0) == (dy == 0)); - - len = hypot(evx, evy); - ck_assert(fabs(len) >= 0.3); - - libinput_event_destroy(event); -} -END_TEST - -static void -test_absolute_event(struct litest_device *dev, double x, double y) -{ - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - double ex, ey; - enum libinput_event_type type = LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE; - - litest_touch_down(dev, 0, x, y); - libinput_dispatch(li); - - event = libinput_get_event(li); - litest_assert_notnull(event); - litest_assert_int_eq(libinput_event_get_type(event), type); - - ptrev = libinput_event_get_pointer_event(event); - litest_assert(ptrev != NULL); - - ex = libinput_event_pointer_get_absolute_x_transformed(ptrev, 100); - ey = libinput_event_pointer_get_absolute_y_transformed(ptrev, 100); - litest_assert_int_eq((int)(ex + 0.5), (int)x); - litest_assert_int_eq((int)(ey + 0.5), (int)y); - - libinput_event_destroy(event); -} - -START_TEST(pointer_motion_absolute) -{ - struct litest_device *dev = litest_current_device(); - - litest_drain_events(dev->libinput); - - test_absolute_event(dev, 0, 100); - test_absolute_event(dev, 100, 0); - test_absolute_event(dev, 50, 50); -} -END_TEST - -START_TEST(pointer_absolute_initial_state) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *libinput1, *libinput2; - struct libinput_event *ev1, *ev2; - struct libinput_event_pointer *p1, *p2; - int axis = _i; /* looped test */ - - libinput1 = dev->libinput; - litest_touch_down(dev, 0, 40, 60); - litest_touch_up(dev, 0); - - /* device is now on some x/y value */ - litest_drain_events(libinput1); - - libinput2 = litest_create_context(); - libinput_path_add_device(libinput2, - libevdev_uinput_get_devnode(dev->uinput)); - litest_drain_events(libinput2); - - if (axis == ABS_X) - litest_touch_down(dev, 0, 40, 70); - else - litest_touch_down(dev, 0, 70, 60); - litest_touch_up(dev, 0); - - litest_wait_for_event(libinput1); - litest_wait_for_event(libinput2); - - while (libinput_next_event_type(libinput1)) { - ev1 = libinput_get_event(libinput1); - ev2 = libinput_get_event(libinput2); - - ck_assert_int_eq(libinput_event_get_type(ev1), - LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE); - ck_assert_int_eq(libinput_event_get_type(ev1), - libinput_event_get_type(ev2)); - - p1 = libinput_event_get_pointer_event(ev1); - p2 = libinput_event_get_pointer_event(ev2); - - ck_assert_int_eq(libinput_event_pointer_get_absolute_x(p1), - libinput_event_pointer_get_absolute_x(p2)); - ck_assert_int_eq(libinput_event_pointer_get_absolute_y(p1), - libinput_event_pointer_get_absolute_y(p2)); - - libinput_event_destroy(ev1); - libinput_event_destroy(ev2); - } - - libinput_unref(libinput2); -} -END_TEST - -static void -test_unaccel_event(struct litest_device *dev, int dx, int dy) -{ - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - double ev_dx, ev_dy; - - litest_event(dev, EV_REL, REL_X, dx); - litest_event(dev, EV_REL, REL_Y, dy); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - event = libinput_get_event(li); - ptrev = litest_is_motion_event(event); - - ev_dx = libinput_event_pointer_get_dx_unaccelerated(ptrev); - ev_dy = libinput_event_pointer_get_dy_unaccelerated(ptrev); - - litest_assert_int_eq(dx, ev_dx); - litest_assert_int_eq(dy, ev_dy); - - libinput_event_destroy(event); - - litest_drain_events(dev->libinput); -} - -START_TEST(pointer_motion_unaccel) -{ - struct litest_device *dev = litest_current_device(); - - litest_drain_events(dev->libinput); - - test_unaccel_event(dev, 10, 0); - test_unaccel_event(dev, 10, 10); - test_unaccel_event(dev, 10, -10); - test_unaccel_event(dev, 0, 10); - - test_unaccel_event(dev, -10, 0); - test_unaccel_event(dev, -10, 10); - test_unaccel_event(dev, -10, -10); - test_unaccel_event(dev, 0, -10); -} -END_TEST - -static void -test_button_event(struct litest_device *dev, unsigned int button, int state) -{ - struct libinput *li = dev->libinput; - - litest_button_click_debounced(dev, li, button, state); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, button, - state ? LIBINPUT_BUTTON_STATE_PRESSED : - LIBINPUT_BUTTON_STATE_RELEASED); -} - -START_TEST(pointer_button) -{ - struct litest_device *dev = litest_current_device(); - - disable_button_scrolling(dev); - - litest_drain_events(dev->libinput); - - test_button_event(dev, BTN_LEFT, 1); - test_button_event(dev, BTN_LEFT, 0); - - /* press it twice for good measure */ - test_button_event(dev, BTN_LEFT, 1); - test_button_event(dev, BTN_LEFT, 0); - - if (libinput_device_pointer_has_button(dev->libinput_device, - BTN_RIGHT)) { - test_button_event(dev, BTN_RIGHT, 1); - test_button_event(dev, BTN_RIGHT, 0); - } - - /* Skip middle button test on trackpoints (used for scrolling) */ - if (libinput_device_pointer_has_button(dev->libinput_device, - BTN_MIDDLE)) { - test_button_event(dev, BTN_MIDDLE, 1); - test_button_event(dev, BTN_MIDDLE, 0); - } -} -END_TEST - -START_TEST(pointer_button_auto_release) -{ - struct libinput *libinput; - struct litest_device *dev; - struct libinput_event *event; - enum libinput_event_type type; - struct libinput_event_pointer *pevent; - struct { - int code; - int released; - } buttons[] = { - { .code = BTN_LEFT, }, - { .code = BTN_MIDDLE, }, - { .code = BTN_EXTRA, }, - { .code = BTN_SIDE, }, - { .code = BTN_BACK, }, - { .code = BTN_FORWARD, }, - { .code = BTN_4, }, - }; - int events[2 * (ARRAY_LENGTH(buttons) + 1)]; - unsigned i; - int button; - int valid_code; - - /* Enable all tested buttons on the device */ - for (i = 0; i < 2 * ARRAY_LENGTH(buttons);) { - button = buttons[i / 2].code; - events[i++] = EV_KEY; - events[i++] = button; - } - events[i++] = -1; - events[i++] = -1; - - libinput = litest_create_context(); - dev = litest_add_device_with_overrides(libinput, - LITEST_MOUSE, - "Generic mouse", - NULL, NULL, events); - - litest_drain_events(libinput); - - /* Send pressed events, without releasing */ - for (i = 0; i < ARRAY_LENGTH(buttons); ++i) { - test_button_event(dev, buttons[i].code, 1); - } - - litest_drain_events(libinput); - - /* "Disconnect" device */ - litest_delete_device(dev); - - /* Mark all released buttons until device is removed */ - while (1) { - event = libinput_get_event(libinput); - ck_assert_notnull(event); - type = libinput_event_get_type(event); - - if (type == LIBINPUT_EVENT_DEVICE_REMOVED) { - libinput_event_destroy(event); - break; - } - - ck_assert_int_eq(type, LIBINPUT_EVENT_POINTER_BUTTON); - pevent = libinput_event_get_pointer_event(event); - ck_assert_int_eq(libinput_event_pointer_get_button_state(pevent), - LIBINPUT_BUTTON_STATE_RELEASED); - button = libinput_event_pointer_get_button(pevent); - - valid_code = 0; - for (i = 0; i < ARRAY_LENGTH(buttons); ++i) { - if (buttons[i].code == button) { - ck_assert_int_eq(buttons[i].released, 0); - buttons[i].released = 1; - valid_code = 1; - } - } - ck_assert_int_eq(valid_code, 1); - libinput_event_destroy(event); - } - - /* Check that all pressed buttons has been released. */ - for (i = 0; i < ARRAY_LENGTH(buttons); ++i) { - ck_assert_int_eq(buttons[i].released, 1); - } - - libinput_unref(libinput); -} -END_TEST - -START_TEST(pointer_button_has_no_button) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - unsigned int code; - - ck_assert(!libinput_device_has_capability(device, - LIBINPUT_DEVICE_CAP_POINTER)); - - for (code = BTN_LEFT; code < KEY_OK; code++) - ck_assert_int_eq(-1, - libinput_device_pointer_has_button(device, code)); -} -END_TEST - -START_TEST(pointer_recover_from_lost_button_count) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libevdev *evdev = dev->evdev; - - disable_button_scrolling(dev); - - litest_drain_events(dev->libinput); - - litest_button_click_debounced(dev, li, BTN_LEFT, 1); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - /* Grab for the release to make libinput lose count */ - libevdev_grab(evdev, LIBEVDEV_GRAB); - litest_button_click_debounced(dev, li, BTN_LEFT, 0); - libevdev_grab(evdev, LIBEVDEV_UNGRAB); - - litest_assert_empty_queue(li); - - litest_button_click_debounced(dev, li, BTN_LEFT, 1); - litest_assert_empty_queue(li); - - litest_button_click_debounced(dev, li, BTN_LEFT, 0); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); -} -END_TEST - -static inline double -wheel_click_count(struct litest_device *dev, int which) -{ - struct udev_device *d; - const char *prop = NULL; - int count; - double angle = 0.0; - - d = libinput_device_get_udev_device(dev->libinput_device); - litest_assert_ptr_notnull(d); - - if (which == REL_HWHEEL) - prop = udev_device_get_property_value(d, "MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL"); - if (!prop) - prop = udev_device_get_property_value(d, "MOUSE_WHEEL_CLICK_COUNT"); - if (!prop) - goto out; - - count = parse_mouse_wheel_click_count_property(prop); - litest_assert_int_ne(count, 0); - angle = 360.0/count; - -out: - udev_device_unref(d); - return angle; -} - -static inline double -wheel_click_angle(struct litest_device *dev, int which) -{ - struct udev_device *d; - const char *prop = NULL; - const int default_angle = 15; - double angle; - - angle = wheel_click_count(dev, which); - if (angle != 0.0) - return angle; - - angle = default_angle; - d = libinput_device_get_udev_device(dev->libinput_device); - litest_assert_ptr_notnull(d); - - if (which == REL_HWHEEL) - prop = udev_device_get_property_value(d, "MOUSE_WHEEL_CLICK_ANGLE_HORIZONTAL"); - if (!prop) - prop = udev_device_get_property_value(d, "MOUSE_WHEEL_CLICK_ANGLE"); - if (!prop) - goto out; - - angle = parse_mouse_wheel_click_angle_property(prop); - if (angle == 0.0) - angle = default_angle; - -out: - udev_device_unref(d); - return angle; -} - -static enum libinput_pointer_axis_source -wheel_source(struct litest_device *dev, int which) -{ - struct udev_device *d; - bool is_tilt = false; - - d = libinput_device_get_udev_device(dev->libinput_device); - litest_assert_ptr_notnull(d); - - switch(which) { - case REL_WHEEL: - is_tilt = !!udev_device_get_property_value(d, "MOUSE_WHEEL_TILT_VERTICAL"); - break; - case REL_HWHEEL: - is_tilt = !!udev_device_get_property_value(d, "MOUSE_WHEEL_TILT_HORIZONTAL"); - break; - default: - litest_abort_msg("Invalid source axis %d\n", which); - break; - } - - udev_device_unref(d); - return is_tilt ? - LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT : - LIBINPUT_POINTER_AXIS_SOURCE_WHEEL; -} - -static void -test_wheel_event(struct litest_device *dev, int which, int amount) -{ - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - enum libinput_pointer_axis axis; - enum libinput_pointer_axis_source source; - - double scroll_step, expected, discrete; - - scroll_step = wheel_click_angle(dev, which); - source = wheel_source(dev, which); - expected = amount * scroll_step; - discrete = amount; - - if (libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device)) { - expected *= -1; - discrete *= -1; - } - - /* mouse scroll wheels are 'upside down' */ - if (which == REL_WHEEL) - amount *= -1; - litest_event(dev, EV_REL, which, amount); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - axis = (which == REL_WHEEL) ? - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL : - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL; - - event = libinput_get_event(li); - ptrev = litest_is_axis_event(event, axis, source); - - litest_assert_double_eq( - libinput_event_pointer_get_axis_value(ptrev, axis), - expected); - litest_assert_double_eq( - libinput_event_pointer_get_axis_value_discrete(ptrev, axis), - discrete); - libinput_event_destroy(event); -} - -START_TEST(pointer_scroll_wheel) -{ - struct litest_device *dev = litest_current_device(); - - litest_drain_events(dev->libinput); - - /* make sure we hit at least one of the below two conditions */ - ck_assert(libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL) || - libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL)); - - if (libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) { - test_wheel_event(dev, REL_WHEEL, -1); - test_wheel_event(dev, REL_WHEEL, 1); - - test_wheel_event(dev, REL_WHEEL, -5); - test_wheel_event(dev, REL_WHEEL, 6); - } - - if (libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL)) { - test_wheel_event(dev, REL_HWHEEL, -1); - test_wheel_event(dev, REL_HWHEEL, 1); - - test_wheel_event(dev, REL_HWHEEL, -5); - test_wheel_event(dev, REL_HWHEEL, 6); - } -} -END_TEST - -START_TEST(pointer_scroll_natural_defaults) -{ - struct litest_device *dev = litest_current_device(); - - ck_assert_int_ge(libinput_device_config_scroll_has_natural_scroll(dev->libinput_device), 1); - ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); - ck_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), 0); -} -END_TEST - -START_TEST(pointer_scroll_natural_defaults_noscroll) -{ - struct litest_device *dev = litest_current_device(); - - if (libinput_device_config_scroll_has_natural_scroll(dev->libinput_device)) - return; - - ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); - ck_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), 0); -} -END_TEST - -START_TEST(pointer_scroll_natural_enable_config) -{ - struct litest_device *dev = litest_current_device(); - enum libinput_config_status status; - - status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 1); - - status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 0); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); -} -END_TEST - -START_TEST(pointer_scroll_natural_wheel) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - - litest_drain_events(dev->libinput); - - libinput_device_config_scroll_set_natural_scroll_enabled(device, 1); - - /* make sure we hit at least one of the below two conditions */ - ck_assert(libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL) || - libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL)); - - if (libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) { - test_wheel_event(dev, REL_WHEEL, -1); - test_wheel_event(dev, REL_WHEEL, 1); - - test_wheel_event(dev, REL_WHEEL, -5); - test_wheel_event(dev, REL_WHEEL, 6); - } - - if (libevdev_has_event_code(dev->evdev, EV_REL, REL_HWHEEL)) { - test_wheel_event(dev, REL_HWHEEL, -1); - test_wheel_event(dev, REL_HWHEEL, 1); - - test_wheel_event(dev, REL_HWHEEL, -5); - test_wheel_event(dev, REL_HWHEEL, 6); - } -} -END_TEST - -START_TEST(pointer_scroll_has_axis_invalid) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *pev; - - litest_drain_events(dev->libinput); - - if (!libevdev_has_event_code(dev->evdev, EV_REL, REL_WHEEL)) - return; - - litest_event(dev, EV_REL, REL_WHEEL, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - event = libinput_get_event(li); - pev = litest_is_axis_event(event, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, - 0); - - ck_assert_int_eq(libinput_event_pointer_has_axis(pev, -1), 0); - ck_assert_int_eq(libinput_event_pointer_has_axis(pev, 2), 0); - ck_assert_int_eq(libinput_event_pointer_has_axis(pev, 3), 0); - ck_assert_int_eq(libinput_event_pointer_has_axis(pev, 0xffff), 0); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(pointer_seat_button_count) -{ - const int num_devices = 4; - struct litest_device *devices[num_devices]; - struct libinput *libinput; - struct libinput_event *ev; - struct libinput_event_pointer *tev; - int i; - int seat_button_count = 0; - int expected_seat_button_count = 0; - char device_name[255]; - - libinput = litest_create_context(); - for (i = 0; i < num_devices; ++i) { - sprintf(device_name, "litest Generic mouse (%d)", i); - devices[i] = litest_add_device_with_overrides(libinput, - LITEST_MOUSE, - device_name, - NULL, NULL, NULL); - } - - for (i = 0; i < num_devices; ++i) - litest_button_click_debounced(devices[i], - libinput, - BTN_LEFT, - true); - - libinput_dispatch(libinput); - while ((ev = libinput_get_event(libinput))) { - if (libinput_event_get_type(ev) != - LIBINPUT_EVENT_POINTER_BUTTON) { - libinput_event_destroy(ev); - libinput_dispatch(libinput); - continue; - } - - tev = libinput_event_get_pointer_event(ev); - ck_assert_notnull(tev); - ck_assert_int_eq(libinput_event_pointer_get_button(tev), - BTN_LEFT); - ck_assert_int_eq(libinput_event_pointer_get_button_state(tev), - LIBINPUT_BUTTON_STATE_PRESSED); - - ++expected_seat_button_count; - seat_button_count = - libinput_event_pointer_get_seat_button_count(tev); - ck_assert_int_eq(expected_seat_button_count, seat_button_count); - - libinput_event_destroy(ev); - libinput_dispatch(libinput); - } - - ck_assert_int_eq(seat_button_count, num_devices); - - for (i = 0; i < num_devices; ++i) - litest_button_click_debounced(devices[i], - libinput, - BTN_LEFT, - false); - - libinput_dispatch(libinput); - while ((ev = libinput_get_event(libinput))) { - if (libinput_event_get_type(ev) != - LIBINPUT_EVENT_POINTER_BUTTON) { - libinput_event_destroy(ev); - libinput_dispatch(libinput); - continue; - } - - tev = libinput_event_get_pointer_event(ev); - ck_assert_notnull(tev); - ck_assert_int_eq(libinput_event_pointer_get_button(tev), - BTN_LEFT); - ck_assert_int_eq(libinput_event_pointer_get_button_state(tev), - LIBINPUT_BUTTON_STATE_RELEASED); - - --expected_seat_button_count; - seat_button_count = - libinput_event_pointer_get_seat_button_count(tev); - ck_assert_int_eq(expected_seat_button_count, seat_button_count); - - libinput_event_destroy(ev); - libinput_dispatch(libinput); - } - - ck_assert_int_eq(seat_button_count, 0); - - for (i = 0; i < num_devices; ++i) - litest_delete_device(devices[i]); - libinput_unref(libinput); -} -END_TEST - -START_TEST(pointer_no_calibration) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - enum libinput_config_status status; - int rc; - float calibration[6] = {0}; - - rc = libinput_device_config_calibration_has_matrix(d); - ck_assert_int_eq(rc, 0); - rc = libinput_device_config_calibration_get_matrix(d, calibration); - ck_assert_int_eq(rc, 0); - rc = libinput_device_config_calibration_get_default_matrix(d, - calibration); - ck_assert_int_eq(rc, 0); - - status = libinput_device_config_calibration_set_matrix(d, - calibration); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); -} -END_TEST - -START_TEST(pointer_left_handed_defaults) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - int rc; - - if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE && - libevdev_get_id_product(dev->evdev) == PRODUCT_ID_APPLE_APPLETOUCH) - return; - - rc = libinput_device_config_left_handed_is_available(d); - ck_assert_int_ne(rc, 0); - - rc = libinput_device_config_left_handed_get(d); - ck_assert_int_eq(rc, 0); - - rc = libinput_device_config_left_handed_get_default(d); - ck_assert_int_eq(rc, 0); -} -END_TEST - -START_TEST(pointer_left_handed) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - status = libinput_device_config_left_handed_set(d, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - litest_button_click_debounced(dev, li, BTN_LEFT, 1); - litest_button_click_debounced(dev, li, BTN_LEFT, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_button_click_debounced(dev, li, BTN_RIGHT, 1); - litest_button_click_debounced(dev, li, BTN_RIGHT, 0); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - if (libinput_device_pointer_has_button(d, BTN_MIDDLE)) { - litest_button_click_debounced(dev, li, BTN_MIDDLE, 1); - litest_button_click_debounced(dev, li, BTN_MIDDLE, 0); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - } -} -END_TEST - -START_TEST(pointer_left_handed_during_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - litest_drain_events(li); - litest_button_click_debounced(dev, li, BTN_LEFT, 1); - libinput_dispatch(li); - - /* Change while button is down, expect correct release event */ - status = libinput_device_config_left_handed_set(d, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_button_click_debounced(dev, li, BTN_LEFT, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(pointer_left_handed_during_click_multiple_buttons) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - if (!libinput_device_pointer_has_button(d, BTN_MIDDLE)) - return; - - litest_disable_middleemu(dev); - - litest_drain_events(li); - litest_button_click_debounced(dev, li, BTN_LEFT, 1); - libinput_dispatch(li); - - status = libinput_device_config_left_handed_set(d, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - /* No left-handed until all buttons were down */ - litest_button_click_debounced(dev, li, BTN_RIGHT, 1); - litest_button_click_debounced(dev, li, BTN_RIGHT, 0); - litest_button_click_debounced(dev, li, BTN_LEFT, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(pointer_scroll_button) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - /* Make left button switch to scrolling mode */ - libinput_device_config_scroll_set_method(dev->libinput_device, - LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); - libinput_device_config_scroll_set_button(dev->libinput_device, - BTN_LEFT); - - litest_drain_events(li); - - litest_button_scroll(dev, BTN_LEFT, 1, 6); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 6); - litest_button_scroll(dev, BTN_LEFT, 1, -7); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -7); - litest_button_scroll(dev, BTN_LEFT, 8, 1); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 8); - litest_button_scroll(dev, BTN_LEFT, -9, 1); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -9); - - /* scroll smaller than the threshold should not generate axis events */ - litest_button_scroll(dev, BTN_LEFT, 1, 1); - - litest_button_scroll(dev, BTN_LEFT, 0, 0); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); - - /* Restore default scroll behavior */ - libinput_device_config_scroll_set_method(dev->libinput_device, - libinput_device_config_scroll_get_default_method( - dev->libinput_device)); - libinput_device_config_scroll_set_button(dev->libinput_device, - libinput_device_config_scroll_get_default_button( - dev->libinput_device)); -} -END_TEST - -START_TEST(pointer_scroll_button_noscroll) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - uint32_t methods, button; - enum libinput_config_status status; - - methods = libinput_device_config_scroll_get_method(device); - ck_assert_int_eq((methods & LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN), 0); - button = libinput_device_config_scroll_get_button(device); - ck_assert_int_eq(button, 0); - button = libinput_device_config_scroll_get_default_button(device); - ck_assert_int_eq(button, 0); - - status = libinput_device_config_scroll_set_method(device, - LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - status = libinput_device_config_scroll_set_button(device, BTN_LEFT); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); -} -END_TEST - -START_TEST(pointer_scroll_button_no_event_before_timeout) -{ - struct litest_device *device = litest_current_device(); - struct libinput *li = device->libinput; - int i; - - if (!libinput_device_pointer_has_button(device->libinput_device, - BTN_MIDDLE)) - return; - - litest_disable_middleemu(device); - disable_button_scrolling(device); - - libinput_device_config_scroll_set_method(device->libinput_device, - LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); - libinput_device_config_scroll_set_button(device->libinput_device, - BTN_LEFT); - litest_drain_events(li); - - litest_button_click_debounced(device, li, BTN_LEFT, true); - litest_assert_empty_queue(li); - - for (i = 0; i < 10; i++) { - litest_event(device, EV_REL, REL_Y, 1); - litest_event(device, EV_SYN, SYN_REPORT, 0); - } - litest_assert_empty_queue(li); - - litest_timeout_buttonscroll(); - libinput_dispatch(li); - litest_button_click_debounced(device, li, BTN_LEFT, false); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(pointer_scroll_button_middle_emulation) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - int i; - - status = libinput_device_config_middle_emulation_set_enabled(device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - status = libinput_device_config_scroll_set_method(device, - LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - status = libinput_device_config_scroll_set_button(device, BTN_MIDDLE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - - litest_button_click_debounced(dev, li, BTN_LEFT, 1); - litest_button_click_debounced(dev, li, BTN_RIGHT, 1); - libinput_dispatch(li); - litest_timeout_buttonscroll(); - libinput_dispatch(li); - - for (i = 0; i < 10; i++) { - litest_event(dev, EV_REL, REL_Y, -1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - } - - libinput_dispatch(li); - - litest_button_click_debounced(dev, li, BTN_LEFT, 0); - litest_button_click_debounced(dev, li, BTN_RIGHT, 0); - libinput_dispatch(li); - - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -1); - litest_assert_empty_queue(li); - - /* Restore default scroll behavior */ - libinput_device_config_scroll_set_method(dev->libinput_device, - libinput_device_config_scroll_get_default_method( - dev->libinput_device)); - libinput_device_config_scroll_set_button(dev->libinput_device, - libinput_device_config_scroll_get_default_button( - dev->libinput_device)); -} -END_TEST - -START_TEST(pointer_scroll_nowheel_defaults) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_scroll_method method, expected; - uint32_t button; - - /* button scrolling is only enabled if there is a - middle button present */ - if (libinput_device_pointer_has_button(device, BTN_MIDDLE)) - expected = LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN; - else - expected = LIBINPUT_CONFIG_SCROLL_NO_SCROLL; - - method = libinput_device_config_scroll_get_method(device); - ck_assert_int_eq(method, expected); - - method = libinput_device_config_scroll_get_default_method(device); - ck_assert_int_eq(method, expected); - - if (method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) { - button = libinput_device_config_scroll_get_button(device); - ck_assert_int_eq(button, BTN_MIDDLE); - button = libinput_device_config_scroll_get_default_button(device); - ck_assert_int_eq(button, BTN_MIDDLE); - } -} -END_TEST - -START_TEST(pointer_scroll_defaults_logitech_marble) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_scroll_method method; - uint32_t button; - - method = libinput_device_config_scroll_get_method(device); - ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL); - method = libinput_device_config_scroll_get_default_method(device); - ck_assert_int_eq(method, LIBINPUT_CONFIG_SCROLL_NO_SCROLL); - - button = libinput_device_config_scroll_get_button(device); - ck_assert_int_eq(button, BTN_SIDE); -} -END_TEST - -START_TEST(pointer_accel_defaults) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - double speed; - - ck_assert(libinput_device_config_accel_is_available(device)); - ck_assert_double_eq(libinput_device_config_accel_get_default_speed(device), - 0.0); - ck_assert_double_eq(libinput_device_config_accel_get_speed(device), - 0.0); - - for (speed = -2.0; speed < -1.0; speed += 0.2) { - status = libinput_device_config_accel_set_speed(device, - speed); - ck_assert_int_eq(status, - LIBINPUT_CONFIG_STATUS_INVALID); - ck_assert_double_eq(libinput_device_config_accel_get_speed(device), - 0.0); - } - - for (speed = -1.0; speed <= 1.0; speed += 0.2) { - status = libinput_device_config_accel_set_speed(device, - speed); - ck_assert_int_eq(status, - LIBINPUT_CONFIG_STATUS_SUCCESS); - ck_assert_double_eq(libinput_device_config_accel_get_speed(device), - speed); - } - - for (speed = 1.2; speed <= 2.0; speed += 0.2) { - status = libinput_device_config_accel_set_speed(device, - speed); - ck_assert_int_eq(status, - LIBINPUT_CONFIG_STATUS_INVALID); - ck_assert_double_eq(libinput_device_config_accel_get_speed(device), - 1.0); - } - -} -END_TEST - -START_TEST(pointer_accel_invalid) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - - ck_assert(libinput_device_config_accel_is_available(device)); - - status = libinput_device_config_accel_set_speed(device, - NAN); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); - status = libinput_device_config_accel_set_speed(device, - INFINITY); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -START_TEST(pointer_accel_defaults_absolute) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - double speed; - - ck_assert(!libinput_device_config_accel_is_available(device)); - ck_assert_double_eq(libinput_device_config_accel_get_default_speed(device), - 0.0); - ck_assert_double_eq(libinput_device_config_accel_get_speed(device), - 0.0); - - for (speed = -2.0; speed <= 2.0; speed += 0.2) { - status = libinput_device_config_accel_set_speed(device, - speed); - if (speed >= -1.0 && speed <= 1.0) - ck_assert_int_eq(status, - LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - else - ck_assert_int_eq(status, - LIBINPUT_CONFIG_STATUS_INVALID); - ck_assert_double_eq(libinput_device_config_accel_get_speed(device), - 0.0); - } -} -END_TEST - -START_TEST(pointer_accel_defaults_absolute_relative) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - - ck_assert(libinput_device_config_accel_is_available(device)); - ck_assert_double_eq(libinput_device_config_accel_get_default_speed(device), - 0.0); - ck_assert_double_eq(libinput_device_config_accel_get_speed(device), - 0.0); -} -END_TEST - -START_TEST(pointer_accel_direction_change) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *pev; - int i; - double delta; - - litest_drain_events(li); - - for (i = 0; i < 10; i++) { - litest_event(dev, EV_REL, REL_X, -1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - } - litest_event(dev, EV_REL, REL_X, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - do { - pev = libinput_event_get_pointer_event(event); - - delta = libinput_event_pointer_get_dx(pev); - ck_assert_double_le(delta, 0.0); - libinput_event_destroy(event); - event = libinput_get_event(li); - } while (libinput_next_event_type(li) != LIBINPUT_EVENT_NONE); - - pev = libinput_event_get_pointer_event(event); - delta = libinput_event_pointer_get_dx(pev); - ck_assert_double_gt(delta, 0.0); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(pointer_accel_profile_defaults) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - enum libinput_config_accel_profile profile; - uint32_t profiles; - - ck_assert(libinput_device_config_accel_is_available(device)); - - profile = libinput_device_config_accel_get_default_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); - - profile = libinput_device_config_accel_get_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); - - profiles = libinput_device_config_accel_get_profiles(device); - ck_assert(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); - ck_assert(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); - - status = libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - profile = libinput_device_config_accel_get_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); - - profile = libinput_device_config_accel_get_default_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); - - status = libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - profile = libinput_device_config_accel_get_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); -} -END_TEST - -START_TEST(pointer_accel_profile_defaults_noprofile) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - enum libinput_config_accel_profile profile; - uint32_t profiles; - - ck_assert(libinput_device_config_accel_is_available(device)); - - profile = libinput_device_config_accel_get_default_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); - - profile = libinput_device_config_accel_get_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); - - profiles = libinput_device_config_accel_get_profiles(device); - ck_assert_int_eq(profiles, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); - - status = libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - profile = libinput_device_config_accel_get_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); - - status = libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - profile = libinput_device_config_accel_get_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); -} -END_TEST - -START_TEST(pointer_accel_profile_invalid) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - - ck_assert(libinput_device_config_accel_is_available(device)); - - status = libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); - - status = libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE + 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); - - status = libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE |LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -START_TEST(pointer_accel_profile_noaccel) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - enum libinput_config_accel_profile profile; - - ck_assert(!libinput_device_config_accel_is_available(device)); - - profile = libinput_device_config_accel_get_default_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); - - profile = libinput_device_config_accel_get_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); - - status = libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); - - status = libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE + 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); - - status = libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE |LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -START_TEST(pointer_accel_profile_flat_motion_relative) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - - libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); - litest_drain_events(dev->libinput); - - test_relative_event(dev, 1, 0); - test_relative_event(dev, 1, 1); - test_relative_event(dev, 1, -1); - test_relative_event(dev, 0, 1); - - test_relative_event(dev, -1, 0); - test_relative_event(dev, -1, 1); - test_relative_event(dev, -1, -1); - test_relative_event(dev, 0, -1); -} -END_TEST - -START_TEST(middlebutton) -{ - struct litest_device *device = litest_current_device(); - struct libinput *li = device->libinput; - enum libinput_config_status status; - unsigned int i; - const int btn[][4] = { - { BTN_LEFT, BTN_RIGHT, BTN_LEFT, BTN_RIGHT }, - { BTN_LEFT, BTN_RIGHT, BTN_RIGHT, BTN_LEFT }, - { BTN_RIGHT, BTN_LEFT, BTN_LEFT, BTN_RIGHT }, - { BTN_RIGHT, BTN_LEFT, BTN_RIGHT, BTN_LEFT }, - }; - - disable_button_scrolling(device); - - status = libinput_device_config_middle_emulation_set_enabled( - device->libinput_device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - litest_drain_events(li); - - for (i = 0; i < ARRAY_LENGTH(btn); i++) { - litest_button_click_debounced(device, li, btn[i][0], true); - litest_button_click_debounced(device, li, btn[i][1], true); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_button_click_debounced(device, li, btn[i][2], false); - litest_button_click_debounced(device, li, btn[i][3], false); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); - } -} -END_TEST - -START_TEST(middlebutton_nostart_while_down) -{ - struct litest_device *device = litest_current_device(); - struct libinput *li = device->libinput; - enum libinput_config_status status; - unsigned int i; - const int btn[][4] = { - { BTN_LEFT, BTN_RIGHT, BTN_LEFT, BTN_RIGHT }, - { BTN_LEFT, BTN_RIGHT, BTN_RIGHT, BTN_LEFT }, - { BTN_RIGHT, BTN_LEFT, BTN_LEFT, BTN_RIGHT }, - { BTN_RIGHT, BTN_LEFT, BTN_RIGHT, BTN_LEFT }, - }; - - if (!libinput_device_pointer_has_button(device->libinput_device, - BTN_MIDDLE)) - return; - - disable_button_scrolling(device); - - status = libinput_device_config_middle_emulation_set_enabled( - device->libinput_device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - litest_button_click_debounced(device, li, BTN_MIDDLE, true); - litest_drain_events(li); - - for (i = 0; i < ARRAY_LENGTH(btn); i++) { - litest_button_click_debounced(device, li, btn[i][0], true); - litest_assert_button_event(li, - btn[i][0], - LIBINPUT_BUTTON_STATE_PRESSED); - litest_button_click_debounced(device, li, btn[i][1], true); - litest_assert_button_event(li, - btn[i][1], - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_assert_empty_queue(li); - - litest_button_click_debounced(device, li, btn[i][2], false); - litest_assert_button_event(li, - btn[i][2], - LIBINPUT_BUTTON_STATE_RELEASED); - litest_button_click_debounced(device, li, btn[i][3], false); - litest_assert_button_event(li, - btn[i][3], - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); - } - - litest_button_click_debounced(device, li, BTN_MIDDLE, false); - litest_drain_events(li); -} -END_TEST - -START_TEST(middlebutton_timeout) -{ - struct litest_device *device = litest_current_device(); - struct libinput *li = device->libinput; - enum libinput_config_status status; - unsigned int button; - - disable_button_scrolling(device); - - status = libinput_device_config_middle_emulation_set_enabled( - device->libinput_device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - for (button = BTN_LEFT; button <= BTN_RIGHT; button++) { - litest_drain_events(li); - litest_button_click_debounced(device, li, button, true); - litest_assert_empty_queue(li); - litest_timeout_middlebutton(); - - litest_assert_button_event(li, - button, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_button_click_debounced(device, li, button, false); - litest_assert_button_event(li, - button, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); - } -} -END_TEST - -START_TEST(middlebutton_doubleclick) -{ - struct litest_device *device = litest_current_device(); - struct libinput *li = device->libinput; - enum libinput_config_status status; - unsigned int i; - const int btn[][4] = { - { BTN_LEFT, BTN_RIGHT, BTN_LEFT, BTN_RIGHT }, - { BTN_LEFT, BTN_RIGHT, BTN_RIGHT, BTN_LEFT }, - { BTN_RIGHT, BTN_LEFT, BTN_LEFT, BTN_RIGHT }, - { BTN_RIGHT, BTN_LEFT, BTN_RIGHT, BTN_LEFT }, - }; - - disable_button_scrolling(device); - - status = libinput_device_config_middle_emulation_set_enabled( - device->libinput_device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - litest_drain_events(li); - - for (i = 0; i < ARRAY_LENGTH(btn); i++) { - litest_button_click_debounced(device, li, btn[i][0], true); - litest_button_click_debounced(device, li, btn[i][1], true); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_button_click_debounced(device, li, btn[i][2], false); - litest_button_click_debounced(device, li, btn[i][2], true); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_button_click_debounced(device, li, btn[i][3], false); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); - } -} -END_TEST - -START_TEST(middlebutton_middleclick) -{ - struct litest_device *device = litest_current_device(); - struct libinput *li = device->libinput; - enum libinput_config_status status; - unsigned int button; - - disable_button_scrolling(device); - - if (!libinput_device_pointer_has_button(device->libinput_device, - BTN_MIDDLE)) - return; - - status = libinput_device_config_middle_emulation_set_enabled( - device->libinput_device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - /* one button down, then middle -> release buttons */ - for (button = BTN_LEFT; button <= BTN_RIGHT; button++) { - /* release button before middle */ - litest_drain_events(li); - litest_button_click_debounced(device, li, button, true); - litest_button_click_debounced(device, li, BTN_MIDDLE, true); - litest_assert_button_event(li, - button, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - litest_button_click_debounced(device, li, button, false); - litest_assert_button_event(li, - button, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_button_click_debounced(device, li, BTN_MIDDLE, false); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); - - /* release middle before button */ - litest_button_click_debounced(device, li, button, true); - litest_button_click_debounced(device, li, BTN_MIDDLE, true); - litest_assert_button_event(li, - button, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - litest_button_click_debounced(device, li, BTN_MIDDLE, false); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_button_click_debounced(device, li, button, false); - litest_assert_button_event(li, - button, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); - } -} -END_TEST - -START_TEST(middlebutton_middleclick_during) -{ - struct litest_device *device = litest_current_device(); - struct libinput *li = device->libinput; - enum libinput_config_status status; - unsigned int button; - - disable_button_scrolling(device); - - if (!libinput_device_pointer_has_button(device->libinput_device, - BTN_MIDDLE)) - return; - - status = libinput_device_config_middle_emulation_set_enabled( - device->libinput_device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - litest_drain_events(li); - - /* trigger emulation, then real middle */ - for (button = BTN_LEFT; button <= BTN_RIGHT; button++) { - litest_button_click_debounced(device, li, BTN_LEFT, true); - litest_button_click_debounced(device, li, BTN_RIGHT, true); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_button_click_debounced(device, li, BTN_MIDDLE, true); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_assert_empty_queue(li); - - /* middle still down, release left/right */ - litest_button_click_debounced(device, li, button, false); - litest_assert_empty_queue(li); - litest_button_click_debounced(device, li, button, true); - litest_assert_button_event(li, - button, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - /* release both */ - litest_button_click_debounced(device, li, BTN_LEFT, false); - litest_button_click_debounced(device, li, BTN_RIGHT, false); - litest_assert_button_event(li, - button, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); - - litest_button_click_debounced(device, li, BTN_MIDDLE, false); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); - } -} -END_TEST - -START_TEST(middlebutton_default_enabled) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - int available; - enum libinput_config_middle_emulation_state state; - - if (!libinput_device_pointer_has_button(dev->libinput_device, - BTN_MIDDLE)) - return; - - available = libinput_device_config_middle_emulation_is_available(device); - ck_assert(available); - - state = libinput_device_config_middle_emulation_get_enabled(device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); - - state = libinput_device_config_middle_emulation_get_default_enabled( - device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); - - status = libinput_device_config_middle_emulation_set_enabled(device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - status = libinput_device_config_middle_emulation_set_enabled(device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - status = libinput_device_config_middle_emulation_set_enabled(device, 3); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -START_TEST(middlebutton_default_clickpad) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - enum libinput_config_middle_emulation_state state; - int available; - - available = libinput_device_config_middle_emulation_is_available(device); - ck_assert(available); - - state = libinput_device_config_middle_emulation_get_enabled(device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); - state = libinput_device_config_middle_emulation_get_default_enabled( - device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); - - status = libinput_device_config_middle_emulation_set_enabled(device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - status = libinput_device_config_middle_emulation_set_enabled(device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - status = libinput_device_config_middle_emulation_set_enabled(device, 3); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -START_TEST(middlebutton_default_touchpad) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_middle_emulation_state state; - int available; - const char *name = libinput_device_get_name(dev->libinput_device); - - if (streq(name, "litest AlpsPS/2 ALPS GlidePoint") || - streq(name, "litest AlpsPS/2 ALPS DualPoint TouchPad")) - return; - - available = libinput_device_config_middle_emulation_is_available(device); - ck_assert(!available); - - if (libinput_device_pointer_has_button(device, BTN_MIDDLE)) - return; - - state = libinput_device_config_middle_emulation_get_enabled( - device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); - state = libinput_device_config_middle_emulation_get_default_enabled( - device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); -} -END_TEST - -START_TEST(middlebutton_default_alps) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_middle_emulation_state state; - int available; - - available = libinput_device_config_middle_emulation_is_available(device); - ck_assert(available); - - state = libinput_device_config_middle_emulation_get_enabled( - device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - state = libinput_device_config_middle_emulation_get_default_enabled( - device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); -} -END_TEST - -START_TEST(middlebutton_default_disabled) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_middle_emulation_state state; - enum libinput_config_status status; - int available; - - available = libinput_device_config_middle_emulation_is_available(device); - ck_assert(!available); - state = libinput_device_config_middle_emulation_get_enabled(device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); - state = libinput_device_config_middle_emulation_get_default_enabled( - device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); - status = libinput_device_config_middle_emulation_set_enabled(device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - status = libinput_device_config_middle_emulation_set_enabled(device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); -} -END_TEST - -START_TEST(middlebutton_button_scrolling) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - struct libinput_event *ev; - struct libinput_event_pointer *pev; - int i; - - status = libinput_device_config_middle_emulation_set_enabled( - device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - status = libinput_device_config_scroll_set_method(device, - LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - status = libinput_device_config_scroll_set_button(device, BTN_LEFT); - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - /* middle emulation discards */ - litest_assert_empty_queue(li); - - litest_timeout_middlebutton(); - libinput_dispatch(li); - - /* scroll discards */ - litest_assert_empty_queue(li); - litest_timeout_buttonscroll(); - libinput_dispatch(li); - - for (i = 0; i < 10; i++) { - litest_event(dev, EV_REL, REL_Y, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - - ev = libinput_get_event(li); - do { - pev = litest_is_axis_event(ev, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, - LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS); - ck_assert_double_gt(libinput_event_pointer_get_axis_value(pev, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL), - 0.0); - libinput_event_destroy(ev); - ev = libinput_get_event(li); - } while (ev); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - ev = libinput_get_event(li); - pev = litest_is_axis_event(ev, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, - LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS); - ck_assert_double_eq(libinput_event_pointer_get_axis_value(pev, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL), - 0.0); - libinput_event_destroy(ev); - - /* no button release */ - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(middlebutton_button_scrolling_middle) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - status = libinput_device_config_middle_emulation_set_enabled( - device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - status = libinput_device_config_scroll_set_method(device, - LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - status = libinput_device_config_scroll_set_button(device, BTN_LEFT); - if (status == LIBINPUT_CONFIG_STATUS_UNSUPPORTED) - return; - - litest_drain_events(li); - - /* button scrolling should not stop middle emulation */ - - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_RIGHT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_RIGHT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(pointer_time_usec) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_pointer *ptrev; - struct libinput_event *event; - uint64_t time_usec; - - litest_drain_events(dev->libinput); - - litest_event(dev, EV_REL, REL_X, 1); - litest_event(dev, EV_REL, REL_Y, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_wait_for_event(li); - - event = libinput_get_event(li); - ptrev = litest_is_motion_event(event); - - time_usec = libinput_event_pointer_get_time_usec(ptrev); - ck_assert_int_eq(libinput_event_pointer_get_time(ptrev), - (uint32_t) (time_usec / 1000)); - - libinput_event_destroy(event); - litest_drain_events(dev->libinput); -} -END_TEST - -START_TEST(debounce_bounce) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - unsigned int button = _i; /* ranged test */ - - if (!libinput_device_pointer_has_button(dev->libinput_device, - button)) - return; - - litest_disable_middleemu(dev); - disable_button_scrolling(dev); - litest_drain_events(li); - - litest_event(dev, EV_KEY, button, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, button, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, button, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_timeout_debounce(); - libinput_dispatch(li); - - litest_assert_button_event(li, - button, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, button, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, button, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, button, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_timeout_debounce(); - libinput_dispatch(li); - - litest_assert_button_event(li, - button, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(debounce_bounce_check_immediate) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_disable_middleemu(dev); - disable_button_scrolling(dev); - litest_drain_events(li); - - /* Press must be sent without delay */ - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_timeout_debounce(); - litest_assert_empty_queue(li); - - /* held down & past timeout, we expect releases to be immediate */ - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_timeout_debounce(); - litest_assert_empty_queue(li); -} -END_TEST - -/* Triggers the event sequence that initializes the spurious - * debouncing behavior */ -static inline void -debounce_trigger_spurious(struct litest_device *dev, struct libinput *li) -{ - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_timeout_debounce(); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_timeout_debounce(); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - /* gets filtered now */ - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_timeout_debounce(); - libinput_dispatch(li); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); -} - -START_TEST(debounce_spurious) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - unsigned int button = _i; /* ranged test */ - - if (!libinput_device_pointer_has_button(dev->libinput_device, - button)) - return; - - litest_disable_middleemu(dev); - disable_button_scrolling(dev); - litest_drain_events(li); - - debounce_trigger_spurious(dev, li); - - for (int i = 0; i < 3; i++) { - litest_event(dev, EV_KEY, button, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_timeout_debounce(); - libinput_dispatch(li); - - /* Not all devices can disable middle button emulation, time out on - * middle button here to make sure the initial button press event - * was flushed. - */ - litest_timeout_middlebutton(); - libinput_dispatch(li); - - litest_assert_button_event(li, - button, - LIBINPUT_BUTTON_STATE_PRESSED); - - /* bouncy bouncy bouncy */ - litest_event(dev, EV_KEY, button, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, button, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, button, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_timeout_debounce(); - libinput_dispatch(li); - litest_assert_button_event(li, - button, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); - } -} -END_TEST - -START_TEST(debounce_spurious_multibounce) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_disable_middleemu(dev); - litest_drain_events(li); - - debounce_trigger_spurious(dev, li); - litest_drain_events(li); - - /* Let's assume our button has ventricular fibrilation and sends a - * lot of clicks. Debouncing is now enabled, ventricular - * fibrillation should cause one button down for the first press and - * one release for the last release. - */ - - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_timeout_debounce(); - - /* Not all devices can disable middle button emulation, time out on - * middle button here to make sure the initial button press event - * was flushed. - */ - libinput_dispatch(li); - litest_timeout_middlebutton(); - libinput_dispatch(li); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_empty_queue(li); - litest_timeout_debounce(); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(debounce_spurious_dont_enable_on_otherbutton) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput *li = dev->libinput; - - if (!libinput_device_config_middle_emulation_is_available(device)) - return; - - litest_disable_middleemu(dev); - disable_button_scrolling(dev); - litest_drain_events(li); - - /* Don't trigger spurious debouncing on otherbutton events */ - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_timeout_debounce(); - libinput_dispatch(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_RIGHT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_RIGHT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); - - /* Expect release to be immediate */ - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_timeout_debounce(); - libinput_dispatch(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(debounce_spurious_cancel_debounce_otherbutton) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput *li = dev->libinput; - - if (!libinput_device_config_middle_emulation_is_available(device)) - return; - - litest_disable_middleemu(dev); - disable_button_scrolling(dev); - litest_drain_events(li); - - debounce_trigger_spurious(dev, li); - - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_timeout_debounce(); - libinput_dispatch(li); - - /* spurious debouncing is on but the release should get flushed by - * the other button */ - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_RIGHT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_RIGHT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(debounce_spurious_switch_to_otherbutton) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput *li = dev->libinput; - - if (!libinput_device_config_middle_emulation_is_available(device)) - return; - - litest_drain_events(li); - debounce_trigger_spurious(dev, li); - - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_timeout_debounce(); - libinput_dispatch(li); - - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - /* release is now held back, - * other button should flush the release */ - litest_event(dev, EV_KEY, BTN_RIGHT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_RIGHT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - /* bouncing right button triggers debounce */ - litest_event(dev, EV_KEY, BTN_RIGHT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_RIGHT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -void -litest_setup_tests_pointer(void) -{ - struct range axis_range = {ABS_X, ABS_Y + 1}; - struct range compass = {0, 7}; /* cardinal directions */ - struct range buttons = {BTN_LEFT, BTN_TASK + 1}; - - litest_add("pointer:motion", pointer_motion_relative, LITEST_RELATIVE, LITEST_POINTINGSTICK); - litest_add_for_device("pointer:motion", pointer_motion_relative_zero, LITEST_MOUSE); - litest_add_ranged("pointer:motion", pointer_motion_relative_min_decel, LITEST_RELATIVE, LITEST_POINTINGSTICK, &compass); - litest_add("pointer:motion", pointer_motion_absolute, LITEST_ABSOLUTE, LITEST_ANY); - litest_add("pointer:motion", pointer_motion_unaccel, LITEST_RELATIVE, LITEST_ANY); - litest_add("pointer:button", pointer_button, LITEST_BUTTON, LITEST_CLICKPAD); - litest_add_no_device("pointer:button", pointer_button_auto_release); - litest_add_no_device("pointer:button", pointer_seat_button_count); - litest_add_for_device("pointer:button", pointer_button_has_no_button, LITEST_KEYBOARD); - litest_add("pointer:button", pointer_recover_from_lost_button_count, LITEST_BUTTON, LITEST_CLICKPAD); - litest_add("pointer:scroll", pointer_scroll_wheel, LITEST_WHEEL, LITEST_TABLET); - litest_add("pointer:scroll", pointer_scroll_button, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY); - litest_add("pointer:scroll", pointer_scroll_button_noscroll, LITEST_ABSOLUTE|LITEST_BUTTON, LITEST_RELATIVE); - litest_add("pointer:scroll", pointer_scroll_button_noscroll, LITEST_ANY, LITEST_RELATIVE|LITEST_BUTTON); - litest_add("pointer:scroll", pointer_scroll_button_no_event_before_timeout, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY); - litest_add("pointer:scroll", pointer_scroll_button_middle_emulation, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY); - litest_add("pointer:scroll", pointer_scroll_nowheel_defaults, LITEST_RELATIVE|LITEST_BUTTON, LITEST_WHEEL); - litest_add_for_device("pointer:scroll", pointer_scroll_defaults_logitech_marble , LITEST_LOGITECH_TRACKBALL); - litest_add("pointer:scroll", pointer_scroll_natural_defaults, LITEST_WHEEL, LITEST_TABLET); - litest_add("pointer:scroll", pointer_scroll_natural_defaults_noscroll, LITEST_ANY, LITEST_WHEEL); - litest_add("pointer:scroll", pointer_scroll_natural_enable_config, LITEST_WHEEL, LITEST_TABLET); - litest_add("pointer:scroll", pointer_scroll_natural_wheel, LITEST_WHEEL, LITEST_TABLET); - litest_add("pointer:scroll", pointer_scroll_has_axis_invalid, LITEST_WHEEL, LITEST_TABLET); - - litest_add("pointer:calibration", pointer_no_calibration, LITEST_ANY, LITEST_TOUCH|LITEST_SINGLE_TOUCH|LITEST_ABSOLUTE|LITEST_PROTOCOL_A|LITEST_TABLET); - - /* tests touchpads too */ - litest_add("pointer:left-handed", pointer_left_handed_defaults, LITEST_BUTTON, LITEST_ANY); - litest_add("pointer:left-handed", pointer_left_handed, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY); - litest_add("pointer:left-handed", pointer_left_handed_during_click, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY); - litest_add("pointer:left-handed", pointer_left_handed_during_click_multiple_buttons, LITEST_RELATIVE|LITEST_BUTTON, LITEST_ANY); - - litest_add("pointer:accel", pointer_accel_defaults, LITEST_RELATIVE, LITEST_ANY); - litest_add("pointer:accel", pointer_accel_invalid, LITEST_RELATIVE, LITEST_ANY); - litest_add("pointer:accel", pointer_accel_defaults_absolute, LITEST_ABSOLUTE, LITEST_RELATIVE); - litest_add("pointer:accel", pointer_accel_defaults_absolute_relative, LITEST_ABSOLUTE|LITEST_RELATIVE, LITEST_ANY); - litest_add("pointer:accel", pointer_accel_direction_change, LITEST_RELATIVE, LITEST_POINTINGSTICK); - litest_add("pointer:accel", pointer_accel_profile_defaults, LITEST_RELATIVE, LITEST_TOUCHPAD); - litest_add("pointer:accel", pointer_accel_profile_defaults_noprofile, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("pointer:accel", pointer_accel_profile_invalid, LITEST_RELATIVE, LITEST_ANY); - litest_add("pointer:accel", pointer_accel_profile_noaccel, LITEST_ANY, LITEST_TOUCHPAD|LITEST_RELATIVE|LITEST_TABLET); - litest_add("pointer:accel", pointer_accel_profile_flat_motion_relative, LITEST_RELATIVE, LITEST_TOUCHPAD); - - litest_add("pointer:middlebutton", middlebutton, LITEST_BUTTON, LITEST_CLICKPAD); - litest_add("pointer:middlebutton", middlebutton_nostart_while_down, LITEST_BUTTON, LITEST_CLICKPAD); - litest_add("pointer:middlebutton", middlebutton_timeout, LITEST_BUTTON, LITEST_CLICKPAD); - litest_add("pointer:middlebutton", middlebutton_doubleclick, LITEST_BUTTON, LITEST_CLICKPAD); - litest_add("pointer:middlebutton", middlebutton_middleclick, LITEST_BUTTON, LITEST_CLICKPAD); - litest_add("pointer:middlebutton", middlebutton_middleclick_during, LITEST_BUTTON, LITEST_CLICKPAD); - litest_add("pointer:middlebutton", middlebutton_default_enabled, LITEST_BUTTON, LITEST_TOUCHPAD|LITEST_POINTINGSTICK); - litest_add("pointer:middlebutton", middlebutton_default_clickpad, LITEST_CLICKPAD, LITEST_ANY); - litest_add("pointer:middlebutton", middlebutton_default_touchpad, LITEST_TOUCHPAD, LITEST_CLICKPAD); - litest_add("pointer:middlebutton", middlebutton_default_disabled, LITEST_ANY, LITEST_BUTTON); - litest_add_for_device("pointer:middlebutton", middlebutton_default_alps, LITEST_ALPS_SEMI_MT); - litest_add("pointer:middlebutton", middlebutton_button_scrolling, LITEST_RELATIVE|LITEST_BUTTON, LITEST_CLICKPAD); - litest_add("pointer:middlebutton", middlebutton_button_scrolling_middle, LITEST_RELATIVE|LITEST_BUTTON, LITEST_CLICKPAD); - - litest_add_ranged("pointer:state", pointer_absolute_initial_state, LITEST_ABSOLUTE, LITEST_ANY, &axis_range); - - litest_add("pointer:time", pointer_time_usec, LITEST_RELATIVE, LITEST_ANY); - - litest_add_ranged("pointer:debounce", debounce_bounce, LITEST_BUTTON, LITEST_TOUCHPAD|LITEST_NO_DEBOUNCE, &buttons); - litest_add("pointer:debounce", debounce_bounce_check_immediate, LITEST_BUTTON, LITEST_TOUCHPAD|LITEST_NO_DEBOUNCE); - litest_add_ranged("pointer:debounce", debounce_spurious, LITEST_BUTTON, LITEST_TOUCHPAD|LITEST_NO_DEBOUNCE, &buttons); - litest_add("pointer:debounce", debounce_spurious_multibounce, LITEST_BUTTON, LITEST_TOUCHPAD|LITEST_NO_DEBOUNCE); - litest_add("pointer:debounce_otherbutton", debounce_spurious_dont_enable_on_otherbutton, LITEST_BUTTON, LITEST_TOUCHPAD|LITEST_NO_DEBOUNCE); - litest_add("pointer:debounce_otherbutton", debounce_spurious_cancel_debounce_otherbutton, LITEST_BUTTON, LITEST_TOUCHPAD|LITEST_NO_DEBOUNCE); - litest_add("pointer:debounce_otherbutton", debounce_spurious_switch_to_otherbutton, LITEST_BUTTON, LITEST_TOUCHPAD|LITEST_NO_DEBOUNCE); -} diff -Nru libinput-1.10.3/test/test-switch.c libinput-0.21.0/test/test-switch.c --- libinput-1.10.3/test/test-switch.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-switch.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1081 +0,0 @@ -/* - * Copyright © 2017 James Ye - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include - -#include "libinput-util.h" -#include "litest.h" - -static inline bool -switch_has_lid(struct litest_device *dev) -{ - return libinput_device_switch_has_switch(dev->libinput_device, - LIBINPUT_SWITCH_LID); -} - -static inline bool -switch_has_tablet_mode(struct litest_device *dev) -{ - return libinput_device_switch_has_switch(dev->libinput_device, - LIBINPUT_SWITCH_TABLET_MODE); -} - -START_TEST(switch_has_cap) -{ - struct litest_device *dev = litest_current_device(); - - ck_assert(libinput_device_has_capability(dev->libinput_device, - LIBINPUT_DEVICE_CAP_SWITCH)); - -} -END_TEST - -START_TEST(switch_has_lid_switch) -{ - struct litest_device *dev = litest_current_device(); - - if (!libevdev_has_event_code(dev->evdev, EV_SW, SW_LID)) - return; - - ck_assert_int_eq(libinput_device_switch_has_switch(dev->libinput_device, - LIBINPUT_SWITCH_LID), - 1); -} -END_TEST - -START_TEST(switch_has_tablet_mode_switch) -{ - struct litest_device *dev = litest_current_device(); - - if (!libevdev_has_event_code(dev->evdev, EV_SW, SW_TABLET_MODE)) - return; - - ck_assert_int_eq(libinput_device_switch_has_switch(dev->libinput_device, - LIBINPUT_SWITCH_TABLET_MODE), - 1); -} -END_TEST - -START_TEST(switch_toggle) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - enum libinput_switch sw = _i; /* ranged test */ - - litest_drain_events(li); - - litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_ON); - libinput_dispatch(li); - - if (libinput_device_switch_has_switch(dev->libinput_device, sw)) { - event = libinput_get_event(li); - litest_is_switch_event(event, sw, LIBINPUT_SWITCH_STATE_ON); - libinput_event_destroy(event); - } else { - litest_assert_empty_queue(li); - } - - litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_OFF); - libinput_dispatch(li); - - if (libinput_device_switch_has_switch(dev->libinput_device, sw)) { - event = libinput_get_event(li); - litest_is_switch_event(event, sw, LIBINPUT_SWITCH_STATE_OFF); - libinput_event_destroy(event); - } - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(switch_toggle_double) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - enum libinput_switch sw = _i; /* ranged test */ - - if (!libinput_device_switch_has_switch(dev->libinput_device, sw)) - return; - - litest_drain_events(li); - - litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_ON); - libinput_dispatch(li); - - event = libinput_get_event(li); - litest_is_switch_event(event, sw, LIBINPUT_SWITCH_STATE_ON); - libinput_event_destroy(event); - - /* This will be filtered by the kernel, so this test is a bit - * useless */ - litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_ON); - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -static bool -lid_switch_is_reliable(struct litest_device *dev) -{ - struct udev_device *udev_device; - const char *prop; - bool is_reliable = false; - - udev_device = libinput_device_get_udev_device(dev->libinput_device); - prop = udev_device_get_property_value(udev_device, - "LIBINPUT_ATTR_LID_SWITCH_RELIABILITY"); - - is_reliable = prop && streq(prop, "reliable"); - udev_device_unref(udev_device); - - return is_reliable; -} - -START_TEST(switch_down_on_init) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li; - struct libinput_event *event; - enum libinput_switch sw = _i; /* ranged test */ - - if (!libinput_device_switch_has_switch(dev->libinput_device, sw)) - return; - - if (sw == LIBINPUT_SWITCH_LID && !lid_switch_is_reliable(dev)) - return; - - litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_ON); - - /* need separate context to test */ - li = litest_create_context(); - libinput_path_add_device(li, - libevdev_uinput_get_devnode(dev->uinput)); - libinput_dispatch(li); - - litest_wait_for_event_of_type(li, LIBINPUT_EVENT_SWITCH_TOGGLE, -1); - event = libinput_get_event(li); - litest_is_switch_event(event, sw, LIBINPUT_SWITCH_STATE_ON); - libinput_event_destroy(event); - - while ((event = libinput_get_event(li))) { - ck_assert_int_ne(libinput_event_get_type(event), - LIBINPUT_EVENT_SWITCH_TOGGLE); - libinput_event_destroy(event); - } - - litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_OFF); - libinput_dispatch(li); - event = libinput_get_event(li); - litest_is_switch_event(event, sw, LIBINPUT_SWITCH_STATE_OFF); - libinput_event_destroy(event); - litest_assert_empty_queue(li); - - libinput_unref(li); - -} -END_TEST - -START_TEST(switch_not_down_on_init) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li; - struct libinput_event *event; - enum libinput_switch sw = LIBINPUT_SWITCH_LID; - - if (!libinput_device_switch_has_switch(dev->libinput_device, sw)) - return; - - if (sw == LIBINPUT_SWITCH_LID && lid_switch_is_reliable(dev)) - return; - - litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_ON); - - /* need separate context to test */ - li = litest_create_context(); - libinput_path_add_device(li, - libevdev_uinput_get_devnode(dev->uinput)); - libinput_dispatch(li); - - while ((event = libinput_get_event(li)) != NULL) { - ck_assert_int_ne(libinput_event_get_type(event), - LIBINPUT_EVENT_SWITCH_TOGGLE); - libinput_event_destroy(event); - } - - litest_switch_action(dev, sw, LIBINPUT_SWITCH_STATE_OFF); - litest_assert_empty_queue(li); - libinput_unref(li); -} -END_TEST - -static inline struct litest_device * -switch_init_paired_touchpad(struct libinput *li) -{ - enum litest_device_type which = LITEST_SYNAPTICS_I2C; - - return litest_add_device(li, which); -} - -START_TEST(switch_disable_touchpad) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *touchpad; - struct libinput *li = sw->libinput; - enum libinput_switch which = _i; /* ranged test */ - - if (!libinput_device_switch_has_switch(sw->libinput_device, which)) - return; - - touchpad = switch_init_paired_touchpad(li); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - /* switch is on - no events */ - litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_ON); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - /* switch is off - motion events */ - litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_OFF); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(touchpad); -} -END_TEST - -START_TEST(switch_disable_touchpad_during_touch) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *touchpad; - struct libinput *li = sw->libinput; - enum libinput_switch which = _i; /* ranged test */ - - if (!libinput_device_switch_has_switch(sw->libinput_device, which)) - return; - - touchpad = switch_init_paired_touchpad(li); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_ON); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_delete_device(touchpad); -} -END_TEST - -START_TEST(switch_disable_touchpad_edge_scroll) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *touchpad; - struct libinput *li = sw->libinput; - enum libinput_switch which = _i; /* ranged test */ - - if (!libinput_device_switch_has_switch(sw->libinput_device, which)) - return; - - touchpad = switch_init_paired_touchpad(li); - litest_enable_edge_scroll(touchpad); - - litest_drain_events(li); - - litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_ON); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_touch_down(touchpad, 0, 99, 20); - libinput_dispatch(li); - litest_timeout_edgescroll(); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - litest_touch_move_to(touchpad, 0, 99, 20, 99, 80, 60, 10); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - litest_touch_move_to(touchpad, 0, 99, 80, 99, 20, 60, 10); - litest_touch_up(touchpad, 0); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - litest_delete_device(touchpad); -} -END_TEST - -START_TEST(switch_disable_touchpad_edge_scroll_interrupt) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *touchpad; - struct libinput *li = sw->libinput; - struct libinput_event *event; - enum libinput_switch which = _i; /* ranged test */ - - if (!libinput_device_switch_has_switch(sw->libinput_device, which)) - return; - - touchpad = switch_init_paired_touchpad(li); - litest_enable_edge_scroll(touchpad); - - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 99, 20); - libinput_dispatch(li); - litest_timeout_edgescroll(); - litest_touch_move_to(touchpad, 0, 99, 20, 99, 30, 10, 10); - libinput_dispatch(li); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - - litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_ON); - libinput_dispatch(li); - - event = libinput_get_event(li); - litest_is_axis_event(event, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, - LIBINPUT_POINTER_AXIS_SOURCE_FINGER); - libinput_event_destroy(event); - - event = libinput_get_event(li); - litest_is_switch_event(event, which, LIBINPUT_SWITCH_STATE_ON); - libinput_event_destroy(event); - - litest_delete_device(touchpad); -} -END_TEST - -START_TEST(switch_disable_touchpad_already_open) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *touchpad; - struct libinput *li = sw->libinput; - enum libinput_switch which = _i; /* ranged test */ - - if (!libinput_device_switch_has_switch(sw->libinput_device, which)) - return; - - touchpad = switch_init_paired_touchpad(li); - - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - /* default: switch is off - motion events */ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - /* disable switch - motion events */ - litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_OFF); - litest_assert_empty_queue(li); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(touchpad); -} -END_TEST - -START_TEST(switch_dont_resume_disabled_touchpad) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *touchpad; - struct libinput *li = sw->libinput; - enum libinput_switch which = _i; /* ranged test */ - - if (!libinput_device_switch_has_switch(sw->libinput_device, which)) - return; - - touchpad = switch_init_paired_touchpad(li); - litest_disable_tap(touchpad->libinput_device); - libinput_device_config_send_events_set_mode(touchpad->libinput_device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - litest_drain_events(li); - - /* switch is on - no events */ - litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_ON); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - /* switch is off but but tp is still disabled */ - litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_OFF); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_delete_device(touchpad); -} -END_TEST - -START_TEST(switch_dont_resume_disabled_touchpad_external_mouse) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *touchpad, *mouse; - struct libinput *li = sw->libinput; - enum libinput_switch which = _i; /* ranged test */ - - if (!libinput_device_switch_has_switch(sw->libinput_device, which)) - return; - - touchpad = switch_init_paired_touchpad(li); - mouse = litest_add_device(li, LITEST_MOUSE); - litest_disable_tap(touchpad->libinput_device); - libinput_device_config_send_events_set_mode(touchpad->libinput_device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE); - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - /* switch is on - no events */ - litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_ON); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - /* switch is off but but tp is still disabled */ - litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_OFF); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_delete_device(touchpad); - litest_delete_device(mouse); -} -END_TEST - -START_TEST(lid_open_on_key) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = sw->libinput; - struct libinput_event *event; - - if (!switch_has_lid(sw)) - return; - - keyboard = litest_add_device(li, LITEST_KEYBOARD); - - for (int i = 0; i < 3; i++) { - litest_switch_action(sw, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_ON); - litest_drain_events(li); - - litest_event(keyboard, EV_KEY, KEY_A, 1); - litest_event(keyboard, EV_SYN, SYN_REPORT, 0); - litest_event(keyboard, EV_KEY, KEY_A, 0); - litest_event(keyboard, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - litest_is_switch_event(event, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_OFF); - libinput_event_destroy(event); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_switch_action(sw, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_OFF); - litest_assert_empty_queue(li); - } - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(lid_open_on_key_touchpad_enabled) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *keyboard, *touchpad; - struct libinput *li = sw->libinput; - - if (!switch_has_lid(sw)) - return; - - keyboard = litest_add_device(li, LITEST_KEYBOARD); - touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C); - - litest_switch_action(sw, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_ON); - litest_drain_events(li); - - litest_event(keyboard, EV_KEY, KEY_A, 1); - litest_event(keyboard, EV_SYN, SYN_REPORT, 0); - litest_event(keyboard, EV_KEY, KEY_A, 0); - litest_event(keyboard, EV_SYN, SYN_REPORT, 0); - litest_drain_events(li); - litest_timeout_dwt_long(); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 70, 10, 1); - litest_touch_up(touchpad, 0); - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); - litest_delete_device(touchpad); -} -END_TEST - -START_TEST(switch_suspend_with_keyboard) -{ - struct libinput *li; - struct litest_device *keyboard; - struct litest_device *sw; - enum libinput_switch which = _i; /* ranged test */ - - li = litest_create_context(); - - switch(which) { - case LIBINPUT_SWITCH_LID: - sw = litest_add_device(li, LITEST_LID_SWITCH); - break; - case LIBINPUT_SWITCH_TABLET_MODE: - sw = litest_add_device(li, LITEST_THINKPAD_EXTRABUTTONS); - break; - default: - abort(); - } - - libinput_dispatch(li); - - keyboard = litest_add_device(li, LITEST_KEYBOARD); - libinput_dispatch(li); - - litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_ON); - litest_drain_events(li); - litest_switch_action(sw, which, LIBINPUT_SWITCH_STATE_OFF); - litest_drain_events(li); - - litest_delete_device(keyboard); - litest_drain_events(li); - - litest_delete_device(sw); - libinput_dispatch(li); - - libinput_unref(li); -} -END_TEST - -START_TEST(switch_suspend_with_touchpad) -{ - struct libinput *li; - struct litest_device *touchpad, *sw; - enum libinput_switch which = _i; /* ranged test */ - - li = litest_create_context(); - - switch(which) { - case LIBINPUT_SWITCH_LID: - sw = litest_add_device(li, LITEST_LID_SWITCH); - break; - case LIBINPUT_SWITCH_TABLET_MODE: - sw = litest_add_device(li, LITEST_THINKPAD_EXTRABUTTONS); - break; - default: - abort(); - } - - litest_drain_events(li); - - touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C); - litest_delete_device(touchpad); - touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C); - litest_drain_events(li); - - litest_delete_device(sw); - litest_drain_events(li); - litest_delete_device(touchpad); - litest_drain_events(li); - - libinput_unref(li); -} -END_TEST - -START_TEST(lid_update_hw_on_key) -{ - struct litest_device *sw = litest_current_device(); - struct libinput *li = sw->libinput; - struct libinput *li2; - struct litest_device *keyboard; - struct libinput_event *event; - - if (!switch_has_lid(sw)) - return; - - keyboard = litest_add_device(li, LITEST_KEYBOARD); - - /* separate context to listen to the fake hw event */ - li2 = litest_create_context(); - libinput_path_add_device(li2, - libevdev_uinput_get_devnode(sw->uinput)); - litest_drain_events(li2); - - litest_switch_action(sw, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_ON); - litest_drain_events(li); - - libinput_dispatch(li2); - event = libinput_get_event(li2); - litest_is_switch_event(event, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_ON); - libinput_event_destroy(event); - - litest_event(keyboard, EV_KEY, KEY_A, 1); - litest_event(keyboard, EV_SYN, SYN_REPORT, 0); - litest_event(keyboard, EV_KEY, KEY_A, 0); - litest_event(keyboard, EV_SYN, SYN_REPORT, 0); - litest_drain_events(li); - - litest_wait_for_event(li2); - event = libinput_get_event(li2); - litest_is_switch_event(event, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_OFF); - libinput_event_destroy(event); - litest_assert_empty_queue(li2); - - libinput_unref(li2); - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(lid_update_hw_on_key_closed_on_init) -{ - struct litest_device *sw = litest_current_device(); - struct libinput *li; - struct litest_device *keyboard; - struct libevdev *evdev = sw->evdev; - struct input_event ev; - - litest_switch_action(sw, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_ON); - - /* Make sure kernel state is right */ - libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_FORCE_SYNC, &ev); - while (libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_SYNC, &ev) >= 0) - ; - ck_assert(libevdev_get_event_value(evdev, EV_SW, SW_LID)); - - keyboard = litest_add_device(sw->libinput, LITEST_KEYBOARD); - - /* separate context for the right state on init */ - li = litest_create_context(); - libinput_path_add_device(li, - libevdev_uinput_get_devnode(sw->uinput)); - libinput_path_add_device(li, - libevdev_uinput_get_devnode(keyboard->uinput)); - - /* don't expect a switch waiting for us */ - while (libinput_next_event_type(li) != LIBINPUT_EVENT_NONE) { - ck_assert_int_ne(libinput_next_event_type(li), - LIBINPUT_EVENT_SWITCH_TOGGLE); - libinput_event_destroy(libinput_get_event(li)); - } - - litest_event(keyboard, EV_KEY, KEY_A, 1); - litest_event(keyboard, EV_SYN, SYN_REPORT, 0); - litest_event(keyboard, EV_KEY, KEY_A, 0); - litest_event(keyboard, EV_SYN, SYN_REPORT, 0); - /* No switch event, we're still in vanilla (open) state */ - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - /* Make sure kernel state has updated */ - libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_FORCE_SYNC, &ev); - while (libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_SYNC, &ev) >= 0) - ; - ck_assert(!libevdev_get_event_value(evdev, EV_SW, SW_LID)); - - libinput_unref(li); - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(lid_update_hw_on_key_multiple_keyboards) -{ - struct litest_device *sw = litest_current_device(); - struct libinput *li = sw->libinput; - struct libinput *li2; - struct litest_device *keyboard1, *keyboard2; - struct libinput_event *event; - - if (!switch_has_lid(sw)) - return; - - keyboard1 = litest_add_device(li, - LITEST_KEYBOARD_BLADE_STEALTH_VIDEOSWITCH); - libinput_dispatch(li); - - keyboard2 = litest_add_device(li, LITEST_KEYBOARD_BLADE_STEALTH); - libinput_dispatch(li); - - /* separate context to listen to the fake hw event */ - li2 = litest_create_context(); - libinput_path_add_device(li2, - libevdev_uinput_get_devnode(sw->uinput)); - litest_drain_events(li2); - - litest_switch_action(sw, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_ON); - litest_drain_events(li); - - libinput_dispatch(li2); - event = libinput_get_event(li2); - litest_is_switch_event(event, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_ON); - libinput_event_destroy(event); - - litest_event(keyboard2, EV_KEY, KEY_A, 1); - litest_event(keyboard2, EV_SYN, SYN_REPORT, 0); - litest_event(keyboard2, EV_KEY, KEY_A, 0); - litest_event(keyboard2, EV_SYN, SYN_REPORT, 0); - litest_drain_events(li); - - litest_wait_for_event(li2); - event = libinput_get_event(li2); - litest_is_switch_event(event, - LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_STATE_OFF); - libinput_event_destroy(event); - litest_assert_empty_queue(li2); - - libinput_unref(li2); - litest_delete_device(keyboard1); - litest_delete_device(keyboard2); -} -END_TEST - -START_TEST(lid_key_press) -{ - struct litest_device *sw = litest_current_device(); - struct libinput *li = sw->libinput; - - litest_drain_events(li); - - litest_keyboard_key(sw, KEY_VOLUMEUP, true); - litest_keyboard_key(sw, KEY_VOLUMEUP, false); - libinput_dispatch(li); - - /* Check that we're routing key events from a lid device too */ - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); -} -END_TEST - -START_TEST(tablet_mode_disable_touchpad_on_init) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *touchpad; - struct libinput *li = sw->libinput; - - if (!switch_has_tablet_mode(sw)) - return; - - litest_switch_action(sw, - LIBINPUT_SWITCH_TABLET_MODE, - LIBINPUT_SWITCH_STATE_ON); - litest_drain_events(li); - - /* touchpad comes with switch already on - no events */ - touchpad = switch_init_paired_touchpad(li); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_switch_action(sw, - LIBINPUT_SWITCH_TABLET_MODE, - LIBINPUT_SWITCH_STATE_OFF); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(touchpad); -} -END_TEST - -START_TEST(tablet_mode_disable_keyboard) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = sw->libinput; - - if (!switch_has_tablet_mode(sw)) - return; - - keyboard = litest_add_device(li, LITEST_KEYBOARD); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_switch_action(sw, - LIBINPUT_SWITCH_TABLET_MODE, - LIBINPUT_SWITCH_STATE_ON); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_empty_queue(li); - - litest_switch_action(sw, - LIBINPUT_SWITCH_TABLET_MODE, - LIBINPUT_SWITCH_STATE_OFF); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(tablet_mode_disable_keyboard_on_init) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = sw->libinput; - - if (!switch_has_tablet_mode(sw)) - return; - - litest_switch_action(sw, - LIBINPUT_SWITCH_TABLET_MODE, - LIBINPUT_SWITCH_STATE_ON); - litest_drain_events(li); - - /* keyboard comes with switch already on - no events */ - keyboard = litest_add_device(li, LITEST_KEYBOARD); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_empty_queue(li); - - litest_switch_action(sw, - LIBINPUT_SWITCH_TABLET_MODE, - LIBINPUT_SWITCH_STATE_OFF); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(tablet_mode_disable_trackpoint) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *trackpoint; - struct libinput *li = sw->libinput; - - if (!switch_has_tablet_mode(sw)) - return; - - trackpoint = litest_add_device(li, LITEST_TRACKPOINT); - litest_drain_events(li); - - litest_event(trackpoint, EV_REL, REL_Y, -1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_event(trackpoint, EV_REL, REL_Y, -1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_switch_action(sw, - LIBINPUT_SWITCH_TABLET_MODE, - LIBINPUT_SWITCH_STATE_ON); - litest_drain_events(li); - - litest_event(trackpoint, EV_REL, REL_Y, -1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_event(trackpoint, EV_REL, REL_Y, -1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_assert_empty_queue(li); - - litest_switch_action(sw, - LIBINPUT_SWITCH_TABLET_MODE, - LIBINPUT_SWITCH_STATE_OFF); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_event(trackpoint, EV_REL, REL_Y, -1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_event(trackpoint, EV_REL, REL_Y, -1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(trackpoint); -} -END_TEST -START_TEST(tablet_mode_disable_trackpoint_on_init) -{ - struct litest_device *sw = litest_current_device(); - struct litest_device *trackpoint; - struct libinput *li = sw->libinput; - - if (!switch_has_tablet_mode(sw)) - return; - - litest_switch_action(sw, - LIBINPUT_SWITCH_TABLET_MODE, - LIBINPUT_SWITCH_STATE_ON); - litest_drain_events(li); - - /* trackpoint comes with switch already on - no events */ - trackpoint = litest_add_device(li, LITEST_TRACKPOINT); - litest_drain_events(li); - - litest_event(trackpoint, EV_REL, REL_Y, -1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_event(trackpoint, EV_REL, REL_Y, -1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_assert_empty_queue(li); - - litest_switch_action(sw, - LIBINPUT_SWITCH_TABLET_MODE, - LIBINPUT_SWITCH_STATE_OFF); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_SWITCH_TOGGLE); - - litest_event(trackpoint, EV_REL, REL_Y, -1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_event(trackpoint, EV_REL, REL_Y, -1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(trackpoint); -} -END_TEST - -START_TEST(dock_toggle) -{ - struct litest_device *sw = litest_current_device(); - struct libinput *li = sw->libinput; - - if (!libevdev_has_event_code(sw->evdev, EV_SW, SW_DOCK)) - return; - - litest_drain_events(li); - - litest_event(sw, EV_SW, SW_DOCK, 1); - libinput_dispatch(li); - - litest_event(sw, EV_SW, SW_DOCK, 0); - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST -void -litest_setup_tests_lid(void) -{ - struct range switches = { LIBINPUT_SWITCH_LID, - LIBINPUT_SWITCH_TABLET_MODE + 1}; - - litest_add("switch:has", switch_has_cap, LITEST_SWITCH, LITEST_ANY); - litest_add("switch:has", switch_has_lid_switch, LITEST_SWITCH, LITEST_ANY); - litest_add("switch:has", switch_has_tablet_mode_switch, LITEST_SWITCH, LITEST_ANY); - litest_add_ranged("switch:toggle", switch_toggle, LITEST_SWITCH, LITEST_ANY, &switches); - litest_add_ranged("switch:toggle", switch_toggle_double, LITEST_SWITCH, LITEST_ANY, &switches); - litest_add_ranged("switch:toggle", switch_down_on_init, LITEST_SWITCH, LITEST_ANY, &switches); - litest_add("switch:toggle", switch_not_down_on_init, LITEST_SWITCH, LITEST_ANY); - litest_add_ranged("switch:touchpad", switch_disable_touchpad, LITEST_SWITCH, LITEST_ANY, &switches); - litest_add_ranged("switch:touchpad", switch_disable_touchpad_during_touch, LITEST_SWITCH, LITEST_ANY, &switches); - litest_add_ranged("switch:touchpad", switch_disable_touchpad_edge_scroll, LITEST_SWITCH, LITEST_ANY, &switches); - litest_add_ranged("switch:touchpad", switch_disable_touchpad_edge_scroll_interrupt, LITEST_SWITCH, LITEST_ANY, &switches); - litest_add_ranged("switch:touchpad", switch_disable_touchpad_already_open, LITEST_SWITCH, LITEST_ANY, &switches); - litest_add_ranged("switch:touchpad", switch_dont_resume_disabled_touchpad, LITEST_SWITCH, LITEST_ANY, &switches); - litest_add_ranged("switch:touchpad", switch_dont_resume_disabled_touchpad_external_mouse, LITEST_SWITCH, LITEST_ANY, &switches); - - litest_add_ranged_no_device("switch:keyboard", switch_suspend_with_keyboard, &switches); - litest_add_ranged_no_device("switch:touchpad", switch_suspend_with_touchpad, &switches); - - litest_add("lid:keyboard", lid_open_on_key, LITEST_SWITCH, LITEST_ANY); - litest_add("lid:keyboard", lid_open_on_key_touchpad_enabled, LITEST_SWITCH, LITEST_ANY); - litest_add_for_device("lid:buggy", lid_update_hw_on_key, LITEST_LID_SWITCH_SURFACE3); - litest_add_for_device("lid:buggy", lid_update_hw_on_key_closed_on_init, LITEST_LID_SWITCH_SURFACE3); - litest_add_for_device("lid:buggy", lid_update_hw_on_key_multiple_keyboards, LITEST_LID_SWITCH_SURFACE3); - litest_add_for_device("lid:keypress", lid_key_press, LITEST_GPIO_KEYS); - - litest_add("tablet-mode:touchpad", tablet_mode_disable_touchpad_on_init, LITEST_SWITCH, LITEST_ANY); - litest_add("tablet-mode:keyboard", tablet_mode_disable_keyboard, LITEST_SWITCH, LITEST_ANY); - litest_add("tablet-mode:keyboard", tablet_mode_disable_keyboard_on_init, LITEST_SWITCH, LITEST_ANY); - litest_add("tablet-mode:trackpoint", tablet_mode_disable_trackpoint, LITEST_SWITCH, LITEST_ANY); - litest_add("tablet-mode:trackpoint", tablet_mode_disable_trackpoint_on_init, LITEST_SWITCH, LITEST_ANY); - - litest_add("lid:dock", dock_toggle, LITEST_SWITCH, LITEST_ANY); -} diff -Nru libinput-1.10.3/test/test-tablet.c libinput-0.21.0/test/test-tablet.c --- libinput-1.10.3/test/test-tablet.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-tablet.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,4635 +0,0 @@ -/* - * Copyright © 2014-2015 Red Hat, Inc. - * Copyright © 2014 Lyude Paul - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the copyright holders not be used in - * advertising or publicity pertaining to distribution of the software - * without specific, written prior permission. The copyright holders make - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "libinput-util.h" -#include "evdev-tablet.h" -#include "litest.h" - -START_TEST(button_down_up) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_STYLUS)) - return; - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_button(tev), - BTN_STYLUS); - ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev), - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, BTN_STYLUS, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_button(tev), - BTN_STYLUS); - ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev), - LIBINPUT_BUTTON_STATE_RELEASED); - libinput_event_destroy(event); - litest_assert_empty_queue(li); - -} -END_TEST - -START_TEST(button_seat_count) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct litest_device *dev2; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_STYLUS)) - return; - - dev2 = litest_add_device(li, LITEST_WACOM_CINTIQ_13HDT_PEN); - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_tablet_proximity_in(dev2, 10, 10, axes); - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev2, EV_KEY, BTN_STYLUS, 1); - litest_event(dev2, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_button(tev), - BTN_STYLUS); - ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev), - LIBINPUT_BUTTON_STATE_PRESSED); - ck_assert_int_eq(libinput_event_tablet_tool_get_seat_button_count(tev), 1); - libinput_event_destroy(event); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_button(tev), - BTN_STYLUS); - ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev), - LIBINPUT_BUTTON_STATE_PRESSED); - ck_assert_int_eq(libinput_event_tablet_tool_get_seat_button_count(tev), 2); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - - litest_event(dev2, EV_KEY, BTN_STYLUS, 0); - litest_event(dev2, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_STYLUS, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev), - LIBINPUT_BUTTON_STATE_RELEASED); - ck_assert_int_eq(libinput_event_tablet_tool_get_button(tev), - BTN_STYLUS); - ck_assert_int_eq(libinput_event_tablet_tool_get_seat_button_count(tev), 1); - libinput_event_destroy(event); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev), - LIBINPUT_BUTTON_STATE_RELEASED); - ck_assert_int_eq(libinput_event_tablet_tool_get_button(tev), - BTN_STYLUS); - ck_assert_int_eq(libinput_event_tablet_tool_get_seat_button_count(tev), 0); - libinput_event_destroy(event); - litest_assert_empty_queue(li); - - litest_delete_device(dev2); -} -END_TEST - -START_TEST(tip_down_up) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_axis_set_value(axes, ABS_PRESSURE, 30); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_DOWN); - libinput_event_destroy(event); - litest_assert_empty_queue(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 10); - litest_axis_set_value(axes, ABS_PRESSURE, 0); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_pop_event_frame(dev); - - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_UP); - libinput_event_destroy(event); - litest_assert_empty_queue(li); - - litest_assert_empty_queue(li); - -} -END_TEST - -START_TEST(tip_down_prox_in) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 0 }, - { ABS_PRESSURE, 30 }, - { -1, -1 } - }; - - litest_drain_events(li); - - litest_push_event_frame(dev); - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_tablet_motion(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(tablet_event), - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); - libinput_event_destroy(event); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_DOWN); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - -} -END_TEST - -static inline bool -tablet_has_proxout_quirk(struct litest_device *dev) -{ - struct udev_device *udev_device; - bool has_quirk; - - udev_device = libinput_device_get_udev_device(dev->libinput_device); - - has_quirk = !!udev_device_get_property_value(udev_device, - "LIBINPUT_MODEL_TABLET_NO_PROXIMITY_OUT"); - if (!has_quirk) - has_quirk = !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_PEN); - - udev_device_unref(udev_device); - - return has_quirk; -} - -START_TEST(tip_up_prox_out) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 0 }, - { ABS_PRESSURE, 30 }, - { -1, -1 } - }; - - if (tablet_has_proxout_quirk(dev)) - return; - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 30); - litest_axis_set_value(axes, ABS_PRESSURE, 0); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_tablet_proximity_out(dev); - litest_pop_event_frame(dev); - - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_UP); - libinput_event_destroy(event); - - litest_timeout_tablet_proxout(); - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(tablet_event), - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - -} -END_TEST - -START_TEST(tip_up_btn_change) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 0 }, - { ABS_PRESSURE, 30 }, - { -1, -1 } - }; - - litest_push_event_frame(dev); - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_tablet_motion(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 30); - litest_axis_set_value(axes, ABS_PRESSURE, 0); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 10, 20, axes); - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_pop_event_frame(dev); - - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_UP); - libinput_event_destroy(event); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_button(tablet_event), - BTN_STYLUS); - ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tablet_event), - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_axis_set_value(axes, ABS_PRESSURE, 30); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - litest_drain_events(li); - - /* same thing with a release at tip-up */ - litest_axis_set_value(axes, ABS_DISTANCE, 30); - litest_axis_set_value(axes, ABS_PRESSURE, 0); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_event(dev, EV_KEY, BTN_STYLUS, 0); - litest_pop_event_frame(dev); - - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_UP); - libinput_event_destroy(event); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_button(tablet_event), - BTN_STYLUS); - ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tablet_event), - LIBINPUT_BUTTON_STATE_RELEASED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(tip_down_btn_change) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_axis_set_value(axes, ABS_PRESSURE, 30); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 10, 20, axes); - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_DOWN); - libinput_event_destroy(event); - - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_button(tablet_event), - BTN_STYLUS); - ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tablet_event), - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 30); - litest_axis_set_value(axes, ABS_PRESSURE, 0); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 10, 20, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_pop_event_frame(dev); - litest_drain_events(li); - - /* same thing with a release at tip-down */ - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_axis_set_value(axes, ABS_PRESSURE, 30); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 10, 20, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_event(dev, EV_KEY, BTN_STYLUS, 0); - litest_pop_event_frame(dev); - - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_DOWN); - libinput_event_destroy(event); - - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_button(tablet_event), - BTN_STYLUS); - ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tablet_event), - LIBINPUT_BUTTON_STATE_RELEASED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(tip_down_motion) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - double x, y, last_x, last_y; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 10, 10, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - last_x = libinput_event_tablet_tool_get_x(tablet_event); - last_y = libinput_event_tablet_tool_get_y(tablet_event); - libinput_event_destroy(event); - - /* move x/y on tip down, make sure x/y changed */ - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_axis_set_value(axes, ABS_PRESSURE, 20); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 70, 70, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_pop_event_frame(dev); - - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_DOWN); - ck_assert(libinput_event_tablet_tool_x_has_changed(tablet_event)); - ck_assert(libinput_event_tablet_tool_y_has_changed(tablet_event)); - x = libinput_event_tablet_tool_get_x(tablet_event); - y = libinput_event_tablet_tool_get_y(tablet_event); - ck_assert_double_lt(last_x, x); - ck_assert_double_lt(last_y, y); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(tip_up_motion) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 0 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - double x, y, last_x, last_y; - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_PRESSURE, 20); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 70, 70, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_pop_event_frame(dev); - - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - last_x = libinput_event_tablet_tool_get_x(tablet_event); - last_y = libinput_event_tablet_tool_get_y(tablet_event); - libinput_event_destroy(event); - - /* move x/y on tip up, make sure x/y changed */ - litest_axis_set_value(axes, ABS_PRESSURE, 0); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 40, 40, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_pop_event_frame(dev); - - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_UP); - ck_assert(libinput_event_tablet_tool_x_has_changed(tablet_event)); - ck_assert(libinput_event_tablet_tool_y_has_changed(tablet_event)); - x = libinput_event_tablet_tool_get_x(tablet_event); - y = libinput_event_tablet_tool_get_y(tablet_event); - ck_assert_double_ne(last_x, x); - ck_assert_double_ne(last_y, y); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(tip_state_proximity) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 10, 10, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_UP); - libinput_event_destroy(event); - - litest_axis_set_value(axes, ABS_PRESSURE, 30); - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - - litest_axis_set_value(axes, ABS_PRESSURE, 0); - litest_axis_set_value(axes, ABS_DISTANCE, 10); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_pop_event_frame(dev); - - litest_drain_events(li); - - litest_tablet_proximity_out(dev); - libinput_dispatch(li); - - litest_timeout_tablet_proxout(); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_UP); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tip_state_axis) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_drain_events(li); - - litest_tablet_motion(dev, 70, 70, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_UP); - libinput_event_destroy(event); - - litest_axis_set_value(axes, ABS_PRESSURE, 30); - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 40, 40, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - litest_drain_events(li); - - litest_tablet_motion(dev, 30, 30, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_DOWN); - libinput_event_destroy(event); - - litest_axis_set_value(axes, ABS_PRESSURE, 0); - litest_axis_set_value(axes, ABS_DISTANCE, 10); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 40, 40, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_pop_event_frame(dev); - litest_drain_events(li); - - litest_tablet_motion(dev, 40, 80, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_UP); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(tip_state_button) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_UP); - libinput_event_destroy(event); - - litest_axis_set_value(axes, ABS_PRESSURE, 30); - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 40, 40, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_STYLUS, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_DOWN); - libinput_event_destroy(event); - - litest_axis_set_value(axes, ABS_PRESSURE, 0); - litest_axis_set_value(axes, ABS_DISTANCE, 10); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 40, 40, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_pop_event_frame(dev); - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_UP); - libinput_event_destroy(event); - - litest_event(dev, EV_KEY, BTN_STYLUS, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event), - LIBINPUT_TABLET_TOOL_TIP_UP); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(proximity_in_out) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_tablet_tool *tablet_event; - struct libinput_event *event; - bool have_tool_update = false, - have_proximity_out = false; - - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 10, 10, axes); - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - if (libinput_event_get_type(event) == - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY) { - struct libinput_tablet_tool * tool; - - ck_assert(!have_tool_update); - have_tool_update = true; - tablet_event = libinput_event_get_tablet_tool_event(event); - tool = libinput_event_tablet_tool_get_tool(tablet_event); - ck_assert_int_eq(libinput_tablet_tool_get_type(tool), - LIBINPUT_TABLET_TOOL_TYPE_PEN); - } - libinput_event_destroy(event); - } - ck_assert(have_tool_update); - - litest_tablet_proximity_out(dev); - libinput_dispatch(li); - - litest_timeout_tablet_proxout(); - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - if (libinput_event_get_type(event) == - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY) { - struct libinput_event_tablet_tool *t = - libinput_event_get_tablet_tool_event(event); - - if (libinput_event_tablet_tool_get_proximity_state(t) == - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT) - have_proximity_out = true; - } - - libinput_event_destroy(event); - } - ck_assert(have_proximity_out); - - /* Proximity out must not emit axis events */ - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(proximity_in_button_down) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_drain_events(li); - - litest_push_event_frame(dev); - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_pop_event_frame(dev); - libinput_dispatch(li); - - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); - litest_assert_tablet_button_event(li, - BTN_STYLUS, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(proximity_out_button_up) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_tablet_proximity_in(dev, 10, 10, axes); - - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_drain_events(li); - - litest_push_event_frame(dev); - litest_tablet_proximity_out(dev); - litest_event(dev, EV_KEY, BTN_STYLUS, 0); - litest_pop_event_frame(dev); - libinput_dispatch(li); - - litest_assert_tablet_button_event(li, - BTN_STYLUS, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(proximity_out_clear_buttons) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_tablet_tool *tablet_event; - struct libinput_event *event; - uint32_t button; - - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_drain_events(li); - - /* Test that proximity out events send button releases for any currently - * pressed stylus buttons - */ - for (button = BTN_TOUCH + 1; button <= BTN_STYLUS2; button++) { - bool button_released = false; - uint32_t event_button = 0; - enum libinput_button_state state; - - if (!libevdev_has_event_code(dev->evdev, EV_KEY, button)) - continue; - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_event(dev, EV_KEY, button, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_tablet_proximity_out(dev); - libinput_dispatch(li); - - litest_timeout_tablet_proxout(); - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - tablet_event = libinput_event_get_tablet_tool_event(event); - - if (libinput_event_get_type(event) == - LIBINPUT_EVENT_TABLET_TOOL_BUTTON) { - - event_button = libinput_event_tablet_tool_get_button(tablet_event); - state = libinput_event_tablet_tool_get_button_state(tablet_event); - - if (event_button == button && - state == LIBINPUT_BUTTON_STATE_RELEASED) - button_released = true; - } - - libinput_event_destroy(event); - } - - ck_assert_msg(button_released, - "Button %s (%d) was not released.", - libevdev_event_code_get_name(EV_KEY, button), - event_button); - } - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(proximity_has_axes) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_tablet_tool *tablet_event; - struct libinput_event *event; - struct libinput_tablet_tool *tool; - double x, y, - distance; - double last_x, last_y, - last_distance = 0.0, - last_tx = 0.0, last_ty = 0.0; - - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { ABS_TILT_X, 10 }, - { ABS_TILT_Y, 10 }, - { -1, -1} - }; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 10, 10, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tablet_event); - - ck_assert(libinput_event_tablet_tool_x_has_changed(tablet_event)); - ck_assert(libinput_event_tablet_tool_y_has_changed(tablet_event)); - - x = libinput_event_tablet_tool_get_x(tablet_event); - y = libinput_event_tablet_tool_get_y(tablet_event); - - litest_assert_double_ne(x, 0); - litest_assert_double_ne(y, 0); - - if (libinput_tablet_tool_has_distance(tool)) { - ck_assert(libinput_event_tablet_tool_distance_has_changed( - tablet_event)); - - distance = libinput_event_tablet_tool_get_distance(tablet_event); - litest_assert_double_ne(distance, 0); - } - - if (libinput_tablet_tool_has_tilt(tool)) { - ck_assert(libinput_event_tablet_tool_tilt_x_has_changed( - tablet_event)); - ck_assert(libinput_event_tablet_tool_tilt_y_has_changed( - tablet_event)); - - x = libinput_event_tablet_tool_get_tilt_x(tablet_event); - y = libinput_event_tablet_tool_get_tilt_y(tablet_event); - - litest_assert_double_ne(x, 0); - litest_assert_double_ne(y, 0); - } - - litest_assert_empty_queue(li); - libinput_event_destroy(event); - - litest_axis_set_value(axes, ABS_DISTANCE, 20); - litest_axis_set_value(axes, ABS_TILT_X, 15); - litest_axis_set_value(axes, ABS_TILT_Y, 25); - - /* work around axis smoothing */ - litest_tablet_motion(dev, 20, 30, axes); - litest_tablet_motion(dev, 20, 29, axes); - litest_tablet_motion(dev, 20, 31, axes); - litest_drain_events(li); - - litest_tablet_motion(dev, 20, 30, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - last_x = libinput_event_tablet_tool_get_x(tablet_event); - last_y = libinput_event_tablet_tool_get_y(tablet_event); - if (libinput_tablet_tool_has_distance(tool)) - last_distance = libinput_event_tablet_tool_get_distance( - tablet_event); - if (libinput_tablet_tool_has_tilt(tool)) { - last_tx = libinput_event_tablet_tool_get_tilt_x(tablet_event); - last_ty = libinput_event_tablet_tool_get_tilt_y(tablet_event); - } - - libinput_event_destroy(event); - - /* Make sure that the axes are still present on proximity out */ - litest_tablet_proximity_out(dev); - libinput_dispatch(li); - - litest_timeout_tablet_proxout(); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tablet_event); - - ck_assert(!libinput_event_tablet_tool_x_has_changed(tablet_event)); - ck_assert(!libinput_event_tablet_tool_y_has_changed(tablet_event)); - - x = libinput_event_tablet_tool_get_x(tablet_event); - y = libinput_event_tablet_tool_get_y(tablet_event); - litest_assert_double_ge(x, last_x - 1); - litest_assert_double_le(x, last_x + 1); - litest_assert_double_ge(y, last_y - 1); - litest_assert_double_le(y, last_y + 1); - - if (libinput_tablet_tool_has_distance(tool)) { - ck_assert(!libinput_event_tablet_tool_distance_has_changed( - tablet_event)); - - distance = libinput_event_tablet_tool_get_distance( - tablet_event); - litest_assert_double_eq(distance, last_distance); - } - - if (libinput_tablet_tool_has_tilt(tool)) { - ck_assert(!libinput_event_tablet_tool_tilt_x_has_changed( - tablet_event)); - ck_assert(!libinput_event_tablet_tool_tilt_y_has_changed( - tablet_event)); - - x = libinput_event_tablet_tool_get_tilt_x(tablet_event); - y = libinput_event_tablet_tool_get_tilt_y(tablet_event); - - litest_assert_double_eq(x, last_tx); - litest_assert_double_eq(y, last_ty); - } - - litest_assert_empty_queue(li); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(proximity_range_enter) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 90 }, - { -1, -1 } - }; - - if (!libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_TOOL_MOUSE)) - return; - - litest_drain_events(li); - - litest_push_event_frame(dev); - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1); - litest_pop_event_frame(dev); - litest_assert_empty_queue(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 20); - litest_tablet_motion(dev, 10, 10, axes); - libinput_dispatch(li); - - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); - - litest_axis_set_value(axes, ABS_DISTANCE, 90); - litest_tablet_motion(dev, 10, 10, axes); - libinput_dispatch(li); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); - - litest_tablet_proximity_out(dev); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(proximity_range_in_out) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 20 }, - { -1, -1 } - }; - - if (!libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_TOOL_MOUSE)) - return; - - litest_drain_events(li); - - litest_push_event_frame(dev); - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1); - litest_pop_event_frame(dev); - libinput_dispatch(li); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); - - litest_axis_set_value(axes, ABS_DISTANCE, 90); - litest_tablet_motion(dev, 10, 10, axes); - libinput_dispatch(li); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); - - litest_tablet_motion(dev, 30, 30, axes); - litest_assert_empty_queue(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 20); - litest_tablet_motion(dev, 10, 10, axes); - libinput_dispatch(li); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); - - litest_tablet_proximity_out(dev); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(proximity_range_button_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 90 }, - { -1, -1 } - }; - - if (!libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_TOOL_MOUSE)) - return; - - litest_drain_events(li); - - litest_push_event_frame(dev); - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1); - litest_pop_event_frame(dev); - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_event(dev, EV_KEY, BTN_STYLUS, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_tablet_proximity_out(dev); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(proximity_range_button_press) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 20 }, - { -1, -1 } - }; - - if (!libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_TOOL_MOUSE)) - return; - - litest_push_event_frame(dev); - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1); - litest_pop_event_frame(dev); - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_assert_tablet_button_event(li, - BTN_STYLUS, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_axis_set_value(axes, ABS_DISTANCE, 90); - litest_tablet_motion(dev, 15, 15, axes); - libinput_dispatch(li); - - /* expect fake button release */ - litest_assert_tablet_button_event(li, - BTN_STYLUS, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); - - litest_event(dev, EV_KEY, BTN_STYLUS, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_tablet_proximity_out(dev); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(proximity_range_button_release) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 90 }, - { -1, -1 } - }; - - if (!libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_TOOL_MOUSE)) - return; - - litest_push_event_frame(dev); - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1); - litest_pop_event_frame(dev); - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_assert_empty_queue(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 20); - litest_tablet_motion(dev, 15, 15, axes); - libinput_dispatch(li); - - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); - /* expect fake button press */ - litest_assert_tablet_button_event(li, - BTN_STYLUS, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, BTN_STYLUS, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_assert_tablet_button_event(li, - BTN_STYLUS, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_tablet_proximity_out(dev); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); -} -END_TEST - -START_TEST(motion) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_tablet_tool *tablet_event; - struct libinput_event *event; - int test_x, test_y; - double last_reported_x = 0, last_reported_y = 0; - enum libinput_event_type type; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 5, 100, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - - do { - bool x_changed, y_changed; - double reported_x, reported_y; - - tablet_event = libinput_event_get_tablet_tool_event(event); - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - x_changed = libinput_event_tablet_tool_x_has_changed( - tablet_event); - y_changed = libinput_event_tablet_tool_y_has_changed( - tablet_event); - - ck_assert(x_changed); - ck_assert(y_changed); - - reported_x = libinput_event_tablet_tool_get_x(tablet_event); - reported_y = libinput_event_tablet_tool_get_y(tablet_event); - - litest_assert_double_lt(reported_x, reported_y); - - last_reported_x = reported_x; - last_reported_y = reported_y; - - libinput_event_destroy(event); - event = libinput_get_event(li); - } while (event != NULL); - - for (test_x = 10, test_y = 90; - test_x <= 100; - test_x += 10, test_y -= 10) { - bool x_changed, y_changed; - double reported_x, reported_y; - - litest_tablet_motion(dev, test_x, test_y, axes); - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - tablet_event = libinput_event_get_tablet_tool_event(event); - type = libinput_event_get_type(event); - - if (type == LIBINPUT_EVENT_TABLET_TOOL_AXIS) { - x_changed = libinput_event_tablet_tool_x_has_changed( - tablet_event); - y_changed = libinput_event_tablet_tool_y_has_changed( - tablet_event); - - ck_assert(x_changed); - ck_assert(y_changed); - - reported_x = libinput_event_tablet_tool_get_x( - tablet_event); - reported_y = libinput_event_tablet_tool_get_y( - tablet_event); - - litest_assert_double_gt(reported_x, - last_reported_x); - litest_assert_double_lt(reported_y, - last_reported_y); - - last_reported_x = reported_x; - last_reported_y = reported_y; - } - - libinput_event_destroy(event); - } - } -} -END_TEST - -START_TEST(left_handed) -{ -#if HAVE_LIBWACOM - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - double libinput_max_x, libinput_max_y; - double last_x = -1.0, last_y = -1.0; - double x, y; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_drain_events(li); - - ck_assert(libinput_device_config_left_handed_is_available(dev->libinput_device)); - - libinput_device_get_size (dev->libinput_device, - &libinput_max_x, - &libinput_max_y); - - /* Test that left-handed mode doesn't go into effect until the tool has - * left proximity of the tablet. In order to test this, we have to bring - * the tool into proximity and make sure libinput processes the - * proximity events so that it updates it's internal tablet state, and - * then try setting it to left-handed mode. */ - litest_tablet_proximity_in(dev, 0, 100, axes); - libinput_dispatch(li); - libinput_device_config_left_handed_set(dev->libinput_device, 1); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - last_x = libinput_event_tablet_tool_get_x(tablet_event); - last_y = libinput_event_tablet_tool_get_y(tablet_event); - - litest_assert_double_eq(last_x, 0); - litest_assert_double_eq(last_y, libinput_max_y); - - libinput_event_destroy(event); - - /* work around smoothing */ - litest_axis_set_value(axes, ABS_DISTANCE, 9); - litest_tablet_motion(dev, 100, 0, axes); - litest_axis_set_value(axes, ABS_DISTANCE, 7); - litest_tablet_motion(dev, 100, 0, axes); - litest_axis_set_value(axes, ABS_DISTANCE, 10); - litest_tablet_motion(dev, 100, 0, axes); - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 5); - litest_tablet_motion(dev, 100, 0, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - x = libinput_event_tablet_tool_get_x(tablet_event); - y = libinput_event_tablet_tool_get_y(tablet_event); - - litest_assert_double_eq(x, libinput_max_x); - litest_assert_double_eq(y, 0); - - litest_assert_double_gt(x, last_x); - litest_assert_double_lt(y, last_y); - - libinput_event_destroy(event); - - litest_tablet_proximity_out(dev); - litest_drain_events(li); - - /* Since we've drained the events and libinput's aware the tool is out - * of proximity, it should have finally transitioned into left-handed - * mode, so the axes should be inverted once we bring it back into - * proximity */ - litest_tablet_proximity_in(dev, 0, 100, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - last_x = libinput_event_tablet_tool_get_x(tablet_event); - last_y = libinput_event_tablet_tool_get_y(tablet_event); - - litest_assert_double_eq(last_x, libinput_max_x); - litest_assert_double_eq(last_y, 0); - - libinput_event_destroy(event); - - /* work around smoothing */ - litest_axis_set_value(axes, ABS_DISTANCE, 9); - litest_tablet_motion(dev, 100, 0, axes); - litest_axis_set_value(axes, ABS_DISTANCE, 7); - litest_tablet_motion(dev, 100, 0, axes); - litest_axis_set_value(axes, ABS_DISTANCE, 10); - litest_tablet_motion(dev, 100, 0, axes); - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 5); - litest_tablet_motion(dev, 100, 0, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - x = libinput_event_tablet_tool_get_x(tablet_event); - y = libinput_event_tablet_tool_get_y(tablet_event); - - litest_assert_double_eq(x, 0); - litest_assert_double_eq(y, libinput_max_y); - - litest_assert_double_lt(x, last_x); - litest_assert_double_gt(y, last_y); - - libinput_event_destroy(event); -#endif -} -END_TEST - -START_TEST(no_left_handed) -{ - struct litest_device *dev = litest_current_device(); - - ck_assert(!libinput_device_config_left_handed_is_available(dev->libinput_device)); -} -END_TEST - -START_TEST(left_handed_tilt) -{ -#if HAVE_LIBWACOM - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - enum libinput_config_status status; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { ABS_TILT_X, 90 }, - { ABS_TILT_Y, 10 }, - { -1, -1 } - }; - double tx, ty; - - status = libinput_device_config_left_handed_set(dev->libinput_device, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 10, 10, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tx = libinput_event_tablet_tool_get_tilt_x(tev); - ty = libinput_event_tablet_tool_get_tilt_y(tev); - - ck_assert_double_lt(tx, 0); - ck_assert_double_gt(ty, 0); - - libinput_event_destroy(event); -#endif -} -END_TEST - -static inline double -rotate_event(struct litest_device *dev, int angle_degrees) -{ - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - const struct input_absinfo *abs; - double a = (angle_degrees - 90 - 175)/180.0 * M_PI; - double val; - int x, y; - int tilt_center_x, tilt_center_y; - - abs = libevdev_get_abs_info(dev->evdev, ABS_TILT_X); - ck_assert_notnull(abs); - tilt_center_x = (abs->maximum - abs->minimum + 1) / 2; - - abs = libevdev_get_abs_info(dev->evdev, ABS_TILT_Y); - ck_assert_notnull(abs); - tilt_center_y = (abs->maximum - abs->minimum + 1) / 2; - - x = cos(a) * 20 + tilt_center_x; - y = sin(a) * 20 + tilt_center_y; - - litest_event(dev, EV_ABS, ABS_TILT_X, x); - litest_event(dev, EV_ABS, ABS_TILT_Y, y); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - ck_assert(libinput_event_tablet_tool_rotation_has_changed(tev)); - val = libinput_event_tablet_tool_get_rotation(tev); - - libinput_event_destroy(event); - litest_assert_empty_queue(li); - - return val; -} - -START_TEST(left_handed_mouse_rotation) -{ -#if HAVE_LIBWACOM - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - enum libinput_config_status status; - int angle; - double val, old_val = 0; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { ABS_TILT_X, 0 }, - { ABS_TILT_Y, 0 }, - { -1, -1 } - }; - - if (!libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_TOOL_MOUSE)) - return; - - status = libinput_device_config_left_handed_set(dev->libinput_device, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - - litest_push_event_frame(dev); - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1); - litest_pop_event_frame(dev); - - litest_drain_events(li); - - /* cos/sin are 90 degrees offset from the north-is-zero that - libinput uses. 175 is the CCW offset in the mouse HW */ - for (angle = 185; angle < 540; angle += 5) { - int expected_angle = angle - 180; - - val = rotate_event(dev, angle % 360); - - /* rounding error galore, we can't test for anything more - precise than these */ - litest_assert_double_lt(val, 360.0); - litest_assert_double_gt(val, old_val); - litest_assert_double_lt(val, expected_angle + 5); - - old_val = val; - } -#endif -} -END_TEST - -START_TEST(left_handed_artpen_rotation) -{ -#if HAVE_LIBWACOM - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - const struct input_absinfo *abs; - enum libinput_config_status status; - double val; - double scale; - int angle; - - if (!libevdev_has_event_code(dev->evdev, - EV_ABS, - ABS_Z)) - return; - - status = libinput_device_config_left_handed_set(dev->libinput_device, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - - abs = libevdev_get_abs_info(dev->evdev, ABS_Z); - ck_assert_notnull(abs); - scale = (abs->maximum - abs->minimum + 1)/360.0; - - litest_event(dev, EV_KEY, BTN_TOOL_BRUSH, 1); - litest_event(dev, EV_ABS, ABS_MISC, 0x804); /* Art Pen */ - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_event(dev, EV_ABS, ABS_Z, abs->minimum); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_drain_events(li); - - for (angle = 188; angle < 540; angle += 8) { - int a = angle * scale + abs->minimum; - int expected_angle = angle - 180; - - litest_event(dev, EV_ABS, ABS_Z, a); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - ck_assert(libinput_event_tablet_tool_rotation_has_changed(tev)); - val = libinput_event_tablet_tool_get_rotation(tev); - - /* artpen has a 90 deg offset cw */ - ck_assert_int_eq(round(val), (expected_angle + 90) % 360); - - libinput_event_destroy(event); - litest_assert_empty_queue(li); - - } -#endif -} -END_TEST - -START_TEST(motion_event_state) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - int test_x, test_y; - double last_x, last_y; - - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_drain_events(li); - litest_tablet_proximity_in(dev, 5, 100, axes); - litest_drain_events(li); - - /* couple of events that go left/bottom to right/top */ - for (test_x = 0, test_y = 100; test_x < 100; test_x += 10, test_y -= 10) - litest_tablet_motion(dev, test_x, test_y, axes); - - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - last_x = libinput_event_tablet_tool_get_x(tablet_event); - last_y = libinput_event_tablet_tool_get_y(tablet_event); - - /* mark with a button event, then go back to bottom/left */ - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - for (test_x = 100, test_y = 0; test_x > 0; test_x -= 10, test_y += 10) - litest_tablet_motion(dev, test_x, test_y, axes); - - libinput_event_destroy(event); - libinput_dispatch(li); - ck_assert_int_eq(libinput_next_event_type(li), - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - /* we expect all events up to the button event to go from - bottom/left to top/right */ - while ((event = libinput_get_event(li))) { - double x, y; - - if (libinput_event_get_type(event) != LIBINPUT_EVENT_TABLET_TOOL_AXIS) - break; - - tablet_event = libinput_event_get_tablet_tool_event(event); - ck_assert_notnull(tablet_event); - - x = libinput_event_tablet_tool_get_x(tablet_event); - y = libinput_event_tablet_tool_get_y(tablet_event); - - ck_assert(x > last_x); - ck_assert(y < last_y); - - last_x = x; - last_y = y; - libinput_event_destroy(event); - } - - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(motion_outside_bounds) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - double val; - int i; - - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - litest_tablet_proximity_in(dev, 50, 50, axes); - litest_drain_events(li); - - /* Work around smoothing */ - for (i = 5; i > 0; i--) { - litest_event(dev, EV_ABS, ABS_X, 0 + 5 * i); - litest_event(dev, EV_ABS, ABS_Y, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - litest_drain_events(li); - - /* On the 24HD x/y of 0 is outside the limit */ - litest_event(dev, EV_ABS, ABS_X, 0); - litest_event(dev, EV_ABS, ABS_Y, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - val = libinput_event_tablet_tool_get_x(tablet_event); - ck_assert_double_lt(val, 0.0); - val = libinput_event_tablet_tool_get_y(tablet_event); - ck_assert_double_gt(val, 0.0); - - val = libinput_event_tablet_tool_get_x_transformed(tablet_event, 100); - ck_assert_double_lt(val, 0.0); - - libinput_event_destroy(event); - - /* Work around smoothing */ - for (i = 5; i > 0; i--) { - litest_event(dev, EV_ABS, ABS_X, 1000); - litest_event(dev, EV_ABS, ABS_Y, 0 + 5 * i); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - litest_drain_events(li); - - /* On the 24HD x/y of 0 is outside the limit */ - litest_event(dev, EV_ABS, ABS_X, 1000); - litest_event(dev, EV_ABS, ABS_Y, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - val = libinput_event_tablet_tool_get_x(tablet_event); - ck_assert_double_gt(val, 0.0); - val = libinput_event_tablet_tool_get_y(tablet_event); - ck_assert_double_lt(val, 0.0); - - val = libinput_event_tablet_tool_get_y_transformed(tablet_event, 100); - ck_assert_double_lt(val, 0.0); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(bad_distance_events) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - const struct input_absinfo *absinfo; - struct axis_replacement axes[] = { - { -1, -1 }, - }; - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_tablet_proximity_out(dev); - litest_drain_events(li); - - absinfo = libevdev_get_abs_info(dev->evdev, ABS_DISTANCE); - ck_assert(absinfo != NULL); - - litest_event(dev, EV_ABS, ABS_DISTANCE, absinfo->maximum); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_ABS, ABS_DISTANCE, absinfo->minimum); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(tool_unique) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_tablet_tool *tablet_event; - struct libinput_event *event; - struct libinput_tablet_tool *tool; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tablet_event); - ck_assert(libinput_tablet_tool_is_unique(tool)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tool_serial) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_tablet_tool *tablet_event; - struct libinput_event *event; - struct libinput_tablet_tool *tool; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tablet_event); - ck_assert_uint_eq(libinput_tablet_tool_get_serial(tool), 1000); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tool_id) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_tablet_tool *tablet_event; - struct libinput_event *event; - struct libinput_tablet_tool *tool; - uint64_t tool_id; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 10, 10, NULL); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tablet_event); - - ck_assert_int_eq(libinput_device_get_id_vendor(dev->libinput_device), - VENDOR_ID_WACOM); - - switch (libinput_device_get_id_product(dev->libinput_device)) { - case 0x27: /* Intuos 5 */ - tool_id = 1050626; - break; - case 0xc6: /* Cintiq 12WX */ - case 0xf4: /* Cintiq 24HD */ - case 0x333: /* Cintiq 13HD */ - tool_id = 2083; - break; - default: - ck_abort(); - } - - ck_assert(tool_id == libinput_tablet_tool_get_tool_id(tool)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(serial_changes_tool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_tablet_tool *tablet_event; - struct libinput_event *event; - struct libinput_tablet_tool *tool; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_MSC, MSC_SERIAL, 2000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tablet_event); - - ck_assert_uint_eq(libinput_tablet_tool_get_serial(tool), 2000); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(invalid_serials) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct libinput_tablet_tool *tool; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_MSC, MSC_SERIAL, -1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - while ((event = libinput_get_event(li))) { - if (libinput_event_get_type(event) == - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY) { - tablet_event = libinput_event_get_tablet_tool_event(event); - tool = libinput_event_tablet_tool_get_tool(tablet_event); - - ck_assert_uint_eq(libinput_tablet_tool_get_serial(tool), 1000); - } - - libinput_event_destroy(event); - } -} -END_TEST - -START_TEST(tool_ref) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_tablet_tool *tablet_event; - struct libinput_event *event; - struct libinput_tablet_tool *tool; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tablet_event); - - ck_assert_notnull(tool); - ck_assert(tool == libinput_tablet_tool_ref(tool)); - ck_assert(tool == libinput_tablet_tool_unref(tool)); - libinput_event_destroy(event); - - ck_assert(libinput_tablet_tool_unref(tool) == NULL); -} -END_TEST - -START_TEST(tool_user_data) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event_tablet_tool *tablet_event; - struct libinput_event *event; - struct libinput_tablet_tool *tool; - void *userdata = &dev; /* not dereferenced */ - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tablet_event); - ck_assert_notnull(tool); - - ck_assert(libinput_tablet_tool_get_user_data(tool) == NULL); - libinput_tablet_tool_set_user_data(tool, userdata); - ck_assert(libinput_tablet_tool_get_user_data(tool) == userdata); - libinput_tablet_tool_set_user_data(tool, NULL); - ck_assert(libinput_tablet_tool_get_user_data(tool) == NULL); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(pad_buttons_ignored) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - int button; - - litest_drain_events(li); - - for (button = BTN_0; button < BTN_MOUSE; button++) { - litest_event(dev, EV_KEY, button, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, button, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - - litest_assert_empty_queue(li); - - /* same thing while in prox */ - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_drain_events(li); - - for (button = BTN_0; button < BTN_MOUSE; button++) { - litest_event(dev, EV_KEY, button, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, button, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(tools_with_serials) -{ - struct libinput *li = litest_create_context(); - struct litest_device *dev[2]; - struct libinput_tablet_tool *tool[2] = {0}; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - int i; - - for (i = 0; i < 2; i++) { - dev[i] = litest_add_device(li, LITEST_WACOM_INTUOS); - litest_drain_events(li); - - /* WARNING: this test fails if UI_GET_SYSNAME isn't - * available or isn't used by libevdev (1.3, commit 2ff45c73). - * Put a sleep(1) here and that usually fixes it. - */ - - litest_push_event_frame(dev[i]); - litest_tablet_proximity_in(dev[i], 10, 10, NULL); - litest_event(dev[i], EV_MSC, MSC_SERIAL, 100); - litest_pop_event_frame(dev[i]); - - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool[i] = libinput_event_tablet_tool_get_tool(tev); - libinput_event_destroy(event); - } - - /* We should get the same object for both devices */ - ck_assert_notnull(tool[0]); - ck_assert_notnull(tool[1]); - ck_assert_ptr_eq(tool[0], tool[1]); - - litest_delete_device(dev[0]); - litest_delete_device(dev[1]); - libinput_unref(li); -} -END_TEST - -START_TEST(tools_without_serials) -{ - struct libinput *li = litest_create_context(); - struct litest_device *dev[2]; - struct libinput_tablet_tool *tool[2] = {0}; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - int i; - - for (i = 0; i < 2; i++) { - dev[i] = litest_add_device_with_overrides(li, - LITEST_WACOM_ISDV4, - NULL, - NULL, - NULL, - NULL); - - litest_drain_events(li); - - /* WARNING: this test fails if UI_GET_SYSNAME isn't - * available or isn't used by libevdev (1.3, commit 2ff45c73). - * Put a sleep(1) here and that usually fixes it. - */ - - litest_tablet_proximity_in(dev[i], 10, 10, NULL); - - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool[i] = libinput_event_tablet_tool_get_tool(tev); - libinput_event_destroy(event); - } - - /* We should get different tool objects for each device */ - ck_assert_notnull(tool[0]); - ck_assert_notnull(tool[1]); - ck_assert_ptr_ne(tool[0], tool[1]); - - litest_delete_device(dev[0]); - litest_delete_device(dev[1]); - libinput_unref(li); -} -END_TEST - -START_TEST(tool_delayed_serial) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct libinput_tablet_tool *tool; - unsigned int serial; - - litest_drain_events(li); - - litest_event(dev, EV_ABS, ABS_X, 4500); - litest_event(dev, EV_ABS, ABS_Y, 2000); - litest_event(dev, EV_MSC, MSC_SERIAL, 0); - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tev); - serial = libinput_tablet_tool_get_serial(tool); - ck_assert_int_eq(serial, 0); - libinput_event_destroy(event); - - for (int x = 4500; x < 8000; x += 1000) { - litest_event(dev, EV_ABS, ABS_X, x); - litest_event(dev, EV_ABS, ABS_Y, 2000); - litest_event(dev, EV_MSC, MSC_SERIAL, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - litest_drain_events(li); - - /* Now send the serial */ - litest_event(dev, EV_ABS, ABS_X, 4500); - litest_event(dev, EV_ABS, ABS_Y, 2000); - litest_event(dev, EV_MSC, MSC_SERIAL, 1234566); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - tool = libinput_event_tablet_tool_get_tool(tev); - serial = libinput_tablet_tool_get_serial(tool); - ck_assert_int_eq(serial, 0); - libinput_event_destroy(event); - - for (int x = 4500; x < 8000; x += 500) { - litest_event(dev, EV_ABS, ABS_X, x); - litest_event(dev, EV_ABS, ABS_Y, 2000); - litest_event(dev, EV_MSC, MSC_SERIAL, 1234566); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - - event = libinput_get_event(li); - do { - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - tool = libinput_event_tablet_tool_get_tool(tev); - serial = libinput_tablet_tool_get_serial(tool); - ck_assert_int_eq(serial, 0); - libinput_event_destroy(event); - event = libinput_get_event(li); - } while (event != NULL); - - /* Quirk: tool out event is a serial of 0 */ - litest_event(dev, EV_ABS, ABS_X, 4500); - litest_event(dev, EV_ABS, ABS_Y, 2000); - litest_event(dev, EV_MSC, MSC_SERIAL, 0); - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tev); - serial = libinput_tablet_tool_get_serial(tool); - ck_assert_int_eq(serial, 0); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tool_capability) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - - ck_assert(libinput_device_has_capability(device, - LIBINPUT_DEVICE_CAP_TABLET_TOOL)); -} -END_TEST - -START_TEST(tool_capabilities) -{ - struct libinput *li = litest_create_context(); - struct litest_device *intuos; - struct litest_device *bamboo; - struct libinput_event *event; - struct libinput_event_tablet_tool *t; - struct libinput_tablet_tool *tool; - - /* The axis capabilities of a tool can differ depending on the type of - * tablet the tool is being used with */ - bamboo = litest_add_device(li, LITEST_WACOM_BAMBOO); - intuos = litest_add_device(li, LITEST_WACOM_INTUOS); - litest_drain_events(li); - - litest_event(bamboo, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(bamboo, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - event = libinput_get_event(li); - t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(t); - - ck_assert(libinput_tablet_tool_has_pressure(tool)); - ck_assert(libinput_tablet_tool_has_distance(tool)); - ck_assert(!libinput_tablet_tool_has_tilt(tool)); - - libinput_event_destroy(event); - litest_assert_empty_queue(li); - - litest_event(intuos, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(intuos, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(t); - - ck_assert(libinput_tablet_tool_has_pressure(tool)); - ck_assert(libinput_tablet_tool_has_distance(tool)); - ck_assert(libinput_tablet_tool_has_tilt(tool)); - - libinput_event_destroy(event); - litest_assert_empty_queue(li); - - litest_delete_device(bamboo); - litest_delete_device(intuos); - libinput_unref(li); -} -END_TEST - -START_TEST(tool_type) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *t; - struct libinput_tablet_tool *tool; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { ABS_TILT_X, 0 }, - { ABS_TILT_Y, 0 }, - { -1, -1 } - }; - struct tool_type_match { - int code; - enum libinput_tablet_tool_type type; - } types[] = { - { BTN_TOOL_PEN, LIBINPUT_TABLET_TOOL_TYPE_PEN }, - { BTN_TOOL_RUBBER, LIBINPUT_TABLET_TOOL_TYPE_ERASER }, - { BTN_TOOL_BRUSH, LIBINPUT_TABLET_TOOL_TYPE_BRUSH }, - { BTN_TOOL_BRUSH, LIBINPUT_TABLET_TOOL_TYPE_BRUSH }, - { BTN_TOOL_PENCIL, LIBINPUT_TABLET_TOOL_TYPE_PENCIL }, - { BTN_TOOL_AIRBRUSH, LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH }, - { BTN_TOOL_MOUSE, LIBINPUT_TABLET_TOOL_TYPE_MOUSE }, - { BTN_TOOL_LENS, LIBINPUT_TABLET_TOOL_TYPE_LENS }, - { -1, -1 } - }; - struct tool_type_match *tt; - - litest_drain_events(li); - - for (tt = types; tt->code != -1; tt++) { - if (!libevdev_has_event_code(dev->evdev, - EV_KEY, - tt->code)) - continue; - - litest_push_event_frame(dev); - litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN); - litest_tablet_proximity_in(dev, 50, 50, axes); - litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN); - litest_event(dev, EV_KEY, tt->code, 1); - litest_pop_event_frame(dev); - libinput_dispatch(li); - - event = libinput_get_event(li); - t = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(t); - - ck_assert_int_eq(libinput_tablet_tool_get_type(tool), - tt->type); - - libinput_event_destroy(event); - litest_assert_empty_queue(li); - - litest_push_event_frame(dev); - litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN); - litest_tablet_proximity_out(dev); - litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN); - litest_event(dev, EV_KEY, tt->code, 0); - litest_pop_event_frame(dev); - litest_drain_events(li); - } -} -END_TEST - -START_TEST(tool_in_prox_before_start) -{ - struct libinput *li; - struct litest_device *dev = litest_current_device(); - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct libinput_tablet_tool *tool; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { ABS_TILT_X, 0 }, - { ABS_TILT_Y, 0 }, - { -1, -1 } - }; - const char *devnode; - unsigned int serial; - - litest_tablet_proximity_in(dev, 10, 10, axes); - - /* for simplicity, we create a new litest context */ - devnode = libevdev_uinput_get_devnode(dev->uinput); - li = litest_create_context(); - libinput_path_add_device(li, devnode); - - litest_wait_for_event_of_type(li, - LIBINPUT_EVENT_DEVICE_ADDED, - -1); - event = libinput_get_event(li); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - - litest_tablet_motion(dev, 10, 20, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tev); - serial = libinput_tablet_tool_get_serial(tool); - libinput_event_destroy(event); - - litest_tablet_motion(dev, 30, 40, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - tool = libinput_event_tablet_tool_get_tool(tev); - ck_assert_int_eq(serial, - libinput_tablet_tool_get_serial(tool)); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_STYLUS, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_TABLET_TOOL_BUTTON); - litest_tablet_proximity_out(dev); - libinput_dispatch(li); - - litest_timeout_tablet_proxout(); - libinput_dispatch(li); - - litest_wait_for_event_of_type(li, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY, - -1); - libinput_unref(li); -} -END_TEST - -START_TEST(mouse_tool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct libinput_tablet_tool *tool; - - if (!libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_TOOL_MOUSE)) - return; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1); - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tev); - ck_assert_notnull(tool); - ck_assert_int_eq(libinput_tablet_tool_get_type(tool), - LIBINPUT_TABLET_TOOL_TYPE_MOUSE); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(mouse_buttons) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct libinput_tablet_tool *tool; - int code; - - if (!libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_TOOL_MOUSE)) - return; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1); - litest_event(dev, EV_ABS, ABS_MISC, 0x806); /* 5-button mouse tool_id */ - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tev); - ck_assert_notnull(tool); - libinput_tablet_tool_ref(tool); - - libinput_event_destroy(event); - - for (code = BTN_LEFT; code <= BTN_TASK; code++) { - bool has_button = libevdev_has_event_code(dev->evdev, - EV_KEY, - code); - ck_assert_int_eq(!!has_button, - !!libinput_tablet_tool_has_button(tool, code)); - - if (!has_button) - continue; - - litest_event(dev, EV_KEY, code, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_event(dev, EV_KEY, code, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_assert_tablet_button_event(li, - code, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_tablet_button_event(li, - code, - LIBINPUT_BUTTON_STATE_RELEASED); - } - - libinput_tablet_tool_unref(tool); -} -END_TEST - -START_TEST(mouse_rotation) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int angle; - double val, old_val = 0; - - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { ABS_TILT_X, 0 }, - { ABS_TILT_Y, 0 }, - { -1, -1 } - }; - - if (!libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_TOOL_MOUSE)) - return; - - litest_drain_events(li); - - litest_push_event_frame(dev); - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1); - litest_pop_event_frame(dev); - - litest_drain_events(li); - - /* cos/sin are 90 degrees offset from the north-is-zero that - libinput uses. 175 is the CCW offset in the mouse HW */ - for (angle = 5; angle < 360; angle += 5) { - val = rotate_event(dev, angle); - - /* rounding error galore, we can't test for anything more - precise than these */ - litest_assert_double_lt(val, 360.0); - litest_assert_double_gt(val, old_val); - litest_assert_double_lt(val, angle + 5); - - old_val = val; - } -} -END_TEST - -START_TEST(mouse_wheel) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct libinput_tablet_tool *tool; - const struct input_absinfo *abs; - double val; - int i; - - if (!libevdev_has_event_code(dev->evdev, - EV_REL, - REL_WHEEL)) - return; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1); - litest_event(dev, EV_ABS, ABS_MISC, 0x806); /* 5-button mouse tool_id */ - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tev); - ck_assert_notnull(tool); - libinput_tablet_tool_ref(tool); - - libinput_event_destroy(event); - - ck_assert(libinput_tablet_tool_has_wheel(tool)); - - for (i = 0; i < 3; i++) { - litest_event(dev, EV_REL, REL_WHEEL, -1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - ck_assert(libinput_event_tablet_tool_wheel_has_changed(tev)); - - val = libinput_event_tablet_tool_get_wheel_delta(tev); - ck_assert_int_eq(val, 15); - - val = libinput_event_tablet_tool_get_wheel_delta_discrete(tev); - ck_assert_int_eq(val, 1); - - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - } - - for (i = 2; i < 5; i++) { - /* send x/y events to make sure we reset the wheel */ - abs = libevdev_get_abs_info(dev->evdev, ABS_X); - litest_event(dev, EV_ABS, ABS_X, (abs->maximum - abs->minimum)/i); - abs = libevdev_get_abs_info(dev->evdev, ABS_Y); - litest_event(dev, EV_ABS, ABS_Y, (abs->maximum - abs->minimum)/i); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - ck_assert(!libinput_event_tablet_tool_wheel_has_changed(tev)); - - val = libinput_event_tablet_tool_get_wheel_delta(tev); - ck_assert_int_eq(val, 0); - - val = libinput_event_tablet_tool_get_wheel_delta_discrete(tev); - ck_assert_int_eq(val, 0); - - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - } - - libinput_tablet_tool_unref(tool); -} -END_TEST - -START_TEST(airbrush_tool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct libinput_tablet_tool *tool; - - if (!libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_TOOL_AIRBRUSH)) - return; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_AIRBRUSH, 1); - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tev); - - ck_assert_notnull(tool); - ck_assert_int_eq(libinput_tablet_tool_get_type(tool), - LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH); - - ck_assert(libinput_tablet_tool_has_slider(tool)); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(airbrush_slider) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - const struct input_absinfo *abs; - double val; - double scale; - double expected; - int v; - - if (!libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_TOOL_AIRBRUSH)) - return; - - litest_drain_events(li); - - abs = libevdev_get_abs_info(dev->evdev, ABS_WHEEL); - ck_assert_notnull(abs); - - litest_event(dev, EV_KEY, BTN_TOOL_AIRBRUSH, 1); - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - /* start with non-zero */ - litest_event(dev, EV_ABS, ABS_WHEEL, 10); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_drain_events(li); - - scale = abs->maximum - abs->minimum; - for (v = abs->minimum; v < abs->maximum; v += 8) { - litest_event(dev, EV_ABS, ABS_WHEEL, v); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - ck_assert(libinput_event_tablet_tool_slider_has_changed(tev)); - val = libinput_event_tablet_tool_get_slider_position(tev); - - expected = ((v - abs->minimum)/scale) * 2 - 1; - ck_assert_double_eq(val, expected); - ck_assert_double_ge(val, -1.0); - ck_assert_double_le(val, 1.0); - libinput_event_destroy(event); - litest_assert_empty_queue(li); - } -} -END_TEST - -START_TEST(artpen_tool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct libinput_tablet_tool *tool; - - if (!libevdev_has_event_code(dev->evdev, - EV_ABS, - ABS_Z)) - return; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_ABS, ABS_MISC, 0x804); /* Art Pen */ - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - tool = libinput_event_tablet_tool_get_tool(tev); - ck_assert_notnull(tool); - ck_assert_int_eq(libinput_tablet_tool_get_type(tool), - LIBINPUT_TABLET_TOOL_TYPE_PEN); - ck_assert(libinput_tablet_tool_has_rotation(tool)); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(artpen_rotation) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - const struct input_absinfo *abs; - double val; - double scale; - int angle; - - if (!libevdev_has_event_code(dev->evdev, - EV_ABS, - ABS_Z)) - return; - - litest_drain_events(li); - - abs = libevdev_get_abs_info(dev->evdev, ABS_Z); - ck_assert_notnull(abs); - scale = (abs->maximum - abs->minimum + 1)/360.0; - - litest_event(dev, EV_KEY, BTN_TOOL_BRUSH, 1); - litest_event(dev, EV_ABS, ABS_MISC, 0x804); /* Art Pen */ - litest_event(dev, EV_MSC, MSC_SERIAL, 1000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_event(dev, EV_ABS, ABS_Z, abs->minimum); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_drain_events(li); - - for (angle = 8; angle < 360; angle += 8) { - int a = angle * scale + abs->minimum; - - litest_event(dev, EV_ABS, ABS_Z, a); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - ck_assert(libinput_event_tablet_tool_rotation_has_changed(tev)); - val = libinput_event_tablet_tool_get_rotation(tev); - - /* artpen has a 90 deg offset cw */ - ck_assert_int_eq(round(val), (angle + 90) % 360); - - libinput_event_destroy(event); - litest_assert_empty_queue(li); - - } -} -END_TEST - -START_TEST(tablet_time_usec) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - uint64_t time_usec; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 5, 100, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - time_usec = libinput_event_tablet_tool_get_time_usec(tev); - ck_assert_int_eq(libinput_event_tablet_tool_get_time(tev), - (uint32_t) (time_usec / 1000)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tablet_pressure_distance_exclusive) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 }, - }; - double pressure, distance; - - litest_tablet_proximity_in(dev, 5, 100, axes); - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_PRESSURE, 2); - litest_tablet_motion(dev, 70, 70, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - pressure = libinput_event_tablet_tool_get_pressure(tev); - distance = libinput_event_tablet_tool_get_distance(tev); - - ck_assert_double_ne(pressure, 0.0); - ck_assert_double_eq(distance, 0.0); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tablet_calibration_has_matrix) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - enum libinput_config_status status; - int rc; - float calibration[6] = {1, 0, 0, 0, 1, 0}; - int has_calibration; - - has_calibration = libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT); - - rc = libinput_device_config_calibration_has_matrix(d); - ck_assert_int_eq(rc, has_calibration); - rc = libinput_device_config_calibration_get_matrix(d, calibration); - ck_assert_int_eq(rc, 0); - rc = libinput_device_config_calibration_get_default_matrix(d, - calibration); - ck_assert_int_eq(rc, 0); - - status = libinput_device_config_calibration_set_matrix(d, - calibration); - if (has_calibration) - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - else - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); -} -END_TEST - -START_TEST(tablet_calibration_set_matrix_delta) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *d = dev->libinput_device; - enum libinput_config_status status; - float calibration[6] = {0.5, 0, 0, 0, 0.5, 0}; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 0 }, - { ABS_PRESSURE, 10 }, - { -1, -1 } - }; - int has_calibration; - double x, y, dx, dy, mdx, mdy; - - has_calibration = libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT); - if (!has_calibration) - return; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 100, 100, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - x = libinput_event_tablet_tool_get_x(tablet_event); - y = libinput_event_tablet_tool_get_y(tablet_event); - libinput_event_destroy(event); - - event = libinput_get_event(li); - litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_TIP); - libinput_event_destroy(event); - - litest_tablet_motion(dev, 80, 80, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - dx = libinput_event_tablet_tool_get_x(tablet_event) - x; - dy = libinput_event_tablet_tool_get_y(tablet_event) - y; - libinput_event_destroy(event); - litest_tablet_proximity_out(dev); - litest_drain_events(li); - - status = libinput_device_config_calibration_set_matrix(d, - calibration); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_tablet_proximity_in(dev, 100, 100, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - x = libinput_event_tablet_tool_get_x(tablet_event); - y = libinput_event_tablet_tool_get_y(tablet_event); - libinput_event_destroy(event); - - event = libinput_get_event(li); - litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_TIP); - libinput_event_destroy(event); - - litest_tablet_motion(dev, 80, 80, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - mdx = libinput_event_tablet_tool_get_x(tablet_event) - x; - mdy = libinput_event_tablet_tool_get_y(tablet_event) - y; - libinput_event_destroy(event); - litest_drain_events(li); - - ck_assert_double_gt(dx, mdx * 2 - 1); - ck_assert_double_lt(dx, mdx * 2 + 1); - ck_assert_double_gt(dy, mdy * 2 - 1); - ck_assert_double_lt(dy, mdy * 2 + 1); -} -END_TEST - -START_TEST(tablet_calibration_set_matrix) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *d = dev->libinput_device; - enum libinput_config_status status; - float calibration[6] = {0.5, 0, 0, 0, 1, 0}; - struct libinput_event *event; - struct libinput_event_tablet_tool *tablet_event; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - int has_calibration; - double x, y; - - has_calibration = libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT); - if (!has_calibration) - return; - - litest_drain_events(li); - - status = libinput_device_config_calibration_set_matrix(d, - calibration); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_tablet_proximity_in(dev, 100, 100, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - x = libinput_event_tablet_tool_get_x_transformed(tablet_event, 100); - y = libinput_event_tablet_tool_get_y_transformed(tablet_event, 100); - libinput_event_destroy(event); - - ck_assert_double_gt(x, 49.0); - ck_assert_double_lt(x, 51.0); - ck_assert_double_gt(y, 99.0); - ck_assert_double_lt(y, 100.0); - - litest_tablet_proximity_out(dev); - libinput_dispatch(li); - litest_tablet_proximity_in(dev, 50, 50, axes); - litest_tablet_proximity_out(dev); - litest_drain_events(li); - - calibration[0] = 1; - calibration[4] = 0.5; - status = libinput_device_config_calibration_set_matrix(d, - calibration); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_tablet_proximity_in(dev, 100, 100, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tablet_event = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - x = libinput_event_tablet_tool_get_x_transformed(tablet_event, 100); - y = libinput_event_tablet_tool_get_y_transformed(tablet_event, 100); - libinput_event_destroy(event); - - ck_assert(x > 99.0); - ck_assert(x < 100.0); - ck_assert(y > 49.0); - ck_assert(y < 51.0); - - litest_tablet_proximity_out(dev); -} -END_TEST - -START_TEST(tablet_pressure_offset) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 70 }, - { ABS_PRESSURE, 20 }, - { -1, -1 }, - }; - double pressure; - - litest_tablet_proximity_in(dev, 5, 100, axes); - litest_drain_events(li); - - /* Put the pen down, with a pressure high enough to meet the - * threshold */ - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_axis_set_value(axes, ABS_PRESSURE, 25); - - litest_push_event_frame(dev); - litest_tablet_motion(dev, 70, 70, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - libinput_dispatch(li); - litest_drain_events(li); - - /* Reduce pressure to just a tick over the offset, otherwise we get - * the tip up event again */ - litest_axis_set_value(axes, ABS_PRESSURE, 20.1); - litest_tablet_motion(dev, 70, 70, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - pressure = libinput_event_tablet_tool_get_pressure(tev); - - /* we can't actually get a real 0.0 because that would trigger a tip - * up. but it's close enough to zero that ck_assert_double_eq won't - * notice */ - ck_assert_double_eq(pressure, 0.0); - - libinput_event_destroy(event); - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_PRESSURE, 21); - litest_tablet_motion(dev, 70, 70, axes); - - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - pressure = libinput_event_tablet_tool_get_pressure(tev); - - /* can't use the double_eq here, the pressure value is too tiny */ - ck_assert(pressure > 0.0); - ck_assert(pressure < 1.0); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tablet_pressure_offset_decrease) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 70 }, - { ABS_PRESSURE, 20 }, - { -1, -1 }, - }; - double pressure; - - /* offset 20 on prox in */ - litest_tablet_proximity_in(dev, 5, 100, axes); - litest_tablet_proximity_out(dev); - litest_drain_events(li); - - /* a reduced pressure value must reduce the offset */ - litest_axis_set_value(axes, ABS_PRESSURE, 10); - litest_tablet_proximity_in(dev, 5, 100, axes); - litest_tablet_proximity_out(dev); - litest_drain_events(li); - - /* a reduced pressure value must reduce the offset */ - litest_tablet_proximity_in(dev, 5, 100, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - pressure = libinput_event_tablet_tool_get_pressure(tev); - ck_assert_double_eq(pressure, 0.0); - - libinput_event_destroy(event); - litest_drain_events(li); - - /* trigger the pressure threshold */ - litest_axis_set_value(axes, ABS_PRESSURE, 15); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 70, 70, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - - pressure = libinput_event_tablet_tool_get_pressure(tev); - - /* can't use the double_eq here, the pressure value is too tiny */ - ck_assert(pressure > 0.0); - ck_assert(pressure < 1.0); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tablet_pressure_offset_increase) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 70 }, - { ABS_PRESSURE, 20 }, - { -1, -1 }, - }; - double pressure; - - /* offset 20 on first prox in */ - litest_tablet_proximity_in(dev, 5, 100, axes); - litest_tablet_proximity_out(dev); - litest_drain_events(li); - - /* offset 30 on second prox in - must not change the offset */ - litest_axis_set_value(axes, ABS_PRESSURE, 30); - litest_tablet_proximity_in(dev, 5, 100, axes); - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_axis_set_value(axes, ABS_PRESSURE, 31); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 70, 70, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - libinput_dispatch(li); - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_PRESSURE, 30); - litest_tablet_motion(dev, 70, 70, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - pressure = libinput_event_tablet_tool_get_pressure(tev); - /* can't use the double_eq here, the pressure value is too tiny */ - ck_assert(pressure > 0.0); - ck_assert(pressure < 1.0); - libinput_event_destroy(event); - - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_PRESSURE, 20); - litest_tablet_motion(dev, 70, 70, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_TIP); - - pressure = libinput_event_tablet_tool_get_pressure(tev); - - ck_assert_double_eq(pressure, 0.0); - libinput_event_destroy(event); -} -END_TEST - -static void pressure_threshold_warning(struct libinput *libinput, - enum libinput_log_priority priority, - const char *format, - va_list args) -{ - int *warning_triggered = (int*)libinput_get_user_data(libinput); - - if (priority == LIBINPUT_LOG_PRIORITY_ERROR && - strstr(format, "pressure offset greater")) - (*warning_triggered)++; -} - -START_TEST(tablet_pressure_min_max) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 0 }, - { ABS_PRESSURE, 2 }, - { -1, -1 }, - }; - double p; - - litest_tablet_proximity_in(dev, 5, 100, axes); - litest_drain_events(li); - libinput_dispatch(li); - - litest_axis_set_value(axes, ABS_PRESSURE, 0); - litest_tablet_motion(dev, 5, 100, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS); - ck_assert(libinput_event_tablet_tool_pressure_has_changed(tev)); - p = libinput_event_tablet_tool_get_pressure(tev); - ck_assert_double_ge(p, 0.0); - libinput_event_destroy(event); - - /* skip over pressure-based tip down */ - litest_axis_set_value(axes, ABS_PRESSURE, 90); - litest_tablet_motion(dev, 5, 100, axes); - litest_drain_events(li); - - /* need to fill the motion history */ - litest_axis_set_value(axes, ABS_PRESSURE, 100); - litest_tablet_motion(dev, 5, 100, axes); - litest_tablet_motion(dev, 6, 100, axes); - litest_tablet_motion(dev, 7, 100, axes); - litest_tablet_motion(dev, 8, 100, axes); - litest_drain_events(li); - - litest_tablet_motion(dev, 5, 100, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS); - p = libinput_event_tablet_tool_get_pressure(tev); - ck_assert_double_ge(p, 1.0); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tablet_pressure_range) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 0 }, - { ABS_PRESSURE, 10 }, - { -1, -1 }, - }; - int pressure; - double p; - - litest_tablet_proximity_in(dev, 5, 100, axes); - litest_drain_events(li); - libinput_dispatch(li); - - for (pressure = 10; pressure <= 100; pressure += 10) { - litest_axis_set_value(axes, ABS_PRESSURE, pressure); - litest_tablet_motion(dev, 70, 70, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS); - p = libinput_event_tablet_tool_get_pressure(tev); - ck_assert_double_ge(p, 0.0); - ck_assert_double_le(p, 1.0); - libinput_event_destroy(event); - } -} -END_TEST - -START_TEST(tablet_pressure_offset_exceed_threshold) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 70 }, - { ABS_PRESSURE, 30 }, - { -1, -1 }, - }; - double pressure; - int warning_triggered = 0; - - litest_drain_events(li); - - libinput_set_user_data(li, &warning_triggered); - - libinput_log_set_handler(li, pressure_threshold_warning); - litest_tablet_proximity_in(dev, 5, 100, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - pressure = libinput_event_tablet_tool_get_pressure(tev); - ck_assert_double_gt(pressure, 0.0); - libinput_event_destroy(event); - - ck_assert_int_eq(warning_triggered, 1); - litest_restore_log_handler(li); -} -END_TEST - -START_TEST(tablet_pressure_offset_none_for_zero_distance) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 0 }, - { ABS_PRESSURE, 20 }, - { -1, -1 }, - }; - double pressure; - - litest_drain_events(li); - - /* we're going straight to touch on proximity, make sure we don't - * offset the pressure here */ - litest_push_event_frame(dev); - litest_tablet_proximity_in(dev, 5, 100, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - pressure = libinput_event_tablet_tool_get_pressure(tev); - ck_assert_double_gt(pressure, 0.0); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tablet_pressure_offset_none_for_small_distance) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 20 }, - { ABS_PRESSURE, 20 }, - { -1, -1 }, - }; - double pressure; - - /* stylus too close to the tablet on the proximity in, ignore any - * pressure offset */ - litest_tablet_proximity_in(dev, 5, 100, axes); - litest_drain_events(li); - libinput_dispatch(li); - - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_axis_set_value(axes, ABS_PRESSURE, 21); - litest_push_event_frame(dev); - litest_tablet_motion(dev, 70, 70, axes); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_pop_event_frame(dev); - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_PRESSURE, 20); - litest_tablet_motion(dev, 70, 70, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS); - pressure = libinput_event_tablet_tool_get_pressure(tev); - ck_assert_double_gt(pressure, 0.0); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tablet_distance_range) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 20 }, - { ABS_PRESSURE, 0 }, - { -1, -1 }, - }; - int distance; - double dist; - - litest_tablet_proximity_in(dev, 5, 100, axes); - litest_drain_events(li); - libinput_dispatch(li); - - for (distance = 0; distance <= 100; distance += 10) { - litest_axis_set_value(axes, ABS_DISTANCE, distance); - litest_tablet_motion(dev, 70, 70, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS); - dist = libinput_event_tablet_tool_get_distance(tev); - ck_assert_double_ge(dist, 0.0); - ck_assert_double_le(dist, 1.0); - libinput_event_destroy(event); - } -} -END_TEST - -START_TEST(tilt_available) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct libinput_tablet_tool *tool; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { ABS_TILT_X, 80 }, - { ABS_TILT_Y, 20 }, - { -1, -1 } - }; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 10, 10, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - tool = libinput_event_tablet_tool_get_tool(tev); - ck_assert(libinput_tablet_tool_has_tilt(tool)); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tilt_not_available) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct libinput_tablet_tool *tool; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { ABS_TILT_X, 80 }, - { ABS_TILT_Y, 20 }, - { -1, -1 } - }; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 10, 10, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - tool = libinput_event_tablet_tool_get_tool(tev); - ck_assert(!libinput_tablet_tool_has_tilt(tool)); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(tilt_x) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { ABS_TILT_X, 10 }, - { ABS_TILT_Y, 0 }, - { -1, -1 } - }; - double tx, ty; - int tilt; - double expected_tx; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 10, 10, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - /* 90% of the actual axis but mapped into a [-64, 64] tilt range, so - * we expect 51 degrees ± rounding errors */ - tx = libinput_event_tablet_tool_get_tilt_x(tev); - ck_assert_double_le(tx, -50); - ck_assert_double_ge(tx, -52); - - ty = libinput_event_tablet_tool_get_tilt_y(tev); - ck_assert_double_ge(ty, -65); - ck_assert_double_lt(ty, -63); - - libinput_event_destroy(event); - - expected_tx = -64.0; - - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_axis_set_value(axes, ABS_PRESSURE, 1); - - for (tilt = 0; tilt <= 100; tilt += 5) { - litest_axis_set_value(axes, ABS_TILT_X, tilt); - /* work around smoothing */ - litest_tablet_motion(dev, 10, 10, axes); - litest_tablet_motion(dev, 10, 11, axes); - litest_tablet_motion(dev, 10, 10, axes); - litest_drain_events(li); - litest_tablet_motion(dev, 10, 11, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - tx = libinput_event_tablet_tool_get_tilt_x(tev); - ck_assert_double_ge(tx, expected_tx - 2); - ck_assert_double_le(tx, expected_tx + 2); - - ty = libinput_event_tablet_tool_get_tilt_y(tev); - ck_assert_double_ge(ty, -65); - ck_assert_double_lt(ty, -63); - - libinput_event_destroy(event); - - expected_tx = tx + 6.04; - } - - /* the last event must reach the max */ - ck_assert_double_ge(tx, 63.0); - ck_assert_double_le(tx, 64.0); -} -END_TEST - -START_TEST(tilt_y) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { ABS_TILT_X, 0 }, - { ABS_TILT_Y, 10 }, - { -1, -1 } - }; - double tx, ty; - int tilt; - double expected_ty; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 10, 10, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - /* 90% of the actual axis but mapped into a [-64, 64] tilt range, so - * we expect 50 degrees ± rounding errors */ - ty = libinput_event_tablet_tool_get_tilt_y(tev); - ck_assert_double_le(ty, -50); - ck_assert_double_ge(ty, -52); - - tx = libinput_event_tablet_tool_get_tilt_x(tev); - ck_assert_double_ge(tx, -65); - ck_assert_double_lt(tx, -63); - - libinput_event_destroy(event); - - expected_ty = -64; - - litest_axis_set_value(axes, ABS_DISTANCE, 0); - litest_axis_set_value(axes, ABS_PRESSURE, 1); - - for (tilt = 0; tilt <= 100; tilt += 5) { - litest_axis_set_value(axes, ABS_TILT_Y, tilt); - /* work around smoothing */ - litest_tablet_motion(dev, 10, 11, axes); - litest_tablet_motion(dev, 10, 10, axes); - litest_tablet_motion(dev, 10, 11, axes); - litest_drain_events(li); - litest_tablet_motion(dev, 10, 10, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - ty = libinput_event_tablet_tool_get_tilt_y(tev); - ck_assert_double_ge(ty, expected_ty - 2); - ck_assert_double_le(ty, expected_ty + 2); - - tx = libinput_event_tablet_tool_get_tilt_x(tev); - ck_assert_double_ge(tx, -65); - ck_assert_double_lt(tx, -63); - - libinput_event_destroy(event); - - expected_ty = ty + 6; - } - - /* the last event must reach the max */ - ck_assert_double_ge(ty, 63.0); - ck_assert_double_le(tx, 64.0); -} -END_TEST - -START_TEST(relative_no_profile) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_accel_profile profile; - enum libinput_config_status status; - uint32_t profiles; - - ck_assert(libinput_device_config_accel_is_available(device)); - - profile = libinput_device_config_accel_get_default_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); - - profile = libinput_device_config_accel_get_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); - - profiles = libinput_device_config_accel_get_profiles(device); - ck_assert_int_eq(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE, 0); - ck_assert_int_eq(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT, 0); - - status = libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - profile = libinput_device_config_accel_get_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); - - status = libinput_device_config_accel_set_profile(device, - LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - profile = libinput_device_config_accel_get_profile(device); - ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE); -} -END_TEST - -START_TEST(relative_no_delta_prox_in) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - double dx, dy; - - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 10, 10, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - dx = libinput_event_tablet_tool_get_dx(tev); - dy = libinput_event_tablet_tool_get_dy(tev); - ck_assert(dx == 0.0); - ck_assert(dy == 0.0); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(relative_delta) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - double dx, dy; - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_drain_events(li); - - litest_tablet_motion(dev, 20, 10, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - dx = libinput_event_tablet_tool_get_dx(tev); - dy = libinput_event_tablet_tool_get_dy(tev); - ck_assert(dx > 0.0); - ck_assert(dy == 0.0); - libinput_event_destroy(event); - - litest_tablet_motion(dev, 5, 10, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - dx = libinput_event_tablet_tool_get_dx(tev); - dy = libinput_event_tablet_tool_get_dy(tev); - ck_assert(dx < 0.0); - ck_assert(dy == 0.0); - libinput_event_destroy(event); - - litest_tablet_motion(dev, 10, 20, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - dx = libinput_event_tablet_tool_get_dx(tev); - dy = libinput_event_tablet_tool_get_dy(tev); - ck_assert(dx == 0.0); - ck_assert(dy > 0.0); - libinput_event_destroy(event); - - litest_tablet_motion(dev, 10, 5, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - dx = libinput_event_tablet_tool_get_dx(tev); - dy = libinput_event_tablet_tool_get_dy(tev); - ck_assert(dx == 0.0); - ck_assert(dy < 0.0); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(relative_calibration) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_tablet_tool *tev; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - double dx, dy; - float calibration[] = { -1, 0, 1, 0, -1, 1 }; - enum libinput_config_status status; - - if (!libinput_device_config_calibration_has_matrix(dev->libinput_device)) - return; - - status = libinput_device_config_calibration_set_matrix( - dev->libinput_device, - calibration); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_drain_events(li); - - litest_tablet_motion(dev, 20, 10, axes); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - dx = libinput_event_tablet_tool_get_dx(tev); - dy = libinput_event_tablet_tool_get_dy(tev); - ck_assert(dx < 0.0); - ck_assert(dy == 0.0); - libinput_event_destroy(event); - - litest_tablet_motion(dev, 5, 10, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - dx = libinput_event_tablet_tool_get_dx(tev); - dy = libinput_event_tablet_tool_get_dy(tev); - ck_assert(dx > 0.0); - ck_assert(dy == 0.0); - libinput_event_destroy(event); - - litest_tablet_motion(dev, 10, 20, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - dx = libinput_event_tablet_tool_get_dx(tev); - dy = libinput_event_tablet_tool_get_dy(tev); - ck_assert(dx == 0.0); - ck_assert(dy < 0.0); - libinput_event_destroy(event); - - litest_tablet_motion(dev, 10, 5, axes); - libinput_dispatch(li); - event = libinput_get_event(li); - tev = litest_is_tablet_event(event, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - dx = libinput_event_tablet_tool_get_dx(tev); - dy = libinput_event_tablet_tool_get_dy(tev); - ck_assert(dx == 0.0); - ck_assert(dy > 0.0); - libinput_event_destroy(event); -} -END_TEST - -static void -touch_arbitration(struct litest_device *dev, - enum litest_device_type other, - bool is_touchpad) -{ - struct litest_device *finger; - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - finger = litest_add_device(li, other); - litest_drain_events(li); - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_tablet_motion(dev, 10, 10, axes); - litest_tablet_motion(dev, 20, 40, axes); - litest_drain_events(li); - - litest_touch_down(finger, 0, 30, 30); - litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10, 1); - litest_assert_empty_queue(li); - - litest_tablet_motion(dev, 10, 10, axes); - litest_tablet_motion(dev, 20, 40, axes); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - litest_tablet_proximity_out(dev); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY); - - /* finger still down */ - litest_touch_move_to(finger, 0, 80, 80, 30, 30, 10, 1); - litest_touch_up(finger, 0); - litest_assert_empty_queue(li); - - /* lift finger, expect expect events */ - litest_touch_down(finger, 0, 30, 30); - litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10, 1); - litest_touch_up(finger, 0); - libinput_dispatch(li); - - if (is_touchpad) - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - else - litest_assert_touch_sequence(li); - - litest_delete_device(finger); -} - -START_TEST(intuos_touch_arbitration) -{ - touch_arbitration(litest_current_device(), LITEST_WACOM_FINGER, true); -} -END_TEST - -START_TEST(cintiq_touch_arbitration) -{ - touch_arbitration(litest_current_device(), - LITEST_WACOM_CINTIQ_13HDT_FINGER, - false); -} -END_TEST - -static void -touch_arbitration_stop_touch(struct litest_device *dev, - enum litest_device_type other, - bool is_touchpad) -{ - struct litest_device *finger; - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - finger = litest_add_device(li, other); - litest_touch_down(finger, 0, 30, 30); - litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10, 1); - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_tablet_motion(dev, 10, 10, axes); - litest_tablet_motion(dev, 20, 40, axes); - litest_drain_events(li); - - litest_touch_move_to(finger, 0, 80, 80, 30, 30, 10, 1); - /* start another finger to make sure that one doesn't send events - either */ - litest_touch_down(finger, 1, 30, 30); - litest_touch_move_to(finger, 1, 30, 30, 80, 80, 10, 1); - litest_assert_empty_queue(li); - - litest_tablet_motion(dev, 10, 10, axes); - litest_tablet_motion(dev, 20, 40, axes); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - litest_tablet_proximity_out(dev); - litest_drain_events(li); - - /* Finger needs to be lifted for events to happen*/ - litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10, 1); - litest_assert_empty_queue(li); - litest_touch_move_to(finger, 1, 80, 80, 30, 30, 10, 1); - litest_assert_empty_queue(li); - litest_touch_up(finger, 0); - litest_touch_move_to(finger, 1, 30, 30, 80, 80, 10, 1); - litest_assert_empty_queue(li); - litest_touch_up(finger, 1); - litest_touch_down(finger, 0, 30, 30); - litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10, 1); - litest_touch_up(finger, 0); - libinput_dispatch(li); - - if (is_touchpad) - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - else - litest_assert_touch_sequence(li); - - litest_delete_device(finger); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); -} - -START_TEST(intuos_touch_arbitration_stop_touch) -{ - touch_arbitration_stop_touch(litest_current_device(), - LITEST_WACOM_FINGER, - true); -} -END_TEST - -START_TEST(cintiq_touch_arbitration_stop_touch) -{ - touch_arbitration_stop_touch(litest_current_device(), - LITEST_WACOM_CINTIQ_13HDT_FINGER, - false); -} -END_TEST - -static void -touch_arbitration_suspend_touch(struct litest_device *dev, - enum litest_device_type other, - bool is_touchpad) -{ - struct litest_device *tablet; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - tablet = litest_add_device(li, other); - - /* we can't force a device suspend, but we can at least make sure - the device doesn't send events */ - status = libinput_device_config_send_events_set_mode( - dev->libinput_device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - - litest_tablet_proximity_in(tablet, 10, 10, axes); - litest_tablet_motion(tablet, 10, 10, axes); - litest_tablet_motion(tablet, 20, 40, axes); - litest_drain_events(li); - - litest_touch_down(dev, 0, 30, 30); - litest_touch_move_to(dev, 0, 30, 30, 80, 80, 10, 1); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - /* Remove tablet device to unpair, still disabled though */ - litest_delete_device(tablet); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); - - litest_touch_down(dev, 0, 30, 30); - litest_touch_move_to(dev, 0, 30, 30, 80, 80, 10, 1); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - /* Touch device is still disabled */ - litest_touch_down(dev, 0, 30, 30); - litest_touch_move_to(dev, 0, 30, 30, 80, 80, 10, 1); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - status = libinput_device_config_send_events_set_mode( - dev->libinput_device, - LIBINPUT_CONFIG_SEND_EVENTS_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_touch_down(dev, 0, 30, 30); - litest_touch_move_to(dev, 0, 30, 30, 80, 80, 10, 1); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - if (is_touchpad) - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - else - litest_assert_touch_sequence(li); -} - -START_TEST(intuos_touch_arbitration_suspend_touch_device) -{ - touch_arbitration_suspend_touch(litest_current_device(), - LITEST_WACOM_INTUOS, - true); -} -END_TEST - -START_TEST(cintiq_touch_arbitration_suspend_touch_device) -{ - touch_arbitration_suspend_touch(litest_current_device(), - LITEST_WACOM_CINTIQ_13HDT_PEN, - false); -} -END_TEST - -static void -touch_arbitration_remove_touch(struct litest_device *dev, - enum litest_device_type other, - bool is_touchpad) -{ - struct litest_device *finger; - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - finger = litest_add_device(li, other); - litest_touch_down(finger, 0, 30, 30); - litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10, 1); - - litest_tablet_proximity_in(dev, 10, 10, axes); - litest_drain_events(li); - - litest_delete_device(finger); - libinput_dispatch(li); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); - litest_assert_empty_queue(li); - - litest_tablet_motion(dev, 10, 10, axes); - litest_tablet_motion(dev, 20, 40, axes); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); -} - -START_TEST(intuos_touch_arbitration_remove_touch) -{ - touch_arbitration_remove_touch(litest_current_device(), - LITEST_WACOM_FINGER, - true); -} -END_TEST - -START_TEST(cintiq_touch_arbitration_remove_touch) -{ - touch_arbitration_remove_touch(litest_current_device(), - LITEST_WACOM_CINTIQ_13HDT_FINGER, - false); -} -END_TEST - -static void -touch_arbitration_remove_tablet(struct litest_device *dev, - enum litest_device_type other, - bool is_touchpad) -{ - struct litest_device *tablet; - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_DISTANCE, 10 }, - { ABS_PRESSURE, 0 }, - { -1, -1 } - }; - - tablet = litest_add_device(li, other); - libinput_dispatch(li); - litest_tablet_proximity_in(tablet, 10, 10, axes); - litest_tablet_motion(tablet, 10, 10, axes); - litest_tablet_motion(tablet, 20, 40, axes); - litest_drain_events(li); - - litest_touch_down(dev, 0, 30, 30); - litest_touch_move_to(dev, 0, 30, 30, 80, 80, 10, 1); - litest_assert_empty_queue(li); - - litest_delete_device(tablet); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); - - /* Touch is still down, don't enable */ - litest_touch_move_to(dev, 0, 80, 80, 30, 30, 10, 1); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 30, 30); - litest_touch_move_to(dev, 0, 30, 30, 80, 80, 10, 1); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - if (is_touchpad) - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - else - litest_assert_touch_sequence(li); -} - -START_TEST(intuos_touch_arbitration_remove_tablet) -{ - touch_arbitration_remove_tablet(litest_current_device(), - LITEST_WACOM_INTUOS, - true); -} -END_TEST - -START_TEST(cintiq_touch_arbitration_remove_tablet) -{ - touch_arbitration_remove_tablet(litest_current_device(), - LITEST_WACOM_CINTIQ_13HDT_PEN, - false); -} -END_TEST - -START_TEST(huion_static_btn_tool_pen) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i; - - litest_drain_events(li); - - litest_event(dev, EV_ABS, ABS_X, 20000); - litest_event(dev, EV_ABS, ABS_Y, 20000); - litest_event(dev, EV_ABS, ABS_PRESSURE, 100); - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_drain_events(li); - - for (i = 0; i < 10; i++) { - litest_event(dev, EV_ABS, ABS_X, 20000 + 10 * i); - litest_event(dev, EV_ABS, ABS_Y, 20000 - 10 * i); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - /* Wait past the timeout to expect a proximity out */ - litest_timeout_tablet_proxout(); - libinput_dispatch(li); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); - libinput_dispatch(li); - - /* New events should fake a proximity in again */ - litest_event(dev, EV_ABS, ABS_X, 20000); - litest_event(dev, EV_ABS, ABS_Y, 20000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); - libinput_dispatch(li); - - for (i = 0; i < 10; i++) { - litest_event(dev, EV_ABS, ABS_X, 20000 + 10 * i); - litest_event(dev, EV_ABS, ABS_Y, 20000 - 10 * i); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - litest_timeout_tablet_proxout(); - libinput_dispatch(li); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); - libinput_dispatch(li); - - /* New events, just to ensure cleanup paths are correct */ - litest_event(dev, EV_ABS, ABS_X, 20000); - litest_event(dev, EV_ABS, ABS_Y, 20000); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); -} -END_TEST - -START_TEST(huion_static_btn_tool_pen_no_timeout_during_usage) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i; - - litest_drain_events(li); - - litest_event(dev, EV_ABS, ABS_X, 20000); - litest_event(dev, EV_ABS, ABS_Y, 20000); - litest_event(dev, EV_ABS, ABS_PRESSURE, 100); - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_drain_events(li); - - /* take longer than the no-activity timeout */ - for (i = 0; i < 50; i++) { - litest_event(dev, EV_ABS, ABS_X, 20000 + 10 * i); - litest_event(dev, EV_ABS, ABS_Y, 20000 - 10 * i); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - msleep(5); - } - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - litest_timeout_tablet_proxout(); - libinput_dispatch(li); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); - libinput_dispatch(li); -} -END_TEST - -START_TEST(huion_static_btn_tool_pen_disable_quirk_on_prox_out) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - bool with_timeout = _i; /* ranged test */ - int i; - - /* test is run twice, once where the real BTN_TOOL_PEN is triggered - * during proximity out, one where the real BTN_TOOL_PEN is - * triggered after we already triggered the quirk timeout - */ - - litest_drain_events(li); - - litest_event(dev, EV_ABS, ABS_X, 20000); - litest_event(dev, EV_ABS, ABS_Y, 20000); - litest_event(dev, EV_ABS, ABS_PRESSURE, 100); - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_drain_events(li); - - for (i = 0; i < 10; i++) { - litest_event(dev, EV_ABS, ABS_X, 20000 + 10 * i); - litest_event(dev, EV_ABS, ABS_Y, 20000 - 10 * i); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - /* Wait past the timeout to expect a proximity out */ - if (with_timeout) { - litest_timeout_tablet_proxout(); - libinput_dispatch(li); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); - } - - /* Send a real prox out, expect quirk to be disabled */ - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - if (with_timeout) { - /* we got the proximity event above already */ - litest_assert_empty_queue(li); - } else { - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); - } - - litest_push_event_frame(dev); - litest_tablet_proximity_out(dev); - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_pop_event_frame(dev); - - litest_tablet_proximity_in(dev, 50, 50, NULL); - libinput_dispatch(li); - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN); - libinput_dispatch(li); - - for (i = 0; i < 10; i++) { - litest_tablet_motion(dev, 50 + i, 50 + i, NULL); - libinput_dispatch(li); - } - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_TABLET_TOOL_AXIS); - - litest_push_event_frame(dev); - litest_tablet_proximity_out(dev); - litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_pop_event_frame(dev); - libinput_dispatch(li); - - litest_assert_tablet_proximity_event(li, - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT); - litest_assert_empty_queue(li); -} -END_TEST - -void -litest_setup_tests_tablet(void) -{ - struct range with_timeout = { 0, 2 }; - - litest_add("tablet:tool", tool_ref, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY); - litest_add("tablet:tool", tool_user_data, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY); - litest_add("tablet:tool", tool_capability, LITEST_TABLET, LITEST_ANY); - litest_add_no_device("tablet:tool", tool_capabilities); - litest_add("tablet:tool", tool_type, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:tool", tool_in_prox_before_start, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:tool_serial", tool_unique, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY); - litest_add("tablet:tool_serial", tool_serial, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY); - litest_add("tablet:tool_serial", tool_id, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY); - litest_add("tablet:tool_serial", serial_changes_tool, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY); - litest_add("tablet:tool_serial", invalid_serials, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY); - litest_add_no_device("tablet:tool_serial", tools_with_serials); - litest_add_no_device("tablet:tool_serial", tools_without_serials); - litest_add_for_device("tablet:tool_serial", tool_delayed_serial, LITEST_WACOM_HID4800_PEN); - litest_add("tablet:proximity", proximity_out_clear_buttons, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:proximity", proximity_in_out, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:proximity", proximity_in_button_down, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:proximity", proximity_out_button_up, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:proximity", proximity_has_axes, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:proximity", bad_distance_events, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY); - litest_add("tablet:proximity", proximity_range_enter, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY); - litest_add("tablet:proximity", proximity_range_in_out, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY); - litest_add("tablet:proximity", proximity_range_button_click, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY); - litest_add("tablet:proximity", proximity_range_button_press, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY); - litest_add("tablet:proximity", proximity_range_button_release, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY); - litest_add("tablet:button", button_down_up, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:button", button_seat_count, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:tip", tip_down_up, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:tip", tip_down_prox_in, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:tip", tip_up_prox_out, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:tip", tip_down_btn_change, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:tip", tip_up_btn_change, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:tip", tip_down_motion, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:tip", tip_up_motion, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:tip", tip_state_proximity, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:tip", tip_state_axis, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:tip", tip_state_button, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:motion", motion, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:motion", motion_event_state, LITEST_TABLET, LITEST_ANY); - litest_add_for_device("tablet:motion", motion_outside_bounds, LITEST_WACOM_CINTIQ_24HD); - litest_add("tablet:tilt", tilt_available, LITEST_TABLET|LITEST_TILT, LITEST_ANY); - litest_add("tablet:tilt", tilt_not_available, LITEST_TABLET, LITEST_TILT); - litest_add("tablet:tilt", tilt_x, LITEST_TABLET|LITEST_TILT, LITEST_ANY); - litest_add("tablet:tilt", tilt_y, LITEST_TABLET|LITEST_TILT, LITEST_ANY); - litest_add_for_device("tablet:left_handed", left_handed, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:left_handed", left_handed_tilt, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:left_handed", left_handed_mouse_rotation, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:left_handed", left_handed_artpen_rotation, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:left_handed", no_left_handed, LITEST_WACOM_CINTIQ); - litest_add("tablet:pad", pad_buttons_ignored, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:mouse", mouse_tool, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:mouse", mouse_buttons, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:mouse", mouse_rotation, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:mouse", mouse_wheel, LITEST_TABLET, LITEST_WHEEL); - litest_add("tablet:airbrush", airbrush_tool, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:airbrush", airbrush_slider, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:artpen", artpen_tool, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:artpen", artpen_rotation, LITEST_TABLET, LITEST_ANY); - - litest_add("tablet:time", tablet_time_usec, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:pressure", tablet_pressure_distance_exclusive, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY); - - litest_add("tablet:calibration", tablet_calibration_has_matrix, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:calibration", tablet_calibration_set_matrix, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:calibration", tablet_calibration_set_matrix_delta, LITEST_TABLET, LITEST_ANY); - - litest_add("tablet:pressure", tablet_pressure_min_max, LITEST_TABLET, LITEST_ANY); - litest_add_for_device("tablet:pressure", tablet_pressure_range, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:pressure", tablet_pressure_offset, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:pressure", tablet_pressure_offset_decrease, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:pressure", tablet_pressure_offset_increase, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:pressure", tablet_pressure_offset_exceed_threshold, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:pressure", tablet_pressure_offset_none_for_zero_distance, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:pressure", tablet_pressure_offset_none_for_small_distance, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:distance", tablet_distance_range, LITEST_WACOM_INTUOS); - - litest_add("tablet:relative", relative_no_profile, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:relative", relative_no_delta_prox_in, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:relative", relative_delta, LITEST_TABLET, LITEST_ANY); - litest_add("tablet:relative", relative_calibration, LITEST_TABLET, LITEST_ANY); - - litest_add_for_device("tablet:touch-arbitration", intuos_touch_arbitration, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:touch-arbitration", intuos_touch_arbitration_stop_touch, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:touch-arbitration", intuos_touch_arbitration_suspend_touch_device, LITEST_WACOM_FINGER); - litest_add_for_device("tablet:touch-arbitration", intuos_touch_arbitration_remove_touch, LITEST_WACOM_INTUOS); - litest_add_for_device("tablet:touch-arbitration", intuos_touch_arbitration_remove_tablet, LITEST_WACOM_FINGER); - - litest_add_for_device("tablet:touch-arbitration", cintiq_touch_arbitration, LITEST_WACOM_CINTIQ_13HDT_PEN); - litest_add_for_device("tablet:touch-arbitration", cintiq_touch_arbitration_stop_touch, LITEST_WACOM_CINTIQ_13HDT_PEN); - litest_add_for_device("tablet:touch-arbitration", cintiq_touch_arbitration_suspend_touch_device, LITEST_WACOM_CINTIQ_13HDT_FINGER); - litest_add_for_device("tablet:touch-arbitration", cintiq_touch_arbitration_remove_touch, LITEST_WACOM_CINTIQ_13HDT_PEN); - litest_add_for_device("tablet:touch-arbitration", cintiq_touch_arbitration_remove_tablet, LITEST_WACOM_CINTIQ_13HDT_FINGER); - - litest_add_for_device("tablet:quirks", huion_static_btn_tool_pen, LITEST_HUION_TABLET); - litest_add_for_device("tablet:quirks", huion_static_btn_tool_pen_no_timeout_during_usage, LITEST_HUION_TABLET); - litest_add_ranged_for_device("tablet:quirks", huion_static_btn_tool_pen_disable_quirk_on_prox_out, LITEST_HUION_TABLET, &with_timeout); -} diff -Nru libinput-1.10.3/test/test-touch.c libinput-0.21.0/test/test-touch.c --- libinput-1.10.3/test/test-touch.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-touch.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,983 +0,0 @@ -/* - * Copyright © 2013 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include -#include -#include -#include -#include - -#include "libinput-util.h" -#include "litest.h" - -START_TEST(touch_frame_events) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int have_frame_event = 0; - - litest_drain_events(dev->libinput); - - litest_touch_down(dev, 0, 10, 10); - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - if (libinput_event_get_type(event) == LIBINPUT_EVENT_TOUCH_FRAME) - have_frame_event++; - libinput_event_destroy(event); - } - ck_assert_int_eq(have_frame_event, 1); - - litest_touch_down(dev, 1, 10, 10); - libinput_dispatch(li); - - while ((event = libinput_get_event(li))) { - if (libinput_event_get_type(event) == LIBINPUT_EVENT_TOUCH_FRAME) - have_frame_event++; - libinput_event_destroy(event); - } - ck_assert_int_eq(have_frame_event, 2); -} -END_TEST - -START_TEST(touch_abs_transform) -{ - struct litest_device *dev; - struct libinput *libinput; - struct libinput_event *ev; - struct libinput_event_touch *tev; - double fx, fy; - bool tested = false; - - struct input_absinfo abs[] = { - { ABS_X, 0, 32767, 75, 0, 10 }, - { ABS_Y, 0, 32767, 129, 0, 9 }, - { ABS_MT_POSITION_X, 0, 32767, 0, 0, 10 }, - { ABS_MT_POSITION_Y, 0, 32767, 0, 0, 9 }, - { .value = -1 }, - }; - - dev = litest_create_device_with_overrides(LITEST_WACOM_TOUCH, - "litest Highres touch device", - NULL, abs, NULL); - - libinput = dev->libinput; - - litest_touch_down(dev, 0, 100, 100); - - libinput_dispatch(libinput); - - while ((ev = libinput_get_event(libinput))) { - if (libinput_event_get_type(ev) != LIBINPUT_EVENT_TOUCH_DOWN) { - libinput_event_destroy(ev); - continue; - } - - tev = libinput_event_get_touch_event(ev); - fx = libinput_event_touch_get_x_transformed(tev, 1920); - ck_assert_int_eq(fx, 1919.0); - fy = libinput_event_touch_get_y_transformed(tev, 720); - ck_assert_int_eq(fy, 719.0); - - tested = true; - - libinput_event_destroy(ev); - } - - ck_assert(tested); - - litest_delete_device(dev); -} -END_TEST - -static inline void -touch_assert_seat_slot(struct libinput *li, - enum libinput_event_type type, - unsigned int slot, - unsigned int seat_slot) -{ - struct libinput_event *ev; - struct libinput_event_touch *tev; - - libinput_dispatch(li); - ev = libinput_get_event(li); - tev = litest_is_touch_event(ev, type); - slot = libinput_event_touch_get_slot(tev); - ck_assert_int_eq(slot, slot); - slot = libinput_event_touch_get_seat_slot(tev); - ck_assert_int_eq(slot, seat_slot); - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - litest_assert_event_type(ev, LIBINPUT_EVENT_TOUCH_FRAME); - libinput_event_destroy(ev); -} - -START_TEST(touch_seat_slot) -{ - struct litest_device *dev1 = litest_current_device(); - struct litest_device *dev2; - struct libinput *li = dev1->libinput; - - dev2 = litest_add_device(li, LITEST_WACOM_TOUCH); - - litest_drain_events(li); - - litest_touch_down(dev1, 0, 50, 50); - touch_assert_seat_slot(li, LIBINPUT_EVENT_TOUCH_DOWN, 0, 0); - - litest_touch_down(dev2, 0, 50, 50); - touch_assert_seat_slot(li, LIBINPUT_EVENT_TOUCH_DOWN, 0, 1); - - litest_touch_down(dev2, 1, 60, 50); - touch_assert_seat_slot(li, LIBINPUT_EVENT_TOUCH_DOWN, 1, 2); - - litest_touch_down(dev1, 1, 60, 50); - touch_assert_seat_slot(li, LIBINPUT_EVENT_TOUCH_DOWN, 1, 3); - - litest_touch_move_to(dev1, 0, 50, 50, 60, 70, 10, 0); - touch_assert_seat_slot(li, LIBINPUT_EVENT_TOUCH_MOTION, 0, 0); - litest_drain_events(li); - - litest_touch_move_to(dev2, 1, 50, 50, 60, 70, 10, 0); - touch_assert_seat_slot(li, LIBINPUT_EVENT_TOUCH_MOTION, 1, 2); - litest_drain_events(li); - - litest_touch_up(dev1, 0); - touch_assert_seat_slot(li, LIBINPUT_EVENT_TOUCH_UP, 0, 0); - - litest_touch_up(dev2, 0); - touch_assert_seat_slot(li, LIBINPUT_EVENT_TOUCH_UP, 0, 1); - - litest_touch_up(dev2, 1); - touch_assert_seat_slot(li, LIBINPUT_EVENT_TOUCH_UP, 1, 2); - - litest_touch_up(dev1, 1); - touch_assert_seat_slot(li, LIBINPUT_EVENT_TOUCH_UP, 1, 3); - - litest_delete_device(dev2); -} -END_TEST - -START_TEST(touch_many_slots) -{ - struct libinput *libinput; - struct litest_device *dev; - struct libinput_event *ev; - int slot; - const int num_tps = 100; - int slot_count = 0; - enum libinput_event_type type; - - struct input_absinfo abs[] = { - { ABS_MT_SLOT, 0, num_tps - 1, 0, 0, 0 }, - { .value = -1 }, - }; - - dev = litest_create_device_with_overrides(LITEST_WACOM_TOUCH, - "litest Multi-touch device", - NULL, abs, NULL); - libinput = dev->libinput; - - for (slot = 0; slot < num_tps; ++slot) - litest_touch_down(dev, slot, 0, 0); - for (slot = 0; slot < num_tps; ++slot) - litest_touch_up(dev, slot); - - libinput_dispatch(libinput); - while ((ev = libinput_get_event(libinput))) { - type = libinput_event_get_type(ev); - - if (type == LIBINPUT_EVENT_TOUCH_DOWN) - slot_count++; - else if (type == LIBINPUT_EVENT_TOUCH_UP) - break; - - libinput_event_destroy(ev); - libinput_dispatch(libinput); - } - - ck_assert_notnull(ev); - ck_assert_int_gt(slot_count, 0); - - libinput_dispatch(libinput); - do { - type = libinput_event_get_type(ev); - ck_assert_int_ne(type, LIBINPUT_EVENT_TOUCH_DOWN); - if (type == LIBINPUT_EVENT_TOUCH_UP) - slot_count--; - - libinput_event_destroy(ev); - libinput_dispatch(libinput); - } while ((ev = libinput_get_event(libinput))); - - ck_assert_int_eq(slot_count, 0); - - litest_delete_device(dev); -} -END_TEST - -START_TEST(touch_double_touch_down_up) -{ - struct libinput *libinput; - struct litest_device *dev; - struct libinput_event *ev; - bool got_down = false; - bool got_up = false; - - dev = litest_current_device(); - libinput = dev->libinput; - - litest_disable_log_handler(libinput); - /* note: this test is a false negative, libevdev will filter - * tracking IDs re-used in the same slot. */ - litest_touch_down(dev, 0, 0, 0); - litest_touch_down(dev, 0, 0, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 0); - libinput_dispatch(libinput); - litest_restore_log_handler(libinput); - - while ((ev = libinput_get_event(libinput))) { - switch (libinput_event_get_type(ev)) { - case LIBINPUT_EVENT_TOUCH_DOWN: - ck_assert(!got_down); - got_down = true; - break; - case LIBINPUT_EVENT_TOUCH_UP: - ck_assert(got_down); - ck_assert(!got_up); - got_up = true; - break; - default: - break; - } - - libinput_event_destroy(ev); - libinput_dispatch(libinput); - } - - ck_assert(got_down); - ck_assert(got_up); -} -END_TEST - -START_TEST(touch_calibration_scale) -{ - struct libinput *li; - struct litest_device *dev; - struct libinput_event *ev; - struct libinput_event_touch *tev; - float matrix[6] = { - 1, 0, 0, - 0, 1, 0 - }; - - float calibration; - double x, y; - const int width = 640, height = 480; - - dev = litest_current_device(); - li = dev->libinput; - - for (calibration = 0.1; calibration < 1; calibration += 0.1) { - libinput_device_config_calibration_set_matrix(dev->libinput_device, - matrix); - litest_drain_events(li); - - litest_touch_down(dev, 0, 100, 100); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - ev = libinput_get_event(li); - tev = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); - - x = libinput_event_touch_get_x_transformed(tev, width); - y = libinput_event_touch_get_y_transformed(tev, height); - - ck_assert_int_eq(round(x), round(width * matrix[0])); - ck_assert_int_eq(round(y), round(height * matrix[4])); - - libinput_event_destroy(ev); - litest_drain_events(li); - - matrix[0] = calibration; - matrix[4] = 1 - calibration; - } -} -END_TEST - -START_TEST(touch_calibration_rotation) -{ - struct libinput *li; - struct litest_device *dev; - struct libinput_event *ev; - struct libinput_event_touch *tev; - float matrix[6]; - int i; - double x, y; - int width = 1024, height = 480; - - dev = litest_current_device(); - li = dev->libinput; - - for (i = 0; i < 4; i++) { - float angle = i * M_PI/2; - - /* [ cos -sin tx ] - [ sin cos ty ] - [ 0 0 1 ] */ - matrix[0] = cos(angle); - matrix[1] = -sin(angle); - matrix[3] = sin(angle); - matrix[4] = cos(angle); - - switch(i) { - case 0: /* 0 deg */ - matrix[2] = 0; - matrix[5] = 0; - break; - case 1: /* 90 deg cw */ - matrix[2] = 1; - matrix[5] = 0; - break; - case 2: /* 180 deg cw */ - matrix[2] = 1; - matrix[5] = 1; - break; - case 3: /* 270 deg cw */ - matrix[2] = 0; - matrix[5] = 1; - break; - } - - libinput_device_config_calibration_set_matrix(dev->libinput_device, - matrix); - litest_drain_events(li); - - litest_touch_down(dev, 0, 80, 20); - litest_touch_up(dev, 0); - libinput_dispatch(li); - ev = libinput_get_event(li); - tev = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); - - x = libinput_event_touch_get_x_transformed(tev, width); - y = libinput_event_touch_get_y_transformed(tev, height); - - /* rounding errors... */ -#define almost_equal(a_, b_) \ - { ck_assert_int_ge((a_) + 0.5, (b_) - 1); \ - ck_assert_int_le((a_) + 0.5, (b_) + 1); } - switch(i) { - case 0: /* 0 deg */ - almost_equal(x, width * 0.8); - almost_equal(y, height * 0.2); - break; - case 1: /* 90 deg cw */ - almost_equal(x, width * 0.8); - almost_equal(y, height * 0.8); - break; - case 2: /* 180 deg cw */ - almost_equal(x, width * 0.2); - almost_equal(y, height * 0.8); - break; - case 3: /* 270 deg cw */ - almost_equal(x, width * 0.2); - almost_equal(y, height * 0.2); - break; - } -#undef almost_equal - - libinput_event_destroy(ev); - litest_drain_events(li); - } -} -END_TEST - -START_TEST(touch_calibration_translation) -{ - struct libinput *li; - struct litest_device *dev; - struct libinput_event *ev; - struct libinput_event_touch *tev; - float matrix[6] = { - 1, 0, 0, - 0, 1, 0 - }; - - float translate; - double x, y; - const int width = 640, height = 480; - - dev = litest_current_device(); - li = dev->libinput; - - /* translating from 0 up to 1 device width/height */ - for (translate = 0.1; translate <= 1; translate += 0.1) { - libinput_device_config_calibration_set_matrix(dev->libinput_device, - matrix); - litest_drain_events(li); - - litest_touch_down(dev, 0, 100, 100); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - ev = libinput_get_event(li); - tev = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); - - x = libinput_event_touch_get_x_transformed(tev, width); - y = libinput_event_touch_get_y_transformed(tev, height); - - /* sigh. rounding errors */ - ck_assert_int_ge(round(x), width + round(width * matrix[2]) - 1); - ck_assert_int_ge(round(y), height + round(height * matrix[5]) - 1); - ck_assert_int_le(round(x), width + round(width * matrix[2]) + 1); - ck_assert_int_le(round(y), height + round(height * matrix[5]) + 1); - - libinput_event_destroy(ev); - litest_drain_events(li); - - matrix[2] = translate; - matrix[5] = 1 - translate; - } -} -END_TEST - -START_TEST(touch_calibrated_screen_path) -{ - struct litest_device *dev = litest_current_device(); - float matrix[6]; - int rc; - - rc = libinput_device_config_calibration_has_matrix(dev->libinput_device); - ck_assert_int_eq(rc, 1); - - rc = libinput_device_config_calibration_get_matrix(dev->libinput_device, - matrix); - ck_assert_int_eq(rc, 1); - - ck_assert_double_eq(matrix[0], 1.2); - ck_assert_double_eq(matrix[1], 3.4); - ck_assert_double_eq(matrix[2], 5.6); - ck_assert_double_eq(matrix[3], 7.8); - ck_assert_double_eq(matrix[4], 9.10); - ck_assert_double_eq(matrix[5], 11.12); -} -END_TEST - -static int open_restricted(const char *path, int flags, void *data) -{ - int fd; - fd = open(path, flags); - return fd < 0 ? -errno : fd; -} -static void close_restricted(int fd, void *data) -{ - close(fd); -} - -static const struct libinput_interface simple_interface = { - .open_restricted = open_restricted, - .close_restricted = close_restricted, -}; - -START_TEST(touch_calibrated_screen_udev) -{ - struct libinput *li; - struct libinput_event *ev; - struct libinput_device *device = NULL; - struct udev *udev; - float matrix[6]; - int rc; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); - - libinput_dispatch(li); - - while ((ev = libinput_get_event(li))) { - struct libinput_device *d; - - if (libinput_event_get_type(ev) != - LIBINPUT_EVENT_DEVICE_ADDED) { - libinput_event_destroy(ev); - continue; - } - - d = libinput_event_get_device(ev); - - if (libinput_device_get_id_vendor(d) == 0x22 && - libinput_device_get_id_product(d) == 0x33) { - device = libinput_device_ref(d); - litest_drain_events(li); - } - libinput_event_destroy(ev); - } - - litest_drain_events(li); - - ck_assert_notnull(device); - rc = libinput_device_config_calibration_has_matrix(device); - ck_assert_int_eq(rc, 1); - - rc = libinput_device_config_calibration_get_matrix(device, matrix); - ck_assert_int_eq(rc, 1); - - ck_assert_double_eq(matrix[0], 1.2); - ck_assert_double_eq(matrix[1], 3.4); - ck_assert_double_eq(matrix[2], 5.6); - ck_assert_double_eq(matrix[3], 7.8); - ck_assert_double_eq(matrix[4], 9.10); - ck_assert_double_eq(matrix[5], 11.12); - - libinput_device_unref(device); - - libinput_unref(li); - udev_unref(udev); - -} -END_TEST - -START_TEST(touch_no_left_handed) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - enum libinput_config_status status; - int rc; - - rc = libinput_device_config_left_handed_is_available(d); - ck_assert_int_eq(rc, 0); - - rc = libinput_device_config_left_handed_get(d); - ck_assert_int_eq(rc, 0); - - rc = libinput_device_config_left_handed_get_default(d); - ck_assert_int_eq(rc, 0); - - status = libinput_device_config_left_handed_set(d, 0); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); -} -END_TEST - -START_TEST(fake_mt_exists) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_device *device; - - libinput_dispatch(li); - - event = libinput_get_event(li); - device = libinput_event_get_device(event); - - ck_assert(!libinput_device_has_capability(device, - LIBINPUT_DEVICE_CAP_TOUCH)); - - /* This test may need fixing if we add other fake-mt devices that - * have different capabilities */ - ck_assert(libinput_device_has_capability(device, - LIBINPUT_DEVICE_CAP_POINTER)); - - libinput_event_destroy(event); -} -END_TEST - -START_TEST(fake_mt_no_touch_events) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 70, 70, 5, 10); - litest_touch_up(dev, 0); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 70); - litest_touch_move_to(dev, 0, 50, 50, 90, 40, 10, 10); - litest_touch_move_to(dev, 0, 70, 70, 40, 50, 10, 10); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE); -} -END_TEST - -START_TEST(touch_protocol_a_init) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device = dev->libinput_device; - - ck_assert_int_ne(libinput_next_event_type(li), - LIBINPUT_EVENT_NONE); - - ck_assert(libinput_device_has_capability(device, - LIBINPUT_DEVICE_CAP_TOUCH)); -} -END_TEST - -START_TEST(touch_protocol_a_touch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *ev; - struct libinput_event_touch *tev; - double x, y, oldx, oldy; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 5, 95); - libinput_dispatch(li); - - ev = libinput_get_event(li); - tev = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); - - oldx = libinput_event_touch_get_x(tev); - oldy = libinput_event_touch_get_y(tev); - - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_FRAME); - libinput_event_destroy(ev); - - litest_touch_move_to(dev, 0, 10, 90, 90, 10, 20, 1); - libinput_dispatch(li); - - while ((ev = libinput_get_event(li))) { - if (libinput_event_get_type(ev) == - LIBINPUT_EVENT_TOUCH_FRAME) { - libinput_event_destroy(ev); - continue; - } - ck_assert_int_eq(libinput_event_get_type(ev), - LIBINPUT_EVENT_TOUCH_MOTION); - - tev = libinput_event_get_touch_event(ev); - x = libinput_event_touch_get_x(tev); - y = libinput_event_touch_get_y(tev); - - ck_assert_int_gt(x, oldx); - ck_assert_int_lt(y, oldy); - - oldx = x; - oldy = y; - - libinput_event_destroy(ev); - } - - litest_touch_up(dev, 0); - libinput_dispatch(li); - ev = libinput_get_event(li); - litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_UP); - libinput_event_destroy(ev); -} -END_TEST - -START_TEST(touch_protocol_a_2fg_touch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *ev; - struct libinput_event_touch *tev; - int pos; - - litest_drain_events(li); - - litest_push_event_frame(dev); - litest_touch_down(dev, 0, 5, 95); - litest_touch_down(dev, 0, 95, 5); - litest_pop_event_frame(dev); - - libinput_dispatch(li); - ev = libinput_get_event(li); - litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_FRAME); - libinput_event_destroy(ev); - - for (pos = 10; pos < 100; pos += 10) { - litest_push_event_frame(dev); - litest_touch_move_to(dev, 0, pos, 100 - pos, pos, 100 - pos, 1, 1); - litest_touch_move_to(dev, 0, 100 - pos, pos, 100 - pos, pos, 1, 1); - litest_pop_event_frame(dev); - libinput_dispatch(li); - - ev = libinput_get_event(li); - tev = libinput_event_get_touch_event(ev); - ck_assert_int_eq(libinput_event_touch_get_slot(tev), - 0); - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - tev = libinput_event_get_touch_event(ev); - ck_assert_int_eq(libinput_event_touch_get_slot(tev), - 1); - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_FRAME); - libinput_event_destroy(ev); - } - - litest_event(dev, EV_SYN, SYN_MT_REPORT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - ev = libinput_get_event(li); - litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_UP); - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_UP); - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_FRAME); - libinput_event_destroy(ev); -} -END_TEST - -START_TEST(touch_initial_state) -{ - struct litest_device *dev; - struct libinput *libinput1, *libinput2; - struct libinput_event *ev1 = NULL; - struct libinput_event *ev2 = NULL; - struct libinput_event_touch *t1, *t2; - struct libinput_device *device1, *device2; - int axis = _i; /* looped test */ - - dev = litest_current_device(); - device1 = dev->libinput_device; - libinput_device_config_tap_set_enabled(device1, - LIBINPUT_CONFIG_TAP_DISABLED); - - libinput1 = dev->libinput; - litest_touch_down(dev, 0, 40, 60); - litest_touch_up(dev, 0); - - /* device is now on some x/y value */ - litest_drain_events(libinput1); - - libinput2 = litest_create_context(); - device2 = libinput_path_add_device(libinput2, - libevdev_uinput_get_devnode( - dev->uinput)); - libinput_device_config_tap_set_enabled(device2, - LIBINPUT_CONFIG_TAP_DISABLED); - litest_drain_events(libinput2); - - if (axis == ABS_X) - litest_touch_down(dev, 0, 40, 70); - else - litest_touch_down(dev, 0, 70, 60); - litest_touch_up(dev, 0); - - libinput_dispatch(libinput1); - libinput_dispatch(libinput2); - - while (libinput_next_event_type(libinput1)) { - ev1 = libinput_get_event(libinput1); - ev2 = libinput_get_event(libinput2); - - t1 = litest_is_touch_event(ev1, 0); - t2 = litest_is_touch_event(ev2, 0); - - ck_assert_int_eq(libinput_event_get_type(ev1), - libinput_event_get_type(ev2)); - - if (libinput_event_get_type(ev1) == LIBINPUT_EVENT_TOUCH_UP || - libinput_event_get_type(ev1) == LIBINPUT_EVENT_TOUCH_FRAME) - break; - - ck_assert_int_eq(libinput_event_touch_get_x(t1), - libinput_event_touch_get_x(t2)); - ck_assert_int_eq(libinput_event_touch_get_y(t1), - libinput_event_touch_get_y(t2)); - - libinput_event_destroy(ev1); - libinput_event_destroy(ev2); - } - - libinput_event_destroy(ev1); - libinput_event_destroy(ev2); - - libinput_unref(libinput2); -} -END_TEST - -START_TEST(touch_time_usec) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_touch *tev; - uint64_t time_usec; - - litest_drain_events(dev->libinput); - - litest_touch_down(dev, 0, 10, 10); - libinput_dispatch(li); - - event = libinput_get_event(li); - tev = litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_DOWN); - time_usec = libinput_event_touch_get_time_usec(tev); - ck_assert_int_eq(libinput_event_touch_get_time(tev), - (uint32_t) (time_usec / 1000)); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(touch_fuzz) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int i; - int x = 700, y = 300; - - litest_drain_events(dev->libinput); - - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 30); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_DOWN); - libinput_event_destroy(event); - event = libinput_get_event(li); - litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_FRAME); - libinput_event_destroy(event); - - litest_drain_events(li); - - for (i = 0; i < 50; i++) { - if (i % 2) { - x++; - y--; - } else { - x--; - y++; - } - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_assert_empty_queue(li); - } -} -END_TEST - -START_TEST(touch_release_on_unplug) -{ - struct litest_device *dev; - struct libinput *li; - struct libinput_event *ev; - - li = litest_create_context(); - dev = litest_add_device(li, LITEST_GENERIC_MULTITOUCH_SCREEN); - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10, 1); - litest_drain_events(li); - - /* Touch is still down when device is removed, espect a release */ - litest_delete_device(dev); - libinput_dispatch(li); - - ev = libinput_get_event(li); - litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_UP); - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_FRAME); - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - litest_assert_event_type(ev, LIBINPUT_EVENT_DEVICE_REMOVED); - libinput_event_destroy(ev); - - libinput_unref(li); -} -END_TEST - -void -litest_setup_tests_touch(void) -{ - struct range axes = { ABS_X, ABS_Y + 1}; - - litest_add("touch:frame", touch_frame_events, LITEST_TOUCH, LITEST_ANY); - litest_add_no_device("touch:abs-transform", touch_abs_transform); - litest_add("touch:slots", touch_seat_slot, LITEST_TOUCH, LITEST_TOUCHPAD); - litest_add_no_device("touch:slots", touch_many_slots); - litest_add("touch:double-touch-down-up", touch_double_touch_down_up, LITEST_TOUCH, LITEST_ANY); - litest_add("touch:calibration", touch_calibration_scale, LITEST_TOUCH, LITEST_TOUCHPAD); - litest_add("touch:calibration", touch_calibration_scale, LITEST_SINGLE_TOUCH, LITEST_TOUCHPAD); - litest_add("touch:calibration", touch_calibration_rotation, LITEST_TOUCH, LITEST_TOUCHPAD); - litest_add("touch:calibration", touch_calibration_rotation, LITEST_SINGLE_TOUCH, LITEST_TOUCHPAD); - litest_add("touch:calibration", touch_calibration_translation, LITEST_TOUCH, LITEST_TOUCHPAD); - litest_add("touch:calibration", touch_calibration_translation, LITEST_SINGLE_TOUCH, LITEST_TOUCHPAD); - litest_add_for_device("touch:calibration", touch_calibrated_screen_path, LITEST_CALIBRATED_TOUCHSCREEN); - litest_add_for_device("touch:calibration", touch_calibrated_screen_udev, LITEST_CALIBRATED_TOUCHSCREEN); - - litest_add("touch:left-handed", touch_no_left_handed, LITEST_TOUCH, LITEST_ANY); - - litest_add("touch:fake-mt", fake_mt_exists, LITEST_FAKE_MT, LITEST_ANY); - litest_add("touch:fake-mt", fake_mt_no_touch_events, LITEST_FAKE_MT, LITEST_ANY); - - litest_add("touch:protocol a", touch_protocol_a_init, LITEST_PROTOCOL_A, LITEST_ANY); - litest_add("touch:protocol a", touch_protocol_a_touch, LITEST_PROTOCOL_A, LITEST_ANY); - litest_add("touch:protocol a", touch_protocol_a_2fg_touch, LITEST_PROTOCOL_A, LITEST_ANY); - - litest_add_ranged("touch:state", touch_initial_state, LITEST_TOUCH, LITEST_PROTOCOL_A, &axes); - - litest_add("touch:time", touch_time_usec, LITEST_TOUCH, LITEST_TOUCHPAD); - - litest_add_for_device("touch:fuzz", touch_fuzz, LITEST_MULTITOUCH_FUZZ_SCREEN); - - litest_add_no_device("touch:release", touch_release_on_unplug); -} diff -Nru libinput-1.10.3/test/test-touchpad-buttons.c libinput-0.21.0/test/test-touchpad-buttons.c --- libinput-1.10.3/test/test-touchpad-buttons.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-touchpad-buttons.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2047 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include -#include -#include -#include - -#include "libinput-util.h" -#include "litest.h" - -START_TEST(touchpad_click_defaults_clickfinger) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - uint32_t methods, method; - enum libinput_config_status status; - - /* call this test for apple touchpads */ - - methods = libinput_device_config_click_get_methods(device); - ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); - ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); - - method = libinput_device_config_click_get_method(device); - ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); - method = libinput_device_config_click_get_default_method(device); - ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); - - status = libinput_device_config_click_set_method(device, - LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - status = libinput_device_config_click_set_method(device, - LIBINPUT_CONFIG_CLICK_METHOD_NONE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); -} -END_TEST - -START_TEST(touchpad_click_defaults_btnarea) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - uint32_t methods, method; - enum libinput_config_status status; - - /* call this test for non-apple clickpads */ - - methods = libinput_device_config_click_get_methods(device); - ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); - ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); - - method = libinput_device_config_click_get_method(device); - ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); - method = libinput_device_config_click_get_default_method(device); - ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); - - status = libinput_device_config_click_set_method(device, - LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - status = libinput_device_config_click_set_method(device, - LIBINPUT_CONFIG_CLICK_METHOD_NONE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); -} -END_TEST - -START_TEST(touchpad_click_defaults_none) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - uint32_t methods, method; - enum libinput_config_status status; - - if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE && - libevdev_get_id_product(dev->evdev) == PRODUCT_ID_APPLE_APPLETOUCH) - return; - - /* call this test for non-clickpads and non-touchpads */ - - methods = libinput_device_config_click_get_methods(device); - ck_assert_int_eq(methods, 0); - - method = libinput_device_config_click_get_method(device); - ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_NONE); - method = libinput_device_config_click_get_default_method(device); - ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_NONE); - - status = libinput_device_config_click_set_method(device, - LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - status = libinput_device_config_click_set_method(device, - LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); -} -END_TEST - -START_TEST(touchpad_1fg_clickfinger) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_1fg_clickfinger_no_touch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_2fg_clickfinger) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 70); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_3fg_clickfinger) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_num_slots(dev->evdev) < 3) - return; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 60, 70); - litest_touch_down(dev, 2, 70, 70); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 2); - - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_3fg_clickfinger_btntool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_num_slots(dev->evdev) >= 3 || - !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) - return; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 60, 70); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_4fg_clickfinger) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - - if (libevdev_get_num_slots(dev->evdev) < 4) - return; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 60, 70); - litest_touch_down(dev, 2, 70, 70); - litest_touch_down(dev, 3, 80, 70); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 2); - litest_touch_up(dev, 3); - - libinput_dispatch(li); - - litest_wait_for_event(li); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_4fg_clickfinger_btntool_2slots) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - - if (libevdev_get_num_slots(dev->evdev) >= 3 || - !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP)) - return; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 60, 70); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_wait_for_event(li); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_4fg_clickfinger_btntool_3slots) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - - if (libevdev_get_num_slots(dev->evdev) >= 4 || - libevdev_get_num_slots(dev->evdev) < 3 || - !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) - return; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 60, 70); - litest_touch_down(dev, 2, 70, 70); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 2); - - libinput_dispatch(li); - - litest_wait_for_event(li); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_2fg_clickfinger_distance) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - double w, h; - bool small_touchpad = false; - unsigned int expected_button; - - if (libinput_device_get_size(dev->libinput_device, &w, &h) == 0 && - h < 50.0) - small_touchpad = true; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 90, 50); - litest_touch_down(dev, 1, 10, 50); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 50, 5); - litest_touch_down(dev, 1, 50, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - /* if the touchpad is small enough, we expect all fingers to count - * for clickfinger */ - if (small_touchpad) - expected_button = BTN_RIGHT; - else - expected_button = BTN_LEFT; - - litest_assert_button_event(li, - expected_button, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - expected_button, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_3fg_clickfinger_distance) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_num_slots(dev->evdev) < 3) - return; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 90, 90); - litest_touch_down(dev, 1, 10, 15); - litest_touch_down(dev, 2, 10, 15); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 2); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_3fg_clickfinger_distance_btntool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_num_slots(dev->evdev) > 2) - return; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 90, 90); - litest_touch_down(dev, 1, 10, 15); - libinput_dispatch(li); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_2fg_clickfinger_bottom) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - /* this test is run for the T440s touchpad only, makes getting the - * mm correct easier */ - - libinput_device_config_click_set_method(dev->libinput_device, - LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); - litest_drain_events(li); - - /* one above, one below the magic line, vert spread ca 27mm */ - litest_touch_down(dev, 0, 40, 60); - litest_touch_down(dev, 1, 60, 100); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); - - /* both below the magic line */ - litest_touch_down(dev, 0, 40, 100); - litest_touch_down(dev, 1, 60, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - /* one above, one below the magic line, vert spread 17mm */ - litest_touch_down(dev, 0, 50, 75); - litest_touch_down(dev, 1, 55, 100); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_clickfinger_to_area_method) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_enable_buttonareas(dev); - - litest_touch_down(dev, 0, 95, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - /* use bottom right corner to catch accidental softbutton right */ - litest_touch_down(dev, 0, 95, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - -} -END_TEST - -START_TEST(touchpad_clickfinger_to_area_method_while_down) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_enable_buttonareas(dev); - - litest_touch_down(dev, 0, 95, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_enable_clickfinger(dev); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_drain_events(li); - - /* use bottom right corner to catch accidental softbutton right */ - litest_touch_down(dev, 0, 95, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - -} -END_TEST - -START_TEST(touchpad_area_to_clickfinger_method) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - /* use bottom right corner to catch accidental softbutton right */ - litest_touch_down(dev, 0, 95, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_enable_buttonareas(dev); - - litest_touch_down(dev, 0, 95, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - -} -END_TEST - -START_TEST(touchpad_area_to_clickfinger_method_while_down) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - /* use bottom right corner to catch accidental softbutton right */ - litest_touch_down(dev, 0, 95, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_enable_buttonareas(dev); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_touch_down(dev, 0, 95, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - -} -END_TEST - -START_TEST(touchpad_clickfinger_3fg_tool_position) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_clickfinger(dev); - litest_drain_events(li); - - /* one in thumb area, one in normal area + TRIPLETAP. spread is wide - * but any 3fg touch+click counts as middle */ - litest_touch_down(dev, 0, 5, 99); - litest_touch_down(dev, 1, 90, 15); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_clickfinger_4fg_tool_position) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_clickfinger(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 5, 99); - litest_touch_down(dev, 1, 90, 15); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_clickfinger_appletouch_config) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - uint32_t methods, method; - enum libinput_config_status status; - - methods = libinput_device_config_click_get_methods(device); - ck_assert(!(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS)); - ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); - - method = libinput_device_config_click_get_method(device); - ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); - - status = libinput_device_config_click_set_method(device, - LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - status = libinput_device_config_click_set_method(device, - LIBINPUT_CONFIG_CLICK_METHOD_NONE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); -} -END_TEST - -START_TEST(touchpad_clickfinger_appletouch_1fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_clickfinger_appletouch_2fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 50, 50); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_clickfinger_appletouch_3fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 50, 50); - litest_touch_down(dev, 2, 50, 50); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 2); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_btn_left) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(clickpad_btn_left) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_buttonareas(dev); - - litest_drain_events(li); - - /* A clickpad always needs a finger down to tell where the - click happens */ - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - ck_assert_int_eq(libinput_next_event_type(li), LIBINPUT_EVENT_NONE); -} -END_TEST - -START_TEST(clickpad_click_n_drag) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - libinput_dispatch(li); - ck_assert_int_eq(libinput_next_event_type(li), LIBINPUT_EVENT_NONE); - - /* now put a second finger down */ - litest_touch_down(dev, 1, 70, 70); - litest_touch_move_to(dev, 1, 70, 70, 80, 50, 5, 0); - litest_touch_up(dev, 1); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(clickpad_finger_pin) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libevdev *evdev = dev->evdev; - const struct input_absinfo *abs; - double w, h; - double dist; - - abs = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X); - ck_assert_notnull(abs); - if (abs->resolution == 0) - return; - - if (libinput_device_get_size(dev->libinput_device, &w, &h) != 0) - return; - - dist = 100.0/max(w, h); - - litest_drain_events(li); - - /* make sure the movement generates pointer events when - not pinned */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 52, 52, 10, 1); - litest_touch_move_to(dev, 0, 52, 52, 48, 48, 10, 1); - litest_touch_move_to(dev, 0, 48, 48, 50, 50, 10, 1); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_button_click(dev, BTN_LEFT, true); - litest_drain_events(li); - - litest_touch_move_to(dev, 0, 50, 50, 50 + dist, 50 + dist, 10, 1); - litest_touch_move_to(dev, 0, 50 + dist, 50 + dist, 50, 50, 10, 1); - litest_touch_move_to(dev, 0, 50, 50, 50 - dist, 50 - dist, 10, 1); - - litest_assert_empty_queue(li); - - litest_button_click(dev, BTN_LEFT, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); - - /* still pinned after release */ - litest_touch_move_to(dev, 0, 50, 50, 50 + dist, 50 + dist, 10, 1); - litest_touch_move_to(dev, 0, 50 + dist, 50 + dist, 50, 50, 10, 1); - litest_touch_move_to(dev, 0, 50, 50, 50 - dist, 50 - dist, 10, 1); - - litest_assert_empty_queue(li); - - /* move to unpin */ - litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10, 1); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(clickpad_softbutton_left) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 10, 90); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_softbutton_middle) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 90); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_softbutton_right) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 90, 90); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_softbutton_left_tap_n_drag) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(li); - - /* Tap in left button area, then finger down, button click - -> expect left button press/release and left button press - Release button, finger up - -> expect right button release - */ - litest_touch_down(dev, 0, 20, 90); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 20, 90); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_softbutton_right_tap_n_drag) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(li); - - /* Tap in right button area, then finger down, button click - -> expect left button press/release and right button press - Release button, finger up - -> expect right button release - */ - litest_touch_down(dev, 0, 90, 90); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 90, 90); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_softbutton_left_1st_fg_move) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - double x = 0, y = 0; - int nevents = 0; - - litest_drain_events(li); - - /* One finger down in the left button area, button press - -> expect a button event - Move finger up out of the area, wait for timeout - Move finger around diagonally down left - -> expect motion events down left - Release finger - -> expect a button event */ - - /* finger down, press in left button */ - litest_touch_down(dev, 0, 20, 90); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - /* move out of the area, then wait for softbutton timer */ - litest_touch_move_to(dev, 0, 20, 90, 90, 20, 10, 0); - libinput_dispatch(li); - litest_timeout_softbuttons(); - libinput_dispatch(li); - litest_drain_events(li); - - /* move down left, expect motion */ - litest_touch_move_to(dev, 0, 90, 20, 20, 90, 10, 0); - - libinput_dispatch(li); - event = libinput_get_event(li); - ck_assert(event != NULL); - while (event) { - struct libinput_event_pointer *p; - - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_MOTION); - p = libinput_event_get_pointer_event(event); - - /* we moved up/right, now down/left so the pointer accel - code may lag behind with the dx/dy vectors. Hence, add up - the x/y movements and expect that on average we moved - left and down */ - x += libinput_event_pointer_get_dx(p); - y += libinput_event_pointer_get_dy(p); - nevents++; - - libinput_event_destroy(event); - libinput_dispatch(li); - event = libinput_get_event(li); - } - - ck_assert(x/nevents < 0); - ck_assert(y/nevents > 0); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_softbutton_left_2nd_fg_move) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - - litest_drain_events(li); - - /* One finger down in the left button area, button press - -> expect a button event - Put a second finger down in the area, move it right, release - -> expect motion events right - Put a second finger down in the area, move it down, release - -> expect motion events down - Release second finger, release first finger - -> expect a button event */ - litest_touch_down(dev, 0, 20, 90); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 1, 20, 20); - litest_touch_move_to(dev, 1, 20, 20, 80, 20, 10, 0); - - libinput_dispatch(li); - event = libinput_get_event(li); - ck_assert(event != NULL); - while (event) { - struct libinput_event_pointer *p; - double x, y; - - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_MOTION); - p = libinput_event_get_pointer_event(event); - - x = libinput_event_pointer_get_dx(p); - y = libinput_event_pointer_get_dy(p); - - /* Ignore events only containing an unaccelerated motion - * vector. */ - if (x != 0 || y != 0) { - ck_assert(x > 0); - ck_assert(y == 0); - } - - libinput_event_destroy(event); - libinput_dispatch(li); - event = libinput_get_event(li); - } - litest_touch_up(dev, 1); - - /* second finger down */ - litest_touch_down(dev, 1, 20, 20); - litest_touch_move_to(dev, 1, 20, 20, 20, 80, 10, 0); - - libinput_dispatch(li); - event = libinput_get_event(li); - ck_assert(event != NULL); - while (event) { - struct libinput_event_pointer *p; - double x, y; - - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_MOTION); - p = libinput_event_get_pointer_event(event); - - x = libinput_event_pointer_get_dx(p); - y = libinput_event_pointer_get_dy(p); - - ck_assert(x == 0); - ck_assert(y > 0); - - libinput_event_destroy(event); - libinput_dispatch(li); - event = libinput_get_event(li); - } - - litest_touch_up(dev, 1); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_softbutton_left_to_right) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - /* One finger down in left software button area, - move to right button area immediately, click - -> expect right button event - */ - - litest_touch_down(dev, 0, 20, 90); - litest_touch_move_to(dev, 0, 20, 90, 90, 90, 10, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_softbutton_right_to_left) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - /* One finger down in right software button area, - move to left button area immediately, click - -> expect left button event - */ - - litest_touch_down(dev, 0, 90, 90); - litest_touch_move_to(dev, 0, 90, 90, 20, 90, 10, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_softbutton_hover_into_buttons) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_hover_start(dev, 0, 50, 50); - libinput_dispatch(li); - litest_hover_move_to(dev, 0, 50, 50, 90, 90, 10, 0); - libinput_dispatch(li); - - litest_touch_move_to(dev, 0, 90, 90, 91, 91, 1, 0); - - litest_button_click(dev, BTN_LEFT, true); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_button_click(dev, BTN_LEFT, false); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(clickpad_topsoftbuttons_left) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 10, 5); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_topsoftbuttons_right) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 90, 5); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_topsoftbuttons_middle) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 5); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_topsoftbuttons_move_out_leftclick_before_timeout) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - /* Finger down in top right button area, wait past enter timeout - Move into main area, wait past leave timeout - Click - -> expect left click - */ - - litest_drain_events(li); - - litest_touch_down(dev, 0, 80, 5); - libinput_dispatch(li); - litest_timeout_softbuttons(); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - litest_touch_move_to(dev, 0, 80, 5, 80, 90, 20, 0); - libinput_dispatch(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_touch_up(dev, 0); - - litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(clickpad_topsoftbuttons_move_out_leftclick) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - /* Finger down in top right button area, wait past enter timeout - Move into main area, wait past leave timeout - Click - -> expect left click - */ - - litest_drain_events(li); - - litest_touch_down(dev, 0, 80, 5); - libinput_dispatch(li); - litest_timeout_softbuttons(); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - litest_touch_move_to(dev, 0, 80, 5, 80, 90, 20, 0); - libinput_dispatch(li); - litest_timeout_softbuttons(); - libinput_dispatch(li); - - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_touch_up(dev, 0); - - litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(clickpad_topsoftbuttons_clickfinger) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 90, 5); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 90, 5); - litest_touch_down(dev, 1, 80, 5); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(clickpad_topsoftbuttons_clickfinger_dev_disabled) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct litest_device *trackpoint = litest_add_device(li, - LITEST_TRACKPOINT); - - libinput_device_config_send_events_set_mode(dev->libinput_device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - litest_enable_clickfinger(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 90, 5); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 90, 5); - litest_touch_down(dev, 1, 10, 5); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_delete_device(trackpoint); -} -END_TEST - -START_TEST(clickpad_middleemulation_config_delayed) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - int enabled; - - enabled = libinput_device_config_middle_emulation_get_enabled(device); - ck_assert(!enabled); - - litest_touch_down(dev, 0, 30, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - /* actual config is delayed, but status is immediate */ - status = libinput_device_config_middle_emulation_set_enabled(device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - enabled = libinput_device_config_middle_emulation_get_enabled(device); - ck_assert(enabled); - - status = libinput_device_config_middle_emulation_set_enabled(device, - LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - enabled = libinput_device_config_middle_emulation_get_enabled(device); - ck_assert(!enabled); -} -END_TEST - -START_TEST(clickpad_middleemulation_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_buttonareas(dev); - litest_enable_middleemu(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 30, 95); - litest_touch_down(dev, 1, 80, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_middleemulation_click_middle_left) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_buttonareas(dev); - litest_enable_middleemu(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 49, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_middleemulation_click_middle_right) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_buttonareas(dev); - litest_enable_middleemu(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 51, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_middleemulation_click_enable_while_down) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_buttonareas(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 49, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_enable_middleemu(dev); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 49, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - libinput_dispatch(li); -} -END_TEST - -START_TEST(clickpad_middleemulation_click_disable_while_down) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_buttonareas(dev); - litest_enable_middleemu(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 30, 95); - litest_touch_down(dev, 1, 70, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_disable_middleemu(dev); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - libinput_dispatch(li); - - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 49, 95); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - - libinput_dispatch(li); -} -END_TEST - -void -litest_setup_tests_touchpad_buttons(void) -{ - litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger_no_touch, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", touchpad_2fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", touchpad_3fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", touchpad_3fg_clickfinger_btntool, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", touchpad_4fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", touchpad_4fg_clickfinger_btntool_2slots, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", touchpad_4fg_clickfinger_btntool_3slots, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", touchpad_2fg_clickfinger_distance, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", touchpad_3fg_clickfinger_distance, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", touchpad_3fg_clickfinger_distance_btntool, LITEST_CLICKPAD, LITEST_ANY); - litest_add_for_device("touchpad:clickfinger", touchpad_2fg_clickfinger_bottom, LITEST_SYNAPTICS_TOPBUTTONPAD); - litest_add("touchpad:clickfinger", touchpad_clickfinger_to_area_method, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", - touchpad_clickfinger_to_area_method_while_down, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", touchpad_area_to_clickfinger_method, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:clickfinger", - touchpad_area_to_clickfinger_method_while_down, LITEST_CLICKPAD, LITEST_ANY); - /* run those two for the T440 one only so we don't have to worry - * about small touchpads messing with thumb detection expectations */ - litest_add_for_device("touchpad:clickfinger", touchpad_clickfinger_3fg_tool_position, LITEST_SYNAPTICS_TOPBUTTONPAD); - litest_add_for_device("touchpad:clickfinger", touchpad_clickfinger_4fg_tool_position, LITEST_SYNAPTICS_TOPBUTTONPAD); - - litest_add_for_device("touchpad:clickfinger", touchpad_clickfinger_appletouch_config, LITEST_APPLETOUCH); - litest_add_for_device("touchpad:clickfinger", touchpad_clickfinger_appletouch_1fg, LITEST_APPLETOUCH); - litest_add_for_device("touchpad:clickfinger", touchpad_clickfinger_appletouch_2fg, LITEST_APPLETOUCH); - litest_add_for_device("touchpad:clickfinger", touchpad_clickfinger_appletouch_3fg, LITEST_APPLETOUCH); - - litest_add("touchpad:click", touchpad_click_defaults_clickfinger, LITEST_APPLE_CLICKPAD, LITEST_ANY); - litest_add("touchpad:click", touchpad_click_defaults_btnarea, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - litest_add("touchpad:click", touchpad_click_defaults_none, LITEST_TOUCHPAD, LITEST_CLICKPAD); - litest_add("touchpad:click", touchpad_click_defaults_none, LITEST_ANY, LITEST_TOUCHPAD); - - litest_add("touchpad:click", touchpad_btn_left, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); - litest_add("touchpad:click", clickpad_btn_left, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:click", clickpad_click_n_drag, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:click", clickpad_finger_pin, LITEST_CLICKPAD, LITEST_ANY); - - litest_add("touchpad:softbutton", clickpad_softbutton_left, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - litest_add("touchpad:softbutton", clickpad_softbutton_middle, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - litest_add("touchpad:softbutton", clickpad_softbutton_right, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - litest_add("touchpad:softbutton", clickpad_softbutton_left_tap_n_drag, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - litest_add("touchpad:softbutton", clickpad_softbutton_right_tap_n_drag, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - litest_add("touchpad:softbutton", clickpad_softbutton_left_1st_fg_move, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - litest_add("touchpad:softbutton", clickpad_softbutton_left_2nd_fg_move, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - litest_add("touchpad:softbutton", clickpad_softbutton_left_to_right, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - litest_add("touchpad:softbutton", clickpad_softbutton_right_to_left, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - litest_add("touchpad:softbutton", clickpad_softbutton_hover_into_buttons, LITEST_CLICKPAD|LITEST_HOVER, LITEST_APPLE_CLICKPAD); - - litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_left, LITEST_TOPBUTTONPAD, LITEST_ANY); - litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_right, LITEST_TOPBUTTONPAD, LITEST_ANY); - litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_middle, LITEST_TOPBUTTONPAD, LITEST_ANY); - litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_move_out_leftclick, LITEST_TOPBUTTONPAD, LITEST_ANY); - litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_move_out_leftclick_before_timeout, LITEST_TOPBUTTONPAD, LITEST_ANY); - litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_clickfinger, LITEST_TOPBUTTONPAD, LITEST_ANY); - litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_clickfinger_dev_disabled, LITEST_TOPBUTTONPAD, LITEST_ANY); - - litest_add("touchpad:middleemulation", clickpad_middleemulation_config_delayed, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:middleemulation", clickpad_middleemulation_click, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:middleemulation", clickpad_middleemulation_click_middle_left, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:middleemulation", clickpad_middleemulation_click_middle_right, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:middleemulation", clickpad_middleemulation_click_enable_while_down, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:middleemulation", clickpad_middleemulation_click_disable_while_down, LITEST_CLICKPAD, LITEST_ANY); -} diff -Nru libinput-1.10.3/test/test-touchpad.c libinput-0.21.0/test/test-touchpad.c --- libinput-1.10.3/test/test-touchpad.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-touchpad.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,5883 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include -#include -#include -#include - -#include "libinput-util.h" -#include "litest.h" - -static inline bool -has_disable_while_typing(struct litest_device *device) -{ - return libinput_device_config_dwt_is_available(device->libinput_device); -} - -static inline struct litest_device * -dwt_init_paired_keyboard(struct libinput *li, - struct litest_device *touchpad) -{ - enum litest_device_type which = LITEST_KEYBOARD; - - if (libevdev_get_id_vendor(touchpad->evdev) == VENDOR_ID_APPLE) - which = LITEST_APPLE_KEYBOARD; - - if (libevdev_get_id_vendor(touchpad->evdev) == VENDOR_ID_CHICONY) - which = LITEST_ACER_HAWAII_KEYBOARD; - - return litest_add_device(li, which); -} - -START_TEST(touchpad_1fg_motion) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - - litest_disable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 80, 50, 20, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - event = libinput_get_event(li); - ck_assert(event != NULL); - - while (event) { - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_MOTION); - - ptrev = libinput_event_get_pointer_event(event); - ck_assert_int_ge(libinput_event_pointer_get_dx(ptrev), 0); - ck_assert_int_eq(libinput_event_pointer_get_dy(ptrev), 0); - libinput_event_destroy(event); - event = libinput_get_event(li); - } -} -END_TEST - -START_TEST(touchpad_2fg_no_motion) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - - libinput_device_config_tap_set_enabled(dev->libinput_device, - LIBINPUT_CONFIG_TAP_DISABLED); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 20, 20); - litest_touch_down(dev, 1, 70, 20); - litest_touch_move_to(dev, 0, 20, 20, 80, 80, 20, 0); - litest_touch_move_to(dev, 1, 70, 20, 80, 50, 20, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - event = libinput_get_event(li); - while (event) { - ck_assert_int_ne(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_MOTION); - libinput_event_destroy(event); - event = libinput_get_event(li); - } -} -END_TEST - -static void -test_2fg_scroll(struct litest_device *dev, double dx, double dy, int want_sleep) -{ - struct libinput *li = dev->libinput; - - litest_touch_down(dev, 0, 49, 50); - litest_touch_down(dev, 1, 51, 50); - - litest_touch_move_two_touches(dev, 49, 50, 51, 50, dx, dy, 10, 0); - - /* Avoid a small scroll being seen as a tap */ - if (want_sleep) { - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - } - - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); -} - -START_TEST(touchpad_2fg_scroll) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - litest_drain_events(li); - - test_2fg_scroll(dev, 0.1, 40, 0); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 10); - test_2fg_scroll(dev, 0.1, -40, 0); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -10); - test_2fg_scroll(dev, 40, 0.1, 0); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 10); - test_2fg_scroll(dev, -40, 0.1, 0); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -10); - - /* 2fg scroll smaller than the threshold should not generate events */ - test_2fg_scroll(dev, 0.1, 0.1, 1); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_2fg_scroll_diagonal) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - int i; - - if (!litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 45, 30); - litest_touch_down(dev, 1, 55, 30); - - litest_touch_move_two_touches(dev, 45, 30, 55, 30, 10, 10, 10, 0); - libinput_dispatch(li); - litest_wait_for_event_of_type(li, - LIBINPUT_EVENT_POINTER_AXIS, - -1); - litest_drain_events(li); - - /* get rid of any touch history still adding x deltas sideways */ - for (i = 0; i < 5; i++) - litest_touch_move(dev, 0, 55, 41 + i); - litest_drain_events(li); - - for (i = 6; i < 10; i++) { - litest_touch_move(dev, 0, 55, 41 + i); - libinput_dispatch(li); - - event = libinput_get_event(li); - ptrev = litest_is_axis_event(event, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, - LIBINPUT_POINTER_AXIS_SOURCE_FINGER); - ck_assert(!libinput_event_pointer_has_axis(ptrev, - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)); - libinput_event_destroy(event); - } - - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - libinput_dispatch(li); -} -END_TEST - -START_TEST(touchpad_2fg_scroll_slow_distance) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - double width, height; - double y_move = 100; - - if (!litest_has_2fg_scroll(dev)) - return; - - /* We want to move > 5 mm. */ - ck_assert_int_eq(libinput_device_get_size(dev->libinput_device, - &width, - &height), 0); - y_move = 100.0/height * 7; - - litest_enable_2fg_scroll(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 49, 50); - litest_touch_down(dev, 1, 51, 50); - litest_touch_move_two_touches(dev, 49, 50, 51, 50, 0, y_move, 100, 10); - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - ck_assert_notnull(event); - - /* last event is value 0, tested elsewhere */ - while (libinput_next_event_type(li) != LIBINPUT_EVENT_NONE) { - double axisval; - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_AXIS); - ptrev = libinput_event_get_pointer_event(event); - - axisval = libinput_event_pointer_get_axis_value(ptrev, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); - ck_assert(axisval > 0.0); - - /* this is to verify we test the right thing, if the value - is greater than scroll.threshold we triggered the wrong - condition */ - ck_assert(axisval < 5.0); - - libinput_event_destroy(event); - event = libinput_get_event(li); - } - - litest_assert_empty_queue(li); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(touchpad_2fg_scroll_source) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - - if (!litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - litest_drain_events(li); - - test_2fg_scroll(dev, 0, 30, 0); - litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS, -1); - - while ((event = libinput_get_event(li))) { - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_AXIS); - ptrev = libinput_event_get_pointer_event(event); - ck_assert_int_eq(libinput_event_pointer_get_axis_source(ptrev), - LIBINPUT_POINTER_AXIS_SOURCE_FINGER); - libinput_event_destroy(event); - } -} -END_TEST - -START_TEST(touchpad_2fg_scroll_semi_mt) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 20, 20); - litest_touch_down(dev, 1, 30, 20); - libinput_dispatch(li); - litest_touch_move_two_touches(dev, - 20, 20, - 30, 20, - 30, 40, - 10, 1); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); -} -END_TEST - -START_TEST(touchpad_2fg_scroll_return_to_motion) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - litest_drain_events(li); - - /* start with motion */ - litest_touch_down(dev, 0, 70, 70); - litest_touch_move_to(dev, 0, 70, 70, 49, 50, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - /* 2fg scroll */ - litest_touch_down(dev, 1, 51, 50); - litest_touch_move_two_touches(dev, 49, 50, 51, 50, 0, 20, 5, 0); - litest_touch_up(dev, 1); - libinput_dispatch(li); - litest_timeout_finger_switch(); - libinput_dispatch(li); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - - litest_touch_move_to(dev, 0, 49, 70, 49, 50, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - /* back to 2fg scroll, lifting the other finger */ - litest_touch_down(dev, 1, 51, 50); - litest_touch_move_two_touches(dev, 49, 50, 51, 50, 0, 20, 5, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_timeout_finger_switch(); - libinput_dispatch(li); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - - /* move with second finger */ - litest_touch_move_to(dev, 1, 51, 70, 51, 50, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 1); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_scroll_natural_defaults) -{ - struct litest_device *dev = litest_current_device(); - - ck_assert_int_ge(libinput_device_config_scroll_has_natural_scroll(dev->libinput_device), 1); - ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); - ck_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), 0); -} -END_TEST - -START_TEST(touchpad_scroll_natural_enable_config) -{ - struct litest_device *dev = litest_current_device(); - enum libinput_config_status status; - - status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 1); - - status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 0); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); -} -END_TEST - -START_TEST(touchpad_scroll_natural_2fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - litest_drain_events(li); - - libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1); - - test_2fg_scroll(dev, 0.1, 40, 0); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -10); - test_2fg_scroll(dev, 0.1, -40, 0); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 10); - test_2fg_scroll(dev, 40, 0.1, 0); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -10); - test_2fg_scroll(dev, -40, 0.1, 0); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 10); - -} -END_TEST - -START_TEST(touchpad_scroll_natural_edge) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_edge_scroll(dev); - litest_drain_events(li); - - libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1); - - litest_touch_down(dev, 0, 99, 20); - litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -4); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 99, 80); - litest_touch_move_to(dev, 0, 99, 80, 99, 20, 10, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 4); - litest_assert_empty_queue(li); - -} -END_TEST - -START_TEST(touchpad_edge_scroll_vert) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_touch_down(dev, 0, 99, 20); - litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0); - litest_touch_up(dev, 0); - - litest_drain_events(li); - litest_enable_edge_scroll(dev); - - litest_touch_down(dev, 0, 99, 20); - litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 4); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 99, 80); - litest_touch_move_to(dev, 0, 99, 80, 99, 20, 10, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -4); - litest_assert_empty_queue(li); -} -END_TEST - -static int -touchpad_has_horiz_edge_scroll_size(struct litest_device *dev) -{ - double width, height; - int rc; - - rc = libinput_device_get_size(dev->libinput_device, &width, &height); - - return rc == 0 && height >= 40; -} - -START_TEST(touchpad_edge_scroll_horiz) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_touch_down(dev, 0, 99, 20); - litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0); - litest_touch_up(dev, 0); - - if (!touchpad_has_horiz_edge_scroll_size(dev)) - return; - - litest_drain_events(li); - litest_enable_edge_scroll(dev); - - litest_touch_down(dev, 0, 20, 99); - litest_touch_move_to(dev, 0, 20, 99, 70, 99, 10, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 4); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 70, 99); - litest_touch_move_to(dev, 0, 70, 99, 20, 99, 10, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -4); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_edge_scroll_horiz_clickpad) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - litest_enable_edge_scroll(dev); - - litest_touch_down(dev, 0, 20, 99); - litest_touch_move_to(dev, 0, 20, 99, 70, 99, 10, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 4); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 70, 99); - litest_touch_move_to(dev, 0, 70, 99, 20, 99, 10, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -4); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_edge_scroll_no_horiz) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (touchpad_has_horiz_edge_scroll_size(dev)) - return; - - litest_drain_events(li); - litest_enable_edge_scroll(dev); - - litest_touch_down(dev, 0, 20, 99); - litest_touch_move_to(dev, 0, 20, 99, 70, 99, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_down(dev, 0, 70, 99); - litest_touch_move_to(dev, 0, 70, 99, 20, 99, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_scroll_defaults) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - struct libevdev *evdev = dev->evdev; - enum libinput_config_scroll_method method, expected; - enum libinput_config_status status; - bool should_have_2fg = false; - - if (libevdev_get_num_slots(evdev) > 1 || - (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE && - libevdev_get_id_product(dev->evdev) == PRODUCT_ID_APPLE_APPLETOUCH)) - should_have_2fg = true; - - method = libinput_device_config_scroll_get_methods(device); - ck_assert(method & LIBINPUT_CONFIG_SCROLL_EDGE); - if (should_have_2fg) - ck_assert(method & LIBINPUT_CONFIG_SCROLL_2FG); - else - ck_assert((method & LIBINPUT_CONFIG_SCROLL_2FG) == 0); - - if (should_have_2fg) - expected = LIBINPUT_CONFIG_SCROLL_2FG; - else - expected = LIBINPUT_CONFIG_SCROLL_EDGE; - - method = libinput_device_config_scroll_get_method(device); - ck_assert_int_eq(method, expected); - method = libinput_device_config_scroll_get_default_method(device); - ck_assert_int_eq(method, expected); - - status = libinput_device_config_scroll_set_method(device, - LIBINPUT_CONFIG_SCROLL_EDGE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - status = libinput_device_config_scroll_set_method(device, - LIBINPUT_CONFIG_SCROLL_2FG); - - if (should_have_2fg) - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - else - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); -} -END_TEST - -START_TEST(touchpad_edge_scroll_timeout) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - double width = 0, height = 0; - int nevents = 0; - double mm; /* one mm in percent of the device */ - - ck_assert_int_eq(libinput_device_get_size(dev->libinput_device, - &width, - &height), 0); - mm = 100.0/height; - - /* timeout-based scrolling is disabled when software buttons are - * active, so switch to clickfinger. Not all test devices support - * that, hence the extra check. */ - if (libinput_device_config_click_get_methods(dev->libinput_device) & - LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER) - litest_enable_clickfinger(dev); - - litest_drain_events(li); - litest_enable_edge_scroll(dev); - - /* move 0.5mm, enough to load up the motion history, but less than - * the scroll threshold of 2mm */ - litest_touch_down(dev, 0, 99, 20); - libinput_dispatch(li); - litest_timeout_hysteresis(); - libinput_dispatch(li); - - litest_touch_move_to(dev, 0, 99, 20, 99, 20 + mm/2, 8, 0); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - litest_timeout_edgescroll(); - libinput_dispatch(li); - - litest_assert_empty_queue(li); - - /* now move slowly up to the 2mm scroll threshold. we expect events */ - litest_touch_move_to(dev, 0, 99, 20 + mm/2, 99, 20 + mm * 2, 20, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS, -1); - - while ((event = libinput_get_event(li))) { - double value; - - ptrev = litest_is_axis_event(event, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, - 0); - value = libinput_event_pointer_get_axis_value(ptrev, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); - ck_assert_double_lt(value, 5.0); - libinput_event_destroy(event); - nevents++; - } - - /* we sent 20 events but allow for some to be swallowed by rounding - * errors, the hysteresis, etc. */ - ck_assert_int_ge(nevents, 10); - - litest_assert_empty_queue(li); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(touchpad_edge_scroll_no_motion) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - litest_enable_edge_scroll(dev); - - litest_touch_down(dev, 0, 99, 10); - litest_touch_move_to(dev, 0, 99, 10, 99, 70, 12, 0); - /* moving outside -> no motion event */ - litest_touch_move_to(dev, 0, 99, 70, 20, 70, 12, 0); - /* moving down outside edge once scrolling had started -> scroll */ - litest_touch_move_to(dev, 0, 20, 70, 40, 99, 12, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 4); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_edge_scroll_no_edge_after_motion) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - litest_enable_edge_scroll(dev); - - /* moving into the edge zone must not trigger scroll events */ - litest_touch_down(dev, 0, 20, 20); - litest_touch_move_to(dev, 0, 20, 20, 99, 20, 12, 0); - litest_touch_move_to(dev, 0, 99, 20, 99, 80, 12, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_edge_scroll_source) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - - litest_drain_events(li); - litest_enable_edge_scroll(dev); - - litest_touch_down(dev, 0, 99, 20); - litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0); - litest_touch_up(dev, 0); - - litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS, -1); - - while ((event = libinput_get_event(li))) { - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_AXIS); - ptrev = libinput_event_get_pointer_event(event); - ck_assert_int_eq(libinput_event_pointer_get_axis_source(ptrev), - LIBINPUT_POINTER_AXIS_SOURCE_FINGER); - libinput_event_destroy(event); - } -} -END_TEST - -START_TEST(touchpad_edge_scroll_no_2fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - litest_enable_edge_scroll(dev); - - litest_touch_down(dev, 0, 49, 50); - litest_touch_down(dev, 1, 51, 50); - litest_touch_move_two_touches(dev, 49, 50, 51, 50, 20, 30, 5, 0); - libinput_dispatch(li); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_edge_scroll_into_buttonareas) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_buttonareas(dev); - litest_enable_edge_scroll(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 99, 40); - litest_touch_move_to(dev, 0, 99, 40, 99, 95, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - /* in the button zone now, make sure we still get events */ - litest_touch_move_to(dev, 0, 99, 95, 99, 100, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - - /* and out of the zone again */ - litest_touch_move_to(dev, 0, 99, 100, 99, 70, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - - /* still out of the zone */ - litest_touch_move_to(dev, 0, 99, 70, 99, 50, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); -} -END_TEST - -START_TEST(touchpad_edge_scroll_within_buttonareas) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_horiz_edge_scroll_size(dev)) - return; - - litest_enable_buttonareas(dev); - litest_enable_edge_scroll(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 20, 99); - - /* within left button */ - litest_touch_move_to(dev, 0, 20, 99, 40, 99, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - - /* over to right button */ - litest_touch_move_to(dev, 0, 40, 99, 60, 99, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - - /* within right button */ - litest_touch_move_to(dev, 0, 60, 99, 80, 99, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); -} -END_TEST - -START_TEST(touchpad_edge_scroll_buttonareas_click_stops_scroll) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - double val; - - if (!touchpad_has_horiz_edge_scroll_size(dev)) - return; - - litest_enable_buttonareas(dev); - litest_enable_edge_scroll(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 20, 95); - litest_touch_move_to(dev, 0, 20, 95, 70, 95, 10, 5); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - - litest_button_click(dev, BTN_LEFT, true); - libinput_dispatch(li); - - event = libinput_get_event(li); - ptrev = litest_is_axis_event(event, - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, - LIBINPUT_POINTER_AXIS_SOURCE_FINGER); - val = libinput_event_pointer_get_axis_value(ptrev, - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL); - ck_assert(val == 0.0); - libinput_event_destroy(event); - - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - - libinput_event_destroy(event); - - /* within button areas -> no movement */ - litest_touch_move_to(dev, 0, 70, 95, 90, 95, 10, 0); - litest_assert_empty_queue(li); - - litest_button_click(dev, BTN_LEFT, false); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); - - litest_touch_up(dev, 0); -} -END_TEST - -START_TEST(touchpad_edge_scroll_clickfinger_click_stops_scroll) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - double val; - - if (!touchpad_has_horiz_edge_scroll_size(dev)) - return; - - litest_enable_clickfinger(dev); - litest_enable_edge_scroll(dev); - litest_drain_events(li); - - litest_touch_down(dev, 0, 20, 95); - litest_touch_move_to(dev, 0, 20, 95, 70, 95, 10, 5); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - - litest_button_click(dev, BTN_LEFT, true); - libinput_dispatch(li); - - event = libinput_get_event(li); - ptrev = litest_is_axis_event(event, - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, - LIBINPUT_POINTER_AXIS_SOURCE_FINGER); - val = libinput_event_pointer_get_axis_value(ptrev, - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL); - ck_assert(val == 0.0); - libinput_event_destroy(event); - - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - libinput_event_destroy(event); - - /* clickfinger releases pointer -> expect movement */ - litest_touch_move_to(dev, 0, 70, 95, 90, 95, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - litest_assert_empty_queue(li); - - litest_button_click(dev, BTN_LEFT, false); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); - - litest_touch_up(dev, 0); -} -END_TEST - -START_TEST(touchpad_edge_scroll_into_area) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_edge_scroll(dev); - litest_drain_events(li); - - /* move into area, move vertically, move back to edge */ - - litest_touch_down(dev, 0, 99, 20); - litest_touch_move_to(dev, 0, 99, 20, 99, 50, 15, 2); - litest_touch_move_to(dev, 0, 99, 50, 20, 50, 15, 2); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_AXIS); - litest_touch_move_to(dev, 0, 20, 50, 20, 20, 15, 2); - litest_touch_move_to(dev, 0, 20, 20, 99, 20, 15, 2); - litest_assert_empty_queue(li); - - litest_touch_move_to(dev, 0, 99, 20, 99, 50, 15, 2); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_AXIS); -} -END_TEST - -static int -touchpad_has_palm_detect_size(struct litest_device *dev) -{ - double width, height; - unsigned int vendor; - unsigned int bustype; - int rc; - - vendor = libinput_device_get_id_vendor(dev->libinput_device); - bustype = libevdev_get_id_bustype(dev->evdev); - if (vendor == VENDOR_ID_WACOM) - return 0; - if (bustype == BUS_BLUETOOTH) - return 0; - if (vendor == VENDOR_ID_APPLE) - return 1; - - rc = libinput_device_get_size(dev->libinput_device, &width, &height); - - return rc == 0 && width >= 70; -} - -START_TEST(touchpad_palm_detect_at_edge) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev) || - !litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - - litest_disable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 99, 50); - litest_touch_move_to(dev, 0, 99, 50, 99, 70, 5, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 5, 50); - litest_touch_move_to(dev, 0, 5, 50, 5, 70, 5, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_at_top) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev)) - return; - - litest_disable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 20, 1); - litest_touch_move_to(dev, 0, 20, 1, 70, 1, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_no_palm_detect_at_edge_for_edge_scrolling) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev)) - return; - - litest_enable_edge_scroll(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 99, 50); - litest_touch_move_to(dev, 0, 99, 50, 99, 70, 5, 0); - litest_touch_up(dev, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); -} -END_TEST - -START_TEST(touchpad_palm_detect_at_bottom_corners) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev) || - !litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - - litest_disable_tap(dev->libinput_device); - - /* Run for non-clickpads only: make sure the bottom corners trigger - palm detection too */ - litest_drain_events(li); - - litest_touch_down(dev, 0, 99, 95); - litest_touch_move_to(dev, 0, 99, 95, 99, 99, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 5, 95); - litest_touch_move_to(dev, 0, 5, 95, 5, 99, 5, 0); - litest_touch_up(dev, 0); -} -END_TEST - -START_TEST(touchpad_palm_detect_at_top_corners) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev) || - !litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - - litest_disable_tap(dev->libinput_device); - - /* Run for non-clickpads only: make sure the bottom corners trigger - palm detection too */ - litest_drain_events(li); - - litest_touch_down(dev, 0, 99, 5); - litest_touch_move_to(dev, 0, 99, 5, 99, 9, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 5, 5); - litest_touch_move_to(dev, 0, 5, 5, 5, 9, 5, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_palm_stays_palm) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev) || - !litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - - litest_disable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 99, 20); - litest_touch_move_to(dev, 0, 99, 20, 75, 99, 10, 0); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_top_palm_stays_palm) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev)) - return; - - litest_disable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 20, 1); - litest_touch_move_to(dev, 0, 20, 1, 90, 30, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_palm_becomes_pointer) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev) || - !litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - - litest_disable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 99, 50); - litest_touch_move_to(dev, 0, 99, 50, 0, 70, 20, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_top_palm_becomes_pointer) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev)) - return; - - litest_disable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 1); - litest_touch_move_to(dev, 0, 50, 1, 50, 60, 20, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_no_palm_moving_into_edges) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev)) - return; - - litest_disable_tap(dev->libinput_device); - - /* moving non-palm into the edge does not label it as palm */ - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 99, 50, 10, 0); - - litest_drain_events(li); - - litest_touch_move_to(dev, 0, 99, 50, 99, 90, 10, 0); - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_no_palm_moving_into_top) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev)) - return; - - litest_disable_tap(dev->libinput_device); - - /* moving non-palm into the edge does not label it as palm */ - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 0, 2, 10, 0); - - litest_drain_events(li); - - litest_touch_move_to(dev, 0, 0, 2, 50, 50, 10, 0); - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_no_tap_top_edge) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev)) - return; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 1); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_tap_hardbuttons) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev)) - return; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 95, 5); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 5, 5); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 5, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 95, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_tap_softbuttons) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_enable_buttonareas(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 99, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 1, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 10, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 90, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_tap_clickfinger) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 95, 5); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 5, 5); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 5, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 95, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_no_palm_detect_2fg_scroll) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev) || - !litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - - litest_drain_events(li); - - /* first finger is palm, second finger isn't so we trigger 2fg - * scrolling */ - litest_touch_down(dev, 0, 99, 50); - litest_touch_move_to(dev, 0, 99, 50, 99, 40, 35, 12); - litest_touch_move_to(dev, 0, 99, 40, 99, 50, 35, 12); - litest_assert_empty_queue(li); - litest_touch_down(dev, 1, 50, 50); - litest_assert_empty_queue(li); - - litest_touch_move_two_touches(dev, 99, 50, 50, 50, 0, -20, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); -} -END_TEST - -START_TEST(touchpad_palm_detect_both_edges) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_palm_detect_size(dev) || - !litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - - litest_drain_events(li); - - /* two fingers moving up/down in the left/right palm zone must not - * generate events */ - litest_touch_down(dev, 0, 99, 50); - litest_touch_move_to(dev, 0, 99, 50, 99, 40, 10, 0); - litest_touch_move_to(dev, 0, 99, 40, 99, 50, 10, 0); - litest_assert_empty_queue(li); - /* This set generates events */ - litest_touch_down(dev, 1, 1, 50); - litest_touch_move_to(dev, 1, 1, 50, 1, 40, 10, 0); - litest_touch_move_to(dev, 1, 1, 40, 1, 50, 10, 0); - litest_assert_empty_queue(li); - - litest_touch_move_two_touches(dev, 99, 50, 1, 50, 0, -20, 10, 0); - litest_assert_empty_queue(li); -} -END_TEST - -static inline bool -touchpad_has_tool_palm(struct litest_device *dev) -{ - return libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_TOOL_TYPE); -} - -START_TEST(touchpad_palm_detect_tool_palm) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_tool_palm(dev)) - return; - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10, 1); - litest_drain_events(li); - - litest_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_PALM); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_move_to(dev, 0, 70, 70, 50, 40, 10, 1); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_tool_palm_on_off) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_tool_palm(dev)) - return; - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10, 1); - litest_drain_events(li); - - litest_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_PALM); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_move_to(dev, 0, 70, 70, 50, 40, 10, 1); - - litest_assert_empty_queue(li); - - litest_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_FINGER); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_move_to(dev, 0, 50, 40, 70, 70, 10, 1); - litest_touch_up(dev, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_palm_detect_tool_palm_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!touchpad_has_tool_palm(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - litest_push_event_frame(dev); - litest_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_PALM); - litest_touch_down(dev, 0, 50, 50); - litest_pop_event_frame(dev); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_timeout_tap(); - - litest_assert_empty_queue(li); -} -END_TEST - -static inline bool -touchpad_has_palm_pressure(struct litest_device *dev) -{ - struct libevdev *evdev = dev->evdev; - - if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_PRESSURE)) - return true; - - return false; -} - -START_TEST(touchpad_palm_detect_pressure) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_disable_tap(dev->libinput_device); - litest_drain_events(li); - - litest_touch_down_extended(dev, 0, 50, 99, axes); - litest_touch_move_to(dev, 0, 50, 50, 80, 99, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_pressure_late) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_disable_tap(dev->libinput_device); - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 70, 80, 90, 10, 0); - litest_drain_events(li); - libinput_dispatch(li); - litest_touch_move_to_extended(dev, 0, 80, 90, 50, 20, - axes, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_pressure_keep_palm) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_disable_tap(dev->libinput_device); - litest_drain_events(li); - - litest_touch_down(dev, 0, 80, 90); - litest_touch_move_to_extended(dev, 0, 80, 90, 50, 20, - axes, 10, 0); - litest_touch_move_to(dev, 0, 50, 20, 80, 90, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_pressure_after_edge) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev) || - !touchpad_has_palm_detect_size(dev) || - !litest_has_2fg_scroll(dev)) - return; - - litest_enable_2fg_scroll(dev); - litest_disable_tap(dev->libinput_device); - litest_drain_events(li); - - litest_touch_down(dev, 0, 99, 50); - litest_touch_move_to_extended(dev, 0, 99, 50, 20, 50, axes, 20, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_palm_detect_pressure_after_dwt) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_drain_events(li); - - /* within dwt timeout, dwt blocks events */ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to_extended(touchpad, 0, 50, 50, 20, 50, axes, 20, 0); - litest_assert_empty_queue(li); - - litest_timeout_dwt_short(); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - /* after dwt timeout, pressure blocks events */ - litest_touch_move_to_extended(touchpad, 0, 20, 50, 50, 50, axes, 20, 0); - litest_touch_up(touchpad, 0); - - litest_assert_empty_queue(li); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_left_handed) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE && - libevdev_get_id_product(dev->evdev) == PRODUCT_ID_APPLE_APPLETOUCH) - return; - - status = libinput_device_config_left_handed_set(d, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - litest_button_click(dev, BTN_LEFT, 1); - litest_button_click(dev, BTN_LEFT, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_button_click(dev, BTN_RIGHT, 1); - litest_button_click(dev, BTN_RIGHT, 0); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - if (libevdev_has_event_code(dev->evdev, - EV_KEY, - BTN_MIDDLE)) { - litest_button_click(dev, BTN_MIDDLE, 1); - litest_button_click(dev, BTN_MIDDLE, 0); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - } -} -END_TEST - -START_TEST(touchpad_left_handed_appletouch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - enum libinput_config_status status; - - ck_assert_int_eq(libinput_device_config_left_handed_is_available(d), 0); - status = libinput_device_config_left_handed_set(d, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - ck_assert_int_eq(libinput_device_config_left_handed_get(d), 0); -} -END_TEST - -START_TEST(touchpad_left_handed_clickpad) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - if (!libinput_device_config_left_handed_is_available(d)) - return; - - status = libinput_device_config_left_handed_set(d, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - litest_touch_down(dev, 0, 10, 90); - litest_button_click(dev, BTN_LEFT, 1); - litest_button_click(dev, BTN_LEFT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_drain_events(li); - litest_touch_down(dev, 0, 90, 90); - litest_button_click(dev, BTN_LEFT, 1); - litest_button_click(dev, BTN_LEFT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_drain_events(li); - litest_touch_down(dev, 0, 50, 50); - litest_button_click(dev, BTN_LEFT, 1); - litest_button_click(dev, BTN_LEFT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_left_handed_clickfinger) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - if (!libinput_device_config_left_handed_is_available(d)) - return; - - status = libinput_device_config_left_handed_set(d, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - litest_touch_down(dev, 0, 10, 90); - litest_button_click(dev, BTN_LEFT, 1); - litest_button_click(dev, BTN_LEFT, 0); - litest_touch_up(dev, 0); - - /* Clickfinger is unaffected by left-handed setting */ - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_drain_events(li); - litest_touch_down(dev, 0, 10, 90); - litest_touch_down(dev, 1, 30, 90); - litest_button_click(dev, BTN_LEFT, 1); - litest_button_click(dev, BTN_LEFT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_left_handed_tapping) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - if (!libinput_device_config_left_handed_is_available(d)) - return; - - litest_enable_tap(dev->libinput_device); - - status = libinput_device_config_left_handed_set(d, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - - /* Tapping is unaffected by left-handed setting */ - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_left_handed_tapping_2fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - if (!libinput_device_config_left_handed_is_available(d)) - return; - - litest_enable_tap(dev->libinput_device); - - status = libinput_device_config_left_handed_set(d, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - - /* Tapping is unaffected by left-handed setting */ - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_left_handed_delayed) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - if (!libinput_device_config_left_handed_is_available(d)) - return; - - litest_drain_events(li); - litest_button_click(dev, BTN_LEFT, 1); - libinput_dispatch(li); - - status = libinput_device_config_left_handed_set(d, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_button_click(dev, BTN_LEFT, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - /* left-handed takes effect now */ - litest_button_click(dev, BTN_RIGHT, 1); - libinput_dispatch(li); - litest_timeout_middlebutton(); - libinput_dispatch(li); - litest_button_click(dev, BTN_LEFT, 1); - libinput_dispatch(li); - - status = libinput_device_config_left_handed_set(d, 0); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_button_click(dev, BTN_RIGHT, 0); - litest_button_click(dev, BTN_LEFT, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_left_handed_clickpad_delayed) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *d = dev->libinput_device; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - if (!libinput_device_config_left_handed_is_available(d)) - return; - - litest_drain_events(li); - litest_touch_down(dev, 0, 10, 90); - litest_button_click(dev, BTN_LEFT, 1); - libinput_dispatch(li); - - status = libinput_device_config_left_handed_set(d, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_button_click(dev, BTN_LEFT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - /* left-handed takes effect now */ - litest_drain_events(li); - litest_touch_down(dev, 0, 90, 90); - litest_button_click(dev, BTN_LEFT, 1); - libinput_dispatch(li); - - status = libinput_device_config_left_handed_set(d, 0); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_button_click(dev, BTN_LEFT, 0); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -static void -hover_continue(struct litest_device *dev, unsigned int slot, - int x, int y) -{ - litest_event(dev, EV_ABS, ABS_MT_SLOT, slot); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); - litest_event(dev, EV_ABS, ABS_X, x); - litest_event(dev, EV_ABS, ABS_Y, y); - litest_event(dev, EV_ABS, ABS_PRESSURE, 10); - litest_event(dev, EV_ABS, ABS_TOOL_WIDTH, 6); - /* WARNING: no SYN_REPORT! */ -} - -static void -hover_start(struct litest_device *dev, unsigned int slot, - int x, int y) -{ - static unsigned int tracking_id; - - litest_event(dev, EV_ABS, ABS_MT_SLOT, slot); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, ++tracking_id); - hover_continue(dev, slot, x, y); - /* WARNING: no SYN_REPORT! */ -} - -START_TEST(touchpad_semi_mt_hover_noevent) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i; - int x = 2400, - y = 2400; - - litest_drain_events(li); - - hover_start(dev, 0, x, y); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - for (i = 0; i < 10; i++) { - x += 200; - y -= 200; - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); - litest_event(dev, EV_ABS, ABS_X, x); - litest_event(dev, EV_ABS, ABS_Y, y); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - } - - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_semi_mt_hover_down) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - int i; - int x = 2400, - y = 2400; - - litest_drain_events(li); - - hover_start(dev, 0, x, y); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - for (i = 0; i < 10; i++) { - x += 200; - y -= 200; - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); - litest_event(dev, EV_ABS, ABS_X, x); - litest_event(dev, EV_ABS, ABS_Y, y); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - } - - litest_assert_empty_queue(li); - - litest_event(dev, EV_ABS, ABS_X, x + 100); - litest_event(dev, EV_ABS, ABS_Y, y + 100); - litest_event(dev, EV_ABS, ABS_PRESSURE, 50); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - for (i = 0; i < 10; i++) { - x -= 200; - y += 200; - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); - litest_event(dev, EV_ABS, ABS_X, x); - litest_event(dev, EV_ABS, ABS_Y, y); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - } - - libinput_dispatch(li); - - ck_assert_int_ne(libinput_next_event_type(li), - LIBINPUT_EVENT_NONE); - while ((event = libinput_get_event(li)) != NULL) { - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_MOTION); - libinput_event_destroy(event); - libinput_dispatch(li); - } - - /* go back to hover */ - hover_continue(dev, 0, x, y); - litest_event(dev, EV_ABS, ABS_PRESSURE, 0); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - for (i = 0; i < 10; i++) { - x += 200; - y -= 200; - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); - litest_event(dev, EV_ABS, ABS_X, x); - litest_event(dev, EV_ABS, ABS_Y, y); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - } - - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_semi_mt_hover_down_hover_down) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i, j; - int x = 1400, - y = 1400; - - litest_drain_events(li); - - /* hover */ - hover_start(dev, 0, x, y); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_assert_empty_queue(li); - - for (i = 0; i < 3; i++) { - /* touch */ - litest_event(dev, EV_ABS, ABS_X, x + 100); - litest_event(dev, EV_ABS, ABS_Y, y + 100); - litest_event(dev, EV_ABS, ABS_PRESSURE, 50); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - for (j = 0; j < 5; j++) { - x += 200; - y += 200; - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); - litest_event(dev, EV_ABS, ABS_X, x); - litest_event(dev, EV_ABS, ABS_Y, y); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - } - - libinput_dispatch(li); - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - - /* go back to hover */ - hover_continue(dev, 0, x, y); - litest_event(dev, EV_ABS, ABS_PRESSURE, 0); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - for (j = 0; j < 5; j++) { - x -= 200; - y -= 200; - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); - litest_event(dev, EV_ABS, ABS_X, x); - litest_event(dev, EV_ABS, ABS_Y, y); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - } - - litest_assert_empty_queue(li); - } - - /* touch */ - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_empty_queue(li); - - /* start a new touch to be sure */ - litest_push_event_frame(dev); - litest_touch_down(dev, 0, 50, 50); - litest_event(dev, EV_ABS, ABS_PRESSURE, 50); - litest_pop_event_frame(dev); - litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10, 10); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_semi_mt_hover_down_up) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i; - int x = 1400, - y = 1400; - - litest_drain_events(li); - - /* hover two fingers, then touch */ - hover_start(dev, 0, x, y); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_assert_empty_queue(li); - - hover_start(dev, 1, x, y); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_empty_queue(li); - - /* hover first finger, end second in same frame */ - litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_empty_queue(li); - - litest_event(dev, EV_ABS, ABS_PRESSURE, 50); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - /* now move the finger */ - for (i = 0; i < 10; i++) { - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); - litest_event(dev, EV_ABS, ABS_X, x); - litest_event(dev, EV_ABS, ABS_Y, y); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - x -= 100; - y -= 100; - } - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); -} -END_TEST - -START_TEST(touchpad_semi_mt_hover_2fg_noevent) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i; - int x = 2400, - y = 2400; - - litest_drain_events(li); - - hover_start(dev, 0, x, y); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - hover_start(dev, 1, x + 500, y + 500); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - for (i = 0; i < 10; i++) { - x += 200; - y -= 200; - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x + 500); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y + 500); - litest_event(dev, EV_ABS, ABS_X, x); - litest_event(dev, EV_ABS, ABS_Y, y); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - } - - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_empty_queue(li); - - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_semi_mt_hover_2fg_1fg_down) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i; - int x = 2400, - y = 2400; - - litest_drain_events(li); - - /* two slots active, but BTN_TOOL_FINGER only */ - hover_start(dev, 0, x, y); - hover_start(dev, 1, x + 500, y + 500); - litest_event(dev, EV_ABS, ABS_PRESSURE, 50); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - for (i = 0; i < 10; i++) { - x += 200; - y -= 200; - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x + 500); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y + 500); - litest_event(dev, EV_ABS, ABS_X, x); - litest_event(dev, EV_ABS, ABS_Y, y); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - } - - litest_event(dev, EV_ABS, ABS_PRESSURE, 0); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_semi_mt_hover_2fg_up) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_touch_down(dev, 0, 70, 50); - litest_touch_down(dev, 1, 50, 50); - - litest_push_event_frame(dev); - litest_touch_move(dev, 0, 72, 50); - litest_touch_move(dev, 1, 52, 50); - litest_event(dev, EV_ABS, ABS_PRESSURE, 0); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_pop_event_frame(dev); - - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_drain_events(li); -} -END_TEST - -START_TEST(touchpad_hover_noevent) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_hover_start(dev, 0, 50, 50); - litest_hover_move_to(dev, 0, 50, 50, 70, 70, 10, 10); - litest_hover_end(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_hover_down) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - /* hover the finger */ - litest_hover_start(dev, 0, 50, 50); - - litest_hover_move_to(dev, 0, 50, 50, 70, 70, 10, 10); - - litest_assert_empty_queue(li); - - /* touch the finger on the sensor */ - litest_touch_move_to(dev, 0, 70, 70, 50, 50, 10, 10); - - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - /* go back to hover */ - litest_hover_move_to(dev, 0, 50, 50, 70, 70, 10, 10); - litest_hover_end(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_hover_down_hover_down) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i; - - litest_drain_events(li); - - litest_hover_start(dev, 0, 50, 50); - - for (i = 0; i < 3; i++) { - - /* hover the finger */ - litest_hover_move_to(dev, 0, 50, 50, 70, 70, 10, 10); - - litest_assert_empty_queue(li); - - /* touch the finger */ - litest_touch_move_to(dev, 0, 70, 70, 50, 50, 10, 10); - - libinput_dispatch(li); - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - } - - litest_hover_end(dev, 0); - - /* start a new touch to be sure */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10, 10); - litest_touch_up(dev, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_hover_down_up) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - /* hover two fingers, and a touch */ - litest_push_event_frame(dev); - litest_hover_start(dev, 0, 50, 50); - litest_hover_start(dev, 1, 50, 50); - litest_touch_down(dev, 2, 50, 50); - litest_pop_event_frame(dev); - - litest_assert_empty_queue(li); - - /* hover first finger, end second and third in same frame */ - litest_push_event_frame(dev); - litest_hover_move(dev, 0, 55, 55); - litest_hover_end(dev, 1); - litest_touch_up(dev, 2); - litest_pop_event_frame(dev); - - litest_assert_empty_queue(li); - - /* now move the finger */ - litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10, 10); - - litest_touch_up(dev, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_hover_2fg_noevent) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - /* hover two fingers */ - litest_push_event_frame(dev); - litest_hover_start(dev, 0, 25, 25); - litest_hover_start(dev, 1, 50, 50); - litest_pop_event_frame(dev); - - litest_hover_move_two_touches(dev, 25, 25, 50, 50, 50, 50, 10, 0); - - litest_push_event_frame(dev); - litest_hover_end(dev, 0); - litest_hover_end(dev, 1); - litest_pop_event_frame(dev); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_hover_2fg_1fg_down) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i; - - litest_drain_events(li); - - /* hover two fingers */ - litest_push_event_frame(dev); - litest_hover_start(dev, 0, 25, 25); - litest_touch_down(dev, 1, 50, 50); - litest_pop_event_frame(dev); - - for (i = 0; i < 10; i++) { - litest_push_event_frame(dev); - litest_hover_move(dev, 0, 25 + 5 * i, 25 + 5 * i); - litest_touch_move(dev, 1, 50 + 5 * i, 50 - 5 * i); - litest_pop_event_frame(dev); - } - - litest_push_event_frame(dev); - litest_hover_end(dev, 0); - litest_touch_up(dev, 1); - litest_pop_event_frame(dev); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_hover_1fg_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_hover_start(dev, 0, 50, 50); - litest_hover_end(dev, 0); - - libinput_dispatch(li); - litest_assert_empty_queue(li); - -} -END_TEST - -static void -assert_btnevent_from_device(struct litest_device *device, - unsigned int button, - enum libinput_button_state state) -{ - struct libinput *li = device->libinput; - struct libinput_event *e; - - libinput_dispatch(li); - e = libinput_get_event(li); - litest_is_button_event(e, button, state); - - litest_assert_ptr_eq(libinput_event_get_device(e), device->libinput_device); - libinput_event_destroy(e); -} - -START_TEST(touchpad_trackpoint_buttons) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *trackpoint; - struct libinput *li = touchpad->libinput; - - const struct buttons { - unsigned int device_value; - unsigned int real_value; - } buttons[] = { - { BTN_0, BTN_LEFT }, - { BTN_1, BTN_RIGHT }, - { BTN_2, BTN_MIDDLE }, - }; - const struct buttons *b; - - trackpoint = litest_add_device(li, - LITEST_TRACKPOINT); - libinput_device_config_scroll_set_method(trackpoint->libinput_device, - LIBINPUT_CONFIG_SCROLL_NO_SCROLL); - - litest_drain_events(li); - - ARRAY_FOR_EACH(buttons, b) { - litest_button_click_debounced(touchpad, li, b->device_value, true); - assert_btnevent_from_device(trackpoint, - b->real_value, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_button_click_debounced(touchpad, li, b->device_value, false); - - assert_btnevent_from_device(trackpoint, - b->real_value, - LIBINPUT_BUTTON_STATE_RELEASED); - } - - litest_delete_device(trackpoint); -} -END_TEST - -START_TEST(touchpad_trackpoint_mb_scroll) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *trackpoint; - struct libinput *li = touchpad->libinput; - - trackpoint = litest_add_device(li, - LITEST_TRACKPOINT); - - litest_drain_events(li); - litest_button_click(touchpad, BTN_2, true); /* middle */ - libinput_dispatch(li); - litest_timeout_buttonscroll(); - libinput_dispatch(li); - litest_event(trackpoint, EV_REL, REL_Y, -2); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_event(trackpoint, EV_REL, REL_Y, -2); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_event(trackpoint, EV_REL, REL_Y, -2); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_event(trackpoint, EV_REL, REL_Y, -2); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - litest_button_click(touchpad, BTN_2, false); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - - litest_delete_device(trackpoint); -} -END_TEST - -START_TEST(touchpad_trackpoint_mb_click) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *trackpoint; - struct libinput *li = touchpad->libinput; - enum libinput_config_status status; - - trackpoint = litest_add_device(li, - LITEST_TRACKPOINT); - status = libinput_device_config_scroll_set_method( - trackpoint->libinput_device, - LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_drain_events(li); - litest_button_click_debounced(touchpad, li, BTN_2, true); /* middle */ - litest_button_click_debounced(touchpad, li, BTN_2, false); - - assert_btnevent_from_device(trackpoint, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - assert_btnevent_from_device(trackpoint, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_delete_device(trackpoint); -} -END_TEST - -START_TEST(touchpad_trackpoint_buttons_softbuttons) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *trackpoint; - struct libinput *li = touchpad->libinput; - - trackpoint = litest_add_device(li, - LITEST_TRACKPOINT); - - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 95, 90); - litest_button_click_debounced(touchpad, li, BTN_LEFT, true); - litest_button_click_debounced(touchpad, li, BTN_1, true); - litest_button_click_debounced(touchpad, li, BTN_LEFT, false); - litest_touch_up(touchpad, 0); - litest_button_click_debounced(touchpad, li, BTN_1, false); - - assert_btnevent_from_device(touchpad, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - assert_btnevent_from_device(trackpoint, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - assert_btnevent_from_device(touchpad, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - assert_btnevent_from_device(trackpoint, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_touch_down(touchpad, 0, 95, 90); - litest_button_click_debounced(touchpad, li, BTN_LEFT, true); - litest_button_click_debounced(touchpad, li, BTN_1, true); - litest_button_click_debounced(touchpad, li, BTN_1, false); - litest_button_click_debounced(touchpad, li, BTN_LEFT, false); - litest_touch_up(touchpad, 0); - - assert_btnevent_from_device(touchpad, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - assert_btnevent_from_device(trackpoint, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - assert_btnevent_from_device(trackpoint, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - assert_btnevent_from_device(touchpad, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_delete_device(trackpoint); -} -END_TEST - -START_TEST(touchpad_trackpoint_buttons_2fg_scroll) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *trackpoint; - struct libinput *li = touchpad->libinput; - struct libinput_event *e; - struct libinput_event_pointer *pev; - double val; - - trackpoint = litest_add_device(li, - LITEST_TRACKPOINT); - - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 49, 70); - litest_touch_down(touchpad, 1, 51, 70); - litest_touch_move_two_touches(touchpad, 49, 70, 51, 70, 0, -40, 10, 0); - - libinput_dispatch(li); - litest_wait_for_event(li); - - /* Make sure we get scroll events but _not_ the scroll release */ - while ((e = libinput_get_event(li))) { - ck_assert_int_eq(libinput_event_get_type(e), - LIBINPUT_EVENT_POINTER_AXIS); - pev = libinput_event_get_pointer_event(e); - val = libinput_event_pointer_get_axis_value(pev, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); - ck_assert(val != 0.0); - libinput_event_destroy(e); - } - - litest_button_click_debounced(touchpad, li, BTN_1, true); - assert_btnevent_from_device(trackpoint, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_touch_move_to(touchpad, 0, 40, 30, 40, 70, 10, 0); - litest_touch_move_to(touchpad, 1, 60, 30, 60, 70, 10, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - - while ((e = libinput_get_event(li))) { - ck_assert_int_eq(libinput_event_get_type(e), - LIBINPUT_EVENT_POINTER_AXIS); - pev = libinput_event_get_pointer_event(e); - val = libinput_event_pointer_get_axis_value(pev, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); - ck_assert(val != 0.0); - libinput_event_destroy(e); - } - - litest_button_click_debounced(touchpad, li, BTN_1, false); - assert_btnevent_from_device(trackpoint, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - /* the movement lags behind the touch movement, so the first couple - events can be downwards even though we started scrolling up. do a - short scroll up, drain those events, then we can use - litest_assert_scroll() which tests for the trailing 0/0 scroll - for us. - */ - litest_touch_move_to(touchpad, 0, 40, 70, 40, 60, 10, 0); - litest_touch_move_to(touchpad, 1, 60, 70, 60, 60, 10, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - litest_touch_move_to(touchpad, 0, 40, 60, 40, 30, 10, 0); - litest_touch_move_to(touchpad, 1, 60, 60, 60, 30, 10, 0); - - litest_touch_up(touchpad, 0); - litest_touch_up(touchpad, 1); - - libinput_dispatch(li); - - litest_assert_scroll(li, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, - -1); - - litest_delete_device(trackpoint); -} -END_TEST - -START_TEST(touchpad_trackpoint_no_trackpoint) -{ - struct litest_device *touchpad = litest_current_device(); - struct libinput *li = touchpad->libinput; - - litest_drain_events(li); - litest_button_click(touchpad, BTN_0, true); /* left */ - litest_button_click(touchpad, BTN_0, false); - litest_assert_empty_queue(li); - - litest_button_click(touchpad, BTN_1, true); /* right */ - litest_button_click(touchpad, BTN_1, false); - litest_assert_empty_queue(li); - - litest_button_click(touchpad, BTN_2, true); /* middle */ - litest_button_click(touchpad, BTN_2, false); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_initial_state) -{ - struct litest_device *dev; - struct libinput *libinput1, *libinput2; - struct libinput_event *ev1, *ev2; - struct libinput_event_pointer *p1, *p2; - int axis = _i; /* looped test */ - int x = 40, y = 60; - - dev = litest_current_device(); - libinput1 = dev->libinput; - - litest_disable_tap(dev->libinput_device); - - litest_touch_down(dev, 0, x, y); - litest_touch_up(dev, 0); - - /* device is now on some x/y value */ - litest_drain_events(libinput1); - - libinput2 = litest_create_context(); - libinput_path_add_device(libinput2, - libevdev_uinput_get_devnode(dev->uinput)); - litest_drain_events(libinput2); - - if (axis == ABS_X) - x = 30; - else - y = 30; - litest_touch_down(dev, 0, x, y); - litest_touch_move_to(dev, 0, x, y, 80, 80, 10, 1); - litest_touch_up(dev, 0); - libinput_dispatch(libinput1); - libinput_dispatch(libinput2); - - litest_wait_for_event(libinput1); - litest_wait_for_event(libinput2); - - while (libinput_next_event_type(libinput1)) { - ev1 = libinput_get_event(libinput1); - ev2 = libinput_get_event(libinput2); - - p1 = litest_is_motion_event(ev1); - p2 = litest_is_motion_event(ev2); - - ck_assert_int_eq(libinput_event_get_type(ev1), - libinput_event_get_type(ev2)); - - ck_assert_int_eq(libinput_event_pointer_get_dx(p1), - libinput_event_pointer_get_dx(p2)); - ck_assert_int_eq(libinput_event_pointer_get_dy(p1), - libinput_event_pointer_get_dy(p2)); - libinput_event_destroy(ev1); - libinput_event_destroy(ev2); - } - - libinput_unref(libinput2); -} -END_TEST - -START_TEST(touchpad_dwt) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - libinput_dispatch(li); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - /* within timeout - no events */ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_timeout_dwt_short(); - libinput_dispatch(li); - - /* after timeout - motion events*/ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_ext_and_int_keyboard) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard, *yubikey; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - litest_disable_tap(touchpad->libinput_device); - - /* Yubikey is initialized first */ - yubikey = litest_add_device(li, LITEST_YUBIKEY); - litest_drain_events(li); - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - libinput_dispatch(li); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - /* within timeout - no events */ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_timeout_dwt_short(); - libinput_dispatch(li); - - /* after timeout - motion events*/ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); - litest_delete_device(yubikey); -} -END_TEST - -START_TEST(touchpad_dwt_enable_touch) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - libinput_dispatch(li); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - /* finger down after last key event, but - we're still within timeout - no events */ - msleep(10); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_assert_empty_queue(li); - - litest_timeout_dwt_short(); - libinput_dispatch(li); - - /* same touch after timeout - motion events*/ - litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 10, 1); - litest_touch_up(touchpad, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_touch_hold) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - msleep(1); /* make sure touch starts after key press */ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - /* touch still down - no events */ - litest_keyboard_key(keyboard, KEY_A, false); - libinput_dispatch(li); - litest_touch_move_to(touchpad, 0, 70, 50, 30, 50, 5, 1); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - /* touch still down - no events */ - litest_timeout_dwt_short(); - libinput_dispatch(li); - litest_touch_move_to(touchpad, 0, 30, 50, 50, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_key_hold) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - libinput_dispatch(li); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_key_hold_timeout) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - libinput_dispatch(li); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - litest_timeout_dwt_long(); - libinput_dispatch(li); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - - litest_assert_empty_queue(li); - - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - /* key is up, but still within timeout */ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - /* expire timeout */ - litest_timeout_dwt_long(); - libinput_dispatch(li); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_key_hold_timeout_existing_touch_cornercase) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - /* Note: this tests for the current behavior of a cornercase, and - * the behaviour is essentially a bug. If this test fails it may be - * because the buggy behavior was fixed. - */ - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - libinput_dispatch(li); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - litest_timeout_dwt_long(); - libinput_dispatch(li); - - /* Touch starting after re-issuing the dwt timeout */ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - - litest_assert_empty_queue(li); - - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - /* key is up, but still within timeout */ - litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 5, 1); - litest_assert_empty_queue(li); - - /* Expire dwt timeout. Because the touch started after re-issuing - * the last timeout, it looks like the touch started after the last - * key press. Such touches are enabled for pointer motion by - * libinput when dwt expires. - * This is buggy behavior and not what a user would typically - * expect. But it's hard to trigger in real life too. - */ - litest_timeout_dwt_long(); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - /* If the below check for motion event fails because no events are - * in the pipe, the buggy behavior was fixed and this test case - * can be removed */ - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_key_hold_timeout_existing_touch) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - libinput_dispatch(li); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - libinput_dispatch(li); - litest_timeout_dwt_long(); - libinput_dispatch(li); - - litest_assert_empty_queue(li); - - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - /* key is up, but still within timeout */ - litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 5, 1); - litest_assert_empty_queue(li); - - /* expire timeout, but touch started before release */ - litest_timeout_dwt_long(); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_type) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - int i; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - for (i = 0; i < 5; i++) { - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - libinput_dispatch(li); - } - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_timeout_dwt_long(); - libinput_dispatch(li); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_type_short_timeout) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - int i; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - for (i = 0; i < 5; i++) { - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - libinput_dispatch(li); - } - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_timeout_dwt_short(); - libinput_dispatch(li); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_modifier_no_dwt) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - unsigned int modifiers[] = { - KEY_LEFTCTRL, - KEY_RIGHTCTRL, - KEY_LEFTALT, - KEY_RIGHTALT, - KEY_LEFTSHIFT, - KEY_RIGHTSHIFT, - KEY_FN, - KEY_CAPSLOCK, - KEY_TAB, - KEY_COMPOSE, - KEY_RIGHTMETA, - KEY_LEFTMETA, - }; - unsigned int *key; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - ARRAY_FOR_EACH(modifiers, key) { - litest_keyboard_key(keyboard, *key, true); - litest_keyboard_key(keyboard, *key, false); - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - } - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_modifier_combo_no_dwt) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - unsigned int modifiers[] = { - KEY_LEFTCTRL, - KEY_RIGHTCTRL, - KEY_LEFTALT, - KEY_RIGHTALT, - KEY_LEFTSHIFT, - KEY_RIGHTSHIFT, - KEY_FN, - KEY_CAPSLOCK, - KEY_TAB, - KEY_COMPOSE, - KEY_RIGHTMETA, - KEY_LEFTMETA, - }; - unsigned int *key; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - ARRAY_FOR_EACH(modifiers, key) { - litest_keyboard_key(keyboard, *key, true); - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_keyboard_key(keyboard, KEY_B, true); - litest_keyboard_key(keyboard, KEY_B, false); - litest_keyboard_key(keyboard, *key, false); - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - } - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_modifier_combo_dwt_after) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - unsigned int modifiers[] = { - KEY_LEFTCTRL, - KEY_RIGHTCTRL, - KEY_LEFTALT, - KEY_RIGHTALT, - KEY_LEFTSHIFT, - KEY_RIGHTSHIFT, - KEY_FN, - KEY_CAPSLOCK, - KEY_TAB, - KEY_COMPOSE, - KEY_RIGHTMETA, - KEY_LEFTMETA, - }; - unsigned int *key; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - ARRAY_FOR_EACH(modifiers, key) { - litest_keyboard_key(keyboard, *key, true); - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_keyboard_key(keyboard, *key, false); - libinput_dispatch(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - libinput_dispatch(li); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_timeout_dwt_long(); - libinput_dispatch(li); - } - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_modifier_combo_dwt_remains) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - unsigned int modifiers[] = { - KEY_LEFTCTRL, - KEY_RIGHTCTRL, - KEY_LEFTALT, - KEY_RIGHTALT, - KEY_LEFTSHIFT, - KEY_RIGHTSHIFT, - KEY_FN, - KEY_CAPSLOCK, - KEY_TAB, - KEY_COMPOSE, - KEY_RIGHTMETA, - KEY_LEFTMETA, - }; - unsigned int *key; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - ARRAY_FOR_EACH(modifiers, key) { - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - libinput_dispatch(li); - - /* this can't really be tested directly. The above key - * should enable dwt, the next key continues and extends the - * timeout as usual (despite the modifier combo). but - * testing for timeout differences is fickle, so all we can - * test though is that dwt is still on after the modifier - * combo and does not get disabled immediately. - */ - litest_keyboard_key(keyboard, *key, true); - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_keyboard_key(keyboard, *key, false); - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_timeout_dwt_long(); - libinput_dispatch(li); - } - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_fkeys_no_dwt) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - unsigned int key; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - for (key = KEY_F1; key < KEY_CNT; key++) { - if (!libinput_device_keyboard_has_key(keyboard->libinput_device, - key)) - continue; - - litest_keyboard_key(keyboard, key, true); - litest_keyboard_key(keyboard, key, false); - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - } - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_tap) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_enable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - libinput_dispatch(li); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_up(touchpad, 0); - - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_timeout_dwt_short(); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_tap_drag) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_enable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - libinput_dispatch(li); - msleep(1); /* make sure touch starts after key press */ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_up(touchpad, 0); - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); - - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_timeout_dwt_short(); - libinput_dispatch(li); - litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 5, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_click) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_button_click(touchpad, BTN_LEFT, true); - litest_button_click(touchpad, BTN_LEFT, false); - libinput_dispatch(li); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); - - litest_keyboard_key(keyboard, KEY_A, false); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_edge_scroll) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - litest_enable_edge_scroll(touchpad); - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 99, 20); - libinput_dispatch(li); - litest_timeout_edgescroll(); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - /* edge scroll timeout is 300ms atm, make sure we don't accidentally - exit the DWT timeout */ - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - libinput_dispatch(li); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_move_to(touchpad, 0, 99, 20, 99, 80, 60, 10); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - litest_touch_move_to(touchpad, 0, 99, 80, 99, 20, 60, 10); - litest_touch_up(touchpad, 0); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_edge_scroll_interrupt) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - struct libinput_event_pointer *stop_event; - - if (!has_disable_while_typing(touchpad)) - return; - - litest_enable_edge_scroll(touchpad); - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 99, 20); - libinput_dispatch(li); - litest_timeout_edgescroll(); - litest_touch_move_to(touchpad, 0, 99, 20, 99, 30, 10, 10); - libinput_dispatch(li); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - - /* scroll stop event */ - litest_wait_for_event(li); - stop_event = litest_is_axis_event(libinput_get_event(li), - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, - LIBINPUT_POINTER_AXIS_SOURCE_FINGER); - libinput_event_destroy(libinput_event_pointer_get_base_event(stop_event)); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_timeout_dwt_long(); - - /* Known bad behavior: a touch starting to edge-scroll before dwt - * kicks in will stop to scroll but be recognized as normal - * pointer-moving touch once the timeout expires. We'll fix that - * when we need to. - */ - litest_touch_move_to(touchpad, 0, 99, 30, 99, 80, 10, 5); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_config_default_on) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - enum libinput_config_dwt_state state; - - if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM || - libevdev_get_id_bustype(dev->evdev) == BUS_BLUETOOTH) { - ck_assert(!libinput_device_config_dwt_is_available(device)); - return; - } - - ck_assert(libinput_device_config_dwt_is_available(device)); - state = libinput_device_config_dwt_get_enabled(device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_DWT_ENABLED); - state = libinput_device_config_dwt_get_default_enabled(device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_DWT_ENABLED); - - status = libinput_device_config_dwt_set_enabled(device, - LIBINPUT_CONFIG_DWT_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - status = libinput_device_config_dwt_set_enabled(device, - LIBINPUT_CONFIG_DWT_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - status = libinput_device_config_dwt_set_enabled(device, 3); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -START_TEST(touchpad_dwt_config_default_off) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - enum libinput_config_dwt_state state; - - ck_assert(!libinput_device_config_dwt_is_available(device)); - state = libinput_device_config_dwt_get_enabled(device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_DWT_DISABLED); - state = libinput_device_config_dwt_get_default_enabled(device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_DWT_DISABLED); - - status = libinput_device_config_dwt_set_enabled(device, - LIBINPUT_CONFIG_DWT_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - status = libinput_device_config_dwt_set_enabled(device, - LIBINPUT_CONFIG_DWT_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - status = libinput_device_config_dwt_set_enabled(device, 3); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -static inline void -disable_dwt(struct litest_device *dev) -{ - enum libinput_config_status status, - expected = LIBINPUT_CONFIG_STATUS_SUCCESS; - status = libinput_device_config_dwt_set_enabled(dev->libinput_device, - LIBINPUT_CONFIG_DWT_DISABLED); - litest_assert_int_eq(status, expected); -} - -static inline void -enable_dwt(struct litest_device *dev) -{ - enum libinput_config_status status, - expected = LIBINPUT_CONFIG_STATUS_SUCCESS; - status = libinput_device_config_dwt_set_enabled(dev->libinput_device, - LIBINPUT_CONFIG_DWT_ENABLED); - litest_assert_int_eq(status, expected); -} - -START_TEST(touchpad_dwt_disabled) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - disable_dwt(touchpad); - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_disable_during_touch) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - enable_dwt(touchpad); - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_assert_empty_queue(li); - - disable_dwt(touchpad); - - /* touch already down -> keeps being ignored */ - litest_touch_move_to(touchpad, 0, 70, 50, 50, 70, 10, 1); - litest_touch_up(touchpad, 0); - - litest_assert_empty_queue(li); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_disable_before_touch) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - enable_dwt(touchpad); - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - disable_dwt(touchpad); - libinput_dispatch(li); - - /* touch down during timeout -> still discarded */ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_assert_empty_queue(li); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_disable_during_key_release) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - enable_dwt(touchpad); - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - disable_dwt(touchpad); - libinput_dispatch(li); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - /* touch down during timeout, wait, should generate events */ - litest_touch_down(touchpad, 0, 50, 50); - libinput_dispatch(li); - litest_timeout_dwt_long(); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_disable_during_key_hold) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - enable_dwt(touchpad); - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - disable_dwt(touchpad); - libinput_dispatch(li); - - /* touch down during timeout, wait, should generate events */ - litest_touch_down(touchpad, 0, 50, 50); - libinput_dispatch(li); - litest_timeout_dwt_long(); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_enable_during_touch) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - disable_dwt(touchpad); - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - enable_dwt(touchpad); - - /* touch already down -> still sends events */ - litest_touch_move_to(touchpad, 0, 70, 50, 50, 70, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_enable_before_touch) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - disable_dwt(touchpad); - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_disable_tap(touchpad->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - enable_dwt(touchpad); - libinput_dispatch(li); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_enable_during_tap) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - litest_enable_tap(touchpad->libinput_device); - disable_dwt(touchpad); - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - libinput_dispatch(li); - enable_dwt(touchpad); - libinput_dispatch(li); - litest_touch_up(touchpad, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_remove_kbd_while_active) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = touchpad->libinput; - - if (!has_disable_while_typing(touchpad)) - return; - - litest_enable_tap(touchpad->libinput_device); - enable_dwt(touchpad); - - keyboard = dwt_init_paired_keyboard(li, touchpad); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - libinput_dispatch(li); - - litest_touch_down(touchpad, 0, 50, 50); - libinput_dispatch(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_drain_events(li); - - litest_delete_device(keyboard); - litest_drain_events(li); - - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - -} -END_TEST - -START_TEST(touchpad_dwt_apple) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *apple_keyboard; - struct libinput *li = touchpad->libinput; - - ck_assert(has_disable_while_typing(touchpad)); - - apple_keyboard = litest_add_device(li, LITEST_APPLE_KEYBOARD); - litest_drain_events(li); - - litest_keyboard_key(apple_keyboard, KEY_A, true); - litest_keyboard_key(apple_keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - litest_delete_device(apple_keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_acer_hawaii) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboard, *hawaii_keyboard; - struct libinput *li = touchpad->libinput; - - ck_assert(has_disable_while_typing(touchpad)); - - /* Only the hawaii keyboard can trigger DWT */ - keyboard = litest_add_device(li, LITEST_KEYBOARD); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - hawaii_keyboard = litest_add_device(li, LITEST_ACER_HAWAII_KEYBOARD); - litest_drain_events(li); - - litest_keyboard_key(hawaii_keyboard, KEY_A, true); - litest_keyboard_key(hawaii_keyboard, KEY_A, false); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - litest_delete_device(keyboard); - litest_delete_device(hawaii_keyboard); -} -END_TEST - -START_TEST(touchpad_dwt_multiple_keyboards) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *k1, *k2; - struct libinput *li = touchpad->libinput; - - ck_assert(has_disable_while_typing(touchpad)); - - enable_dwt(touchpad); - - k1 = litest_add_device(li, LITEST_KEYBOARD); - k2 = litest_add_device(li, LITEST_KEYBOARD); - - litest_keyboard_key(k1, KEY_A, true); - litest_keyboard_key(k1, KEY_A, false); - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_timeout_dwt_short(); - - litest_keyboard_key(k2, KEY_A, true); - litest_keyboard_key(k2, KEY_A, false); - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_timeout_dwt_short(); - - litest_delete_device(k1); - litest_delete_device(k2); -} -END_TEST - -START_TEST(touchpad_dwt_multiple_keyboards_bothkeys) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *k1, *k2; - struct libinput *li = touchpad->libinput; - - ck_assert(has_disable_while_typing(touchpad)); - - enable_dwt(touchpad); - - k1 = litest_add_device(li, LITEST_KEYBOARD); - k2 = litest_add_device(li, LITEST_KEYBOARD); - - litest_keyboard_key(k1, KEY_A, true); - litest_keyboard_key(k1, KEY_A, false); - litest_keyboard_key(k2, KEY_B, true); - litest_keyboard_key(k2, KEY_B, false); - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_delete_device(k1); - litest_delete_device(k2); -} -END_TEST - -START_TEST(touchpad_dwt_multiple_keyboards_bothkeys_modifier) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *k1, *k2; - struct libinput *li = touchpad->libinput; - - ck_assert(has_disable_while_typing(touchpad)); - - enable_dwt(touchpad); - - k1 = litest_add_device(li, LITEST_KEYBOARD); - k2 = litest_add_device(li, LITEST_KEYBOARD); - - litest_keyboard_key(k1, KEY_RIGHTCTRL, true); - litest_keyboard_key(k1, KEY_RIGHTCTRL, false); - litest_keyboard_key(k2, KEY_B, true); - litest_keyboard_key(k2, KEY_B, false); - litest_drain_events(li); - - /* If the keyboard is a single physical device, the above should - * trigger the modifier behavior for dwt. But libinput views it as - * two separate devices and this is such a niche case that it - * doesn't matter. So we test for the easy behavior: - * ctrl+B across two devices is *not* a dwt modifier combo - */ - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_delete_device(k1); - litest_delete_device(k2); -} -END_TEST - -START_TEST(touchpad_dwt_multiple_keyboards_remove) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *keyboards[2]; - struct libinput *li = touchpad->libinput; - int which = _i; /* ranged test */ - struct litest_device *removed, *remained; - - ck_assert_int_le(which, 1); - - ck_assert(has_disable_while_typing(touchpad)); - - enable_dwt(touchpad); - - keyboards[0] = litest_add_device(li, LITEST_KEYBOARD); - keyboards[1] = litest_add_device(li, LITEST_KEYBOARD); - - litest_keyboard_key(keyboards[0], KEY_A, true); - litest_keyboard_key(keyboards[0], KEY_A, false); - litest_keyboard_key(keyboards[1], KEY_B, true); - litest_keyboard_key(keyboards[1], KEY_B, false); - litest_drain_events(li); - - litest_timeout_dwt_short(); - - removed = keyboards[which % 2]; - remained = keyboards[(which + 1) % 2]; - - litest_delete_device(removed); - litest_keyboard_key(remained, KEY_C, true); - litest_keyboard_key(remained, KEY_C, false); - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 50, 50); - litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_delete_device(remained); -} -END_TEST - -static int -has_thumb_detect(struct litest_device *dev) -{ - double w, h; - - if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_PRESSURE)) - return 0; - - if (libinput_device_get_size(dev->libinput_device, &w, &h) != 0) - return 0; - - return h >= 50.0; -} - -START_TEST(touchpad_thumb_begin_no_motion) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!has_thumb_detect(dev)) - return; - - litest_disable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down_extended(dev, 0, 50, 99, axes); - litest_touch_move_to(dev, 0, 50, 99, 80, 99, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_thumb_update_no_motion) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - litest_disable_tap(dev->libinput_device); - litest_enable_clickfinger(dev); - - if (!has_thumb_detect(dev)) - return; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 59, 99); - litest_touch_move_extended(dev, 0, 59, 99, axes); - litest_touch_move_to(dev, 0, 60, 99, 80, 99, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_thumb_moving) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - litest_disable_tap(dev->libinput_device); - litest_enable_clickfinger(dev); - - if (!has_thumb_detect(dev)) - return; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 99); - litest_touch_move_to(dev, 0, 50, 99, 60, 99, 10, 0); - litest_touch_move_extended(dev, 0, 65, 99, axes); - litest_touch_move_to(dev, 0, 65, 99, 80, 99, 10, 0); - litest_touch_up(dev, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_thumb_clickfinger) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!has_thumb_detect(dev)) - return; - - litest_disable_tap(dev->libinput_device); - - libinput_device_config_click_set_method(dev->libinput_device, - LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 99); - litest_touch_down(dev, 1, 60, 99); - litest_touch_move_extended(dev, 0, 55, 99, axes); - litest_button_click(dev, BTN_LEFT, true); - - libinput_dispatch(li); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); - - litest_button_click(dev, BTN_LEFT, false); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 99); - litest_touch_down(dev, 1, 60, 99); - litest_touch_move_extended(dev, 1, 65, 99, axes); - litest_button_click(dev, BTN_LEFT, true); - - libinput_dispatch(li); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_thumb_btnarea) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!has_thumb_detect(dev)) - return; - - litest_disable_tap(dev->libinput_device); - - libinput_device_config_click_set_method(dev->libinput_device, - LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 90, 99); - litest_touch_move_extended(dev, 0, 95, 99, axes); - litest_button_click(dev, BTN_LEFT, true); - - /* button areas work as usual with a thumb */ - - libinput_dispatch(li); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_thumb_tap_begin) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!has_thumb_detect(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_enable_clickfinger(dev); - litest_drain_events(li); - - /* touch down is a thumb */ - litest_touch_down_extended(dev, 0, 50, 99, axes); - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_timeout_tap(); - - litest_assert_empty_queue(li); - - /* make sure normal tap still works */ - litest_touch_down(dev, 0, 50, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_timeout_tap(); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); -} -END_TEST - -START_TEST(touchpad_thumb_tap_touch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!has_thumb_detect(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_enable_clickfinger(dev); - litest_drain_events(li); - - /* event after touch down is thumb */ - litest_touch_down(dev, 0, 50, 80); - litest_touch_move_extended(dev, 0, 51, 99, axes); - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_timeout_tap(); - litest_assert_empty_queue(li); - - /* make sure normal tap still works */ - litest_touch_down(dev, 0, 50, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_timeout_tap(); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); -} -END_TEST - -START_TEST(touchpad_thumb_tap_hold) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!has_thumb_detect(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_enable_clickfinger(dev); - litest_drain_events(li); - - /* event in state HOLD is thumb */ - litest_touch_down(dev, 0, 50, 99); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - litest_touch_move_extended(dev, 0, 51, 99, axes); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - /* make sure normal tap still works */ - litest_touch_down(dev, 0, 50, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_timeout_tap(); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); -} -END_TEST - -START_TEST(touchpad_thumb_tap_hold_2ndfg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!has_thumb_detect(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_enable_clickfinger(dev); - litest_drain_events(li); - - /* event in state HOLD is thumb */ - litest_touch_down(dev, 0, 50, 99); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - litest_touch_move_extended(dev, 0, 51, 99, axes); - - litest_assert_empty_queue(li); - - /* one finger is a thumb, now get second finger down */ - litest_touch_down(dev, 1, 60, 50); - litest_assert_empty_queue(li); - - /* release thumb */ - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - /* timeout -> into HOLD, no event on release */ - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - litest_touch_up(dev, 1); - litest_assert_empty_queue(li); - - /* make sure normal tap still works */ - litest_touch_down(dev, 0, 50, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_timeout_tap(); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); -} -END_TEST - -START_TEST(touchpad_thumb_tap_hold_2ndfg_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!has_thumb_detect(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* event in state HOLD is thumb */ - litest_touch_down(dev, 0, 50, 99); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - litest_touch_move_extended(dev, 0, 51, 99, axes); - - litest_assert_empty_queue(li); - - /* one finger is a thumb, now get second finger down */ - litest_touch_down(dev, 1, 60, 50); - litest_assert_empty_queue(li); - - /* release thumb */ - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - /* release second finger, within timeout, ergo event */ - litest_touch_up(dev, 1); - libinput_dispatch(li); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - libinput_event_destroy(event); - - /* make sure normal tap still works */ - litest_touch_down(dev, 0, 50, 99); - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_timeout_tap(); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); -} -END_TEST - -START_TEST(touchpad_tool_tripletap_touch_count) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - - /* Synaptics touchpads sometimes end one touch point while - * simultaneously setting BTN_TOOL_TRIPLETAP. - * https://bugs.freedesktop.org/show_bug.cgi?id=91352 - */ - litest_drain_events(li); - litest_enable_clickfinger(dev); - - /* touch 1 down */ - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 1); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 1200); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3200); - litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 78); - litest_event(dev, EV_ABS, ABS_X, 1200); - litest_event(dev, EV_ABS, ABS_Y, 3200); - litest_event(dev, EV_ABS, ABS_PRESSURE, 78); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); - litest_event(dev, EV_KEY, BTN_TOUCH, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - msleep(2); - - /* touch 2 down */ - litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 1); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 2200); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3200); - litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 73); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - msleep(2); - - /* touch 3 down, coordinate jump + ends slot 1 */ - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 4000); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 4000); - litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 78); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_X, 4000); - litest_event(dev, EV_ABS, ABS_Y, 4000); - litest_event(dev, EV_ABS, ABS_PRESSURE, 78); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - msleep(2); - - /* slot 2 reactivated: - * Note, slot is activated close enough that we don't accidentally - * trigger the clickfinger distance check, remains to be seen if - * that is true for real-world interaction. - */ - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 4000); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 4000); - litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 78); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 3); - litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 3500); - litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3500); - litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 73); - litest_event(dev, EV_ABS, ABS_X, 4000); - litest_event(dev, EV_ABS, ABS_Y, 4000); - litest_event(dev, EV_ABS, ABS_PRESSURE, 78); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - msleep(2); - - /* now a click should trigger middle click */ - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_wait_for_event(li); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - libinput_event_destroy(event); - - /* release everything */ - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); -} -END_TEST - -START_TEST(touchpad_slot_swap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - int first, second; - - /* Synaptics touchpads sometimes end the wrong touchpoint on finger - * up, causing the remaining slot to continue with the other slot's - * coordinates. - * https://bugs.freedesktop.org/show_bug.cgi?id=91352 - */ - litest_drain_events(li); - - for (first = 0; first <= 1; first++) { - second = 1 - first; - - litest_touch_down(dev, 0, 50, 50); - libinput_dispatch(li); - litest_touch_down(dev, 1, 70, 70); - libinput_dispatch(li); - - litest_touch_move_to(dev, first, 50, 50, 50, 30, 10, 1); - litest_drain_events(li); - - /* release touch 0, continue other slot with 0's coords */ - litest_push_event_frame(dev); - litest_touch_up(dev, first); - litest_touch_move(dev, second, 50, 30.1); - litest_pop_event_frame(dev); - libinput_dispatch(li); - litest_touch_move_to(dev, second, 50, 30, 50, 11, 10, 1); - libinput_dispatch(li); - event = libinput_get_event(li); - do { - ptrev = litest_is_motion_event(event); - ck_assert_double_eq(libinput_event_pointer_get_dx(ptrev), 0.0); - ck_assert_double_lt(libinput_event_pointer_get_dy(ptrev), 1.0); - - libinput_event_destroy(event); - event = libinput_get_event(li); - } while (event); - litest_assert_empty_queue(li); - - litest_touch_up(dev, second); - } -} -END_TEST - -START_TEST(touchpad_finger_always_down) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li; - - /* Set BTN_TOOL_FINGER before a new context is initialized */ - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - li = litest_create_context(); - libinput_path_add_device(li, - libevdev_uinput_get_devnode(dev->uinput)); - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - libinput_unref(li); -} -END_TEST - -START_TEST(touchpad_time_usec) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - - litest_disable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 80, 50, 5, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - event = libinput_get_event(li); - ck_assert_notnull(event); - - while (event) { - uint64_t utime; - - ptrev = litest_is_motion_event(event); - utime = libinput_event_pointer_get_time_usec(ptrev); - - ck_assert_int_eq(libinput_event_pointer_get_time(ptrev), - (uint32_t) (utime / 1000)); - libinput_event_destroy(event); - event = libinput_get_event(li); - } -} -END_TEST - -START_TEST(touchpad_jump_finger_motion) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_drain_events(li); - - litest_disable_log_handler(li); - litest_touch_move_to(dev, 0, 90, 30, 20, 80, 1, 0); - litest_assert_empty_queue(li); - litest_restore_log_handler(li); - - litest_touch_move_to(dev, 0, 20, 80, 21, 81, 10, 0); - litest_touch_up(dev, 0); - - /* expect lots of little events, no big jump */ - libinput_dispatch(li); - event = libinput_get_event(li); - do { - double dx, dy; - - ptrev = litest_is_motion_event(event); - dx = libinput_event_pointer_get_dx(ptrev); - dy = libinput_event_pointer_get_dy(ptrev); - ck_assert_int_lt(abs((int)dx), 20); - ck_assert_int_lt(abs((int)dy), 20); - - libinput_event_destroy(event); - event = libinput_get_event(li); - } while (event != NULL); -} -END_TEST - -START_TEST(touchpad_disabled_on_mouse) -{ - struct litest_device *dev = litest_current_device(); - struct litest_device *mouse; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode( - dev->libinput_device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - mouse = litest_add_device(li, LITEST_MOUSE); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_ADDED); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - litest_delete_device(mouse); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_disabled_on_mouse_suspend_mouse) -{ - struct litest_device *dev = litest_current_device(); - struct litest_device *mouse; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode( - dev->libinput_device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - mouse = litest_add_device(li, LITEST_MOUSE); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_ADDED); - - /* Disable external mouse -> expect touchpad events */ - status = libinput_device_config_send_events_set_mode( - mouse->libinput_device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(mouse); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_disabled_double_mouse) -{ - struct litest_device *dev = litest_current_device(); - struct litest_device *mouse1, *mouse2; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode( - dev->libinput_device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - mouse1 = litest_add_device(li, LITEST_MOUSE); - mouse2 = litest_add_device(li, LITEST_MOUSE_LOW_DPI); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_ADDED); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - litest_delete_device(mouse1); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - litest_delete_device(mouse2); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_disabled_double_mouse_one_suspended) -{ - struct litest_device *dev = litest_current_device(); - struct litest_device *mouse1, *mouse2; - struct libinput *li = dev->libinput; - enum libinput_config_status status; - - litest_drain_events(li); - - status = libinput_device_config_send_events_set_mode( - dev->libinput_device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - mouse1 = litest_add_device(li, LITEST_MOUSE); - mouse2 = litest_add_device(li, LITEST_MOUSE_LOW_DPI); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_ADDED); - - /* Disable one external mouse -> don't expect touchpad events */ - status = libinput_device_config_send_events_set_mode( - mouse1->libinput_device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - litest_delete_device(mouse1); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - litest_delete_device(mouse2); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); - - litest_touch_down(dev, 0, 20, 30); - litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10, 0); - litest_touch_up(dev, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -static inline bool -touchpad_has_pressure(struct litest_device *dev) -{ - struct libevdev *evdev = dev->evdev; - - if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_PRESSURE)) - return true; - - if (libevdev_has_event_code(evdev, EV_ABS, ABS_PRESSURE) && - !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT)) - return true; - - return false; -} - -START_TEST(touchpad_pressure) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 1 }, - { ABS_PRESSURE, 1 }, - { -1, 0 } - }; - double pressure; /* in percent */ - double threshold = 12.0; - - if (!touchpad_has_pressure(dev)) - return; - - litest_drain_events(li); - - for (pressure = 1; pressure <= threshold + 1; pressure++) { - litest_axis_set_value(axes, ABS_MT_PRESSURE, pressure); - litest_axis_set_value(axes, ABS_PRESSURE, pressure); - litest_touch_down_extended(dev, 0, 50, 50, axes); - litest_touch_move_to_extended(dev, 0, - 50, 50, - 80, 80, - axes, 10, 1); - litest_touch_up(dev, 0); - if (pressure < threshold) - litest_assert_empty_queue(li); - else - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - - } -} -END_TEST - -START_TEST(touchpad_pressure_2fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 5 }, - { ABS_PRESSURE, 5 }, - { -1, 0 } - }; - - if (!touchpad_has_pressure(dev)) - return; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 30, 50); - litest_touch_down_extended(dev, 1, 50, 50, axes); - libinput_dispatch(li); - litest_touch_move_to(dev, 0, 50, 50, 80, 80, 10, 1); - libinput_dispatch(li); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - litest_touch_move_to_extended(dev, 1, - 50, 50, - 80, 80, - axes, 10, 1); - litest_assert_empty_queue(li); - litest_touch_move_to(dev, 0, 80, 80, 20, 50, 10, 1); - litest_touch_move_to_extended(dev, 1, - 80, 80, - 50, 50, - axes, 10, 1); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_pressure_2fg_st) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 5 }, - { ABS_PRESSURE, 5 }, - { -1, 0 } - }; - - if (!touchpad_has_pressure(dev)) - return; - - /* This is a bit of a weird test. We expect two fingers to be down as - * soon as doubletap is set, regardless of pressure. But we don't - * have 2fg scrolling on st devices and 2 fingers down on a touchpad - * without 2fg scrolling simply does not generate events. But that's - * the same result as if the fingers were ignored because of - * pressure and we cannot know the difference. - * So this test only keeps your CPU warm, not much else. - */ - litest_drain_events(li); - - litest_touch_down_extended(dev, 0, 50, 50, axes); - libinput_dispatch(li); - litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_touch_move_to_extended(dev, 0, - 50, 50, - 80, 80, - axes, 10, 1); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_pressure_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 5 }, - { ABS_PRESSURE, 5 }, - { -1, 0 } - }; - - if (!touchpad_has_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - litest_touch_down_extended(dev, 0, 50, 50, axes); - libinput_dispatch(li); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_pressure_tap_2fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 5 }, - { ABS_PRESSURE, 5 }, - { -1, 0 } - }; - - if (!touchpad_has_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* tap but too light */ - litest_touch_down_extended(dev, 0, 40, 50, axes); - litest_touch_down_extended(dev, 1, 50, 50, axes); - libinput_dispatch(li); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_pressure_tap_2fg_1fg_light) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 5 }, - { ABS_PRESSURE, 5 }, - { -1, 0 } - }; - - if (!touchpad_has_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* double-tap with one finger too light */ - litest_touch_down(dev, 0, 40, 50); - litest_touch_down_extended(dev, 1, 50, 50, axes); - libinput_dispatch(li); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - libinput_dispatch(li); - - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - libinput_event_destroy(event); - - litest_timeout_tap(); - libinput_dispatch(li); - - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - libinput_event_destroy(event); -} -END_TEST - -START_TEST(touchpad_pressure_btntool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 5 }, - { ABS_PRESSURE, 5 }, - { -1, 0 } - }; - - /* we only have tripletap, can't test 4 slots because nothing will - * happen */ - if (libevdev_get_num_slots(dev->evdev) != 2) - return; - - if (!touchpad_has_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* Two light touches down, doesn't count */ - litest_touch_down_extended(dev, 0, 40, 50, axes); - litest_touch_down_extended(dev, 1, 45, 50, axes); - libinput_dispatch(li); - litest_assert_empty_queue(li); - - /* Tripletap but since no finger is logically down, it doesn't count */ - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_assert_empty_queue(li); - - /* back to two fingers */ - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - /* make one finger real */ - litest_touch_move_to(dev, 0, 40, 50, 41, 52, 10, 10); - litest_drain_events(li); - - /* tripletap should now be 3 fingers tap */ - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -static inline bool -touchpad_has_touch_size(struct litest_device *dev) -{ - struct libevdev *evdev = dev->evdev; - - if (!libevdev_has_event_code(evdev, EV_ABS, ABS_MT_TOUCH_MAJOR)) - return false; - - if (libevdev_get_id_vendor(evdev) == VENDOR_ID_APPLE) - return true; - - return false; -} - -START_TEST(touchpad_touch_size) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_TOUCH_MAJOR, 0 }, - { ABS_MT_TOUCH_MINOR, 0 }, - { ABS_MT_ORIENTATION, 0 }, - { -1, 0 } - }; - - if (!touchpad_has_touch_size(dev)) - return; - - litest_drain_events(li); - - litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 1); - litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 1); - litest_touch_down_extended(dev, 0, 50, 50, axes); - litest_touch_move_to_extended(dev, 0, - 50, 50, - 80, 80, - axes, 10, 1); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 15); - litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 15); - litest_touch_down_extended(dev, 0, 50, 50, axes); - litest_touch_move_to_extended(dev, 0, - 50, 50, - 80, 80, - axes, 10, 1); - litest_touch_up(dev, 0); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_touch_size_2fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_TOUCH_MAJOR, 0 }, - { ABS_MT_TOUCH_MINOR, 0 }, - { ABS_MT_ORIENTATION, 0 }, - { -1, 0 } - }; - - if (!touchpad_has_touch_size(dev)) - return; - - litest_drain_events(li); - litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 15); - litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 15); - litest_touch_down_extended(dev, 0, 50, 50, axes); - litest_touch_move_to_extended(dev, 0, - 50, 50, - 80, 80, - axes, 10, 1); - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - - litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 1); - litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 1); - litest_touch_down_extended(dev, 1, 70, 70, axes); - litest_touch_move_to_extended(dev, 1, - 70, 70, - 80, 90, - axes, 10, 1); - litest_assert_empty_queue(li); - - litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 15); - litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 15); - litest_touch_move_to_extended(dev, 0, - 80, 80, - 50, 50, - axes, 10, 1); - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); -} -END_TEST - -START_TEST(touchpad_palm_detect_touch_size) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_TOUCH_MAJOR, 0 }, - { ABS_MT_TOUCH_MINOR, 0 }, - { -1, 0 } - }; - - if (!touchpad_has_touch_size(dev) || - litest_touchpad_is_external(dev)) - return; - - litest_drain_events(li); - litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 30); - litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 30); - litest_touch_down_extended(dev, 0, 50, 50, axes); - litest_touch_move_to_extended(dev, 0, - 50, 50, - 80, 80, - axes, 10, 1); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - - litest_axis_set_value_unchecked(axes, ABS_MT_TOUCH_MAJOR, 90); - litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 90); - litest_touch_move_to_extended(dev, 0, - 80, 80, - 50, 50, - axes, 10, 1); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_speed_ignore_finger) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (litest_has_clickfinger(dev)) - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 20, 20); - litest_touch_move_to(dev, 0, 20, 20, 85, 80, 20, 0); - litest_touch_down(dev, 1, 20, 80); - litest_touch_move_two_touches(dev, 85, 80, 20, 80, -20, -20, 10, 0); - libinput_dispatch(li); - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -START_TEST(touchpad_speed_allow_nearby_finger) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (!litest_has_2fg_scroll(dev)) - return; - - if (litest_has_clickfinger(dev)) - litest_enable_clickfinger(dev); - - litest_enable_2fg_scroll(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 20, 20); - litest_touch_move_to(dev, 0, 20, 20, 80, 80, 20, 0); - litest_drain_events(li); - litest_touch_down(dev, 1, 79, 80); - litest_touch_move_two_touches(dev, 80, 80, 79, 80, -20, -20, 10, 0); - libinput_dispatch(li); - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); -} -END_TEST - -START_TEST(touchpad_speed_ignore_finger_edgescroll) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_edge_scroll(dev); - if (litest_has_clickfinger(dev)) - litest_enable_clickfinger(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 20, 20); - litest_touch_move_to(dev, 0, 20, 20, 60, 80, 20, 0); - litest_drain_events(li); - litest_touch_down(dev, 1, 59, 80); - litest_touch_move_two_touches(dev, 60, 80, 59, 80, -20, -20, 10, 0); - libinput_dispatch(li); - - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_touch_up(dev, 1); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); -} -END_TEST - -void -litest_setup_tests_touchpad(void) -{ - struct range axis_range = {ABS_X, ABS_Y + 1}; - struct range twice = {0, 2 }; - - litest_add("touchpad:motion", touchpad_1fg_motion, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:motion", touchpad_2fg_no_motion, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - - litest_add("touchpad:scroll", touchpad_2fg_scroll, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); - litest_add("touchpad:scroll", touchpad_2fg_scroll_diagonal, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); - litest_add("touchpad:scroll", touchpad_2fg_scroll_slow_distance, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:scroll", touchpad_2fg_scroll_return_to_motion, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:scroll", touchpad_2fg_scroll_source, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:scroll", touchpad_2fg_scroll_semi_mt, LITEST_SEMI_MT, LITEST_SINGLE_TOUCH); - litest_add("touchpad:scroll", touchpad_scroll_natural_defaults, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_scroll_natural_enable_config, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_scroll_natural_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:scroll", touchpad_scroll_natural_edge, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:scroll", touchpad_scroll_defaults, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_edge_scroll_vert, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_edge_scroll_horiz, LITEST_TOUCHPAD, LITEST_CLICKPAD); - litest_add("touchpad:scroll", touchpad_edge_scroll_horiz_clickpad, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_edge_scroll_no_horiz, LITEST_TOUCHPAD, LITEST_CLICKPAD); - litest_add("touchpad:scroll", touchpad_edge_scroll_no_motion, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_edge_scroll_no_edge_after_motion, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_edge_scroll_timeout, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_edge_scroll_source, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_edge_scroll_no_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:scroll", touchpad_edge_scroll_into_buttonareas, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_edge_scroll_within_buttonareas, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_edge_scroll_buttonareas_click_stops_scroll, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_edge_scroll_clickfinger_click_stops_scroll, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:scroll", touchpad_edge_scroll_into_area, LITEST_TOUCHPAD, LITEST_ANY); - - litest_add("touchpad:palm", touchpad_palm_detect_at_edge, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:palm", touchpad_palm_detect_at_top, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); - litest_add("touchpad:palm", touchpad_palm_detect_at_bottom_corners, LITEST_TOUCHPAD, LITEST_CLICKPAD); - litest_add("touchpad:palm", touchpad_palm_detect_at_top_corners, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); - litest_add("touchpad:palm", touchpad_palm_detect_palm_becomes_pointer, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:palm", touchpad_palm_detect_top_palm_becomes_pointer, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); - litest_add("touchpad:palm", touchpad_palm_detect_palm_stays_palm, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:palm", touchpad_palm_detect_top_palm_stays_palm, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); - litest_add("touchpad:palm", touchpad_palm_detect_no_palm_moving_into_edges, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:palm", touchpad_palm_detect_no_palm_moving_into_top, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); - litest_add("touchpad:palm", touchpad_palm_detect_no_tap_top_edge, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); - litest_add("touchpad:palm", touchpad_palm_detect_tap_hardbuttons, LITEST_TOUCHPAD, LITEST_CLICKPAD); - litest_add("touchpad:palm", touchpad_palm_detect_tap_softbuttons, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:palm", touchpad_palm_detect_tap_clickfinger, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:palm", touchpad_no_palm_detect_at_edge_for_edge_scrolling, LITEST_TOUCHPAD, LITEST_CLICKPAD); - litest_add("touchpad:palm", touchpad_no_palm_detect_2fg_scroll, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:palm", touchpad_palm_detect_both_edges, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:palm", touchpad_palm_detect_tool_palm, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:palm", touchpad_palm_detect_tool_palm_on_off, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:palm", touchpad_palm_detect_tool_palm_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:palm", touchpad_palm_detect_touch_size, LITEST_APPLE_CLICKPAD, LITEST_ANY); - - litest_add("touchpad:palm", touchpad_palm_detect_pressure, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:palm", touchpad_palm_detect_pressure_late, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:palm", touchpad_palm_detect_pressure_keep_palm, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:palm", touchpad_palm_detect_pressure_after_edge, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:palm", touchpad_palm_detect_pressure_after_dwt, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - - litest_add("touchpad:left-handed", touchpad_left_handed, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); - litest_add_for_device("touchpad:left-handed", touchpad_left_handed_appletouch, LITEST_APPLETOUCH); - litest_add("touchpad:left-handed", touchpad_left_handed_clickpad, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - litest_add("touchpad:left-handed", touchpad_left_handed_clickfinger, LITEST_APPLE_CLICKPAD, LITEST_ANY); - litest_add("touchpad:left-handed", touchpad_left_handed_tapping, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:left-handed", touchpad_left_handed_tapping_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:left-handed", touchpad_left_handed_delayed, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); - litest_add("touchpad:left-handed", touchpad_left_handed_clickpad_delayed, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); - - /* Semi-MT hover tests aren't generic, they only work on this device and - * ignore the semi-mt capability (it doesn't matter for the tests) */ - litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_noevent, LITEST_SYNAPTICS_HOVER_SEMI_MT); - litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_down, LITEST_SYNAPTICS_HOVER_SEMI_MT); - litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_down_up, LITEST_SYNAPTICS_HOVER_SEMI_MT); - litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_down_hover_down, LITEST_SYNAPTICS_HOVER_SEMI_MT); - litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_2fg_noevent, LITEST_SYNAPTICS_HOVER_SEMI_MT); - litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_2fg_1fg_down, LITEST_SYNAPTICS_HOVER_SEMI_MT); - litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_2fg_up, LITEST_SYNAPTICS_HOVER_SEMI_MT); - - litest_add("touchpad:hover", touchpad_hover_noevent, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); - litest_add("touchpad:hover", touchpad_hover_down, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); - litest_add("touchpad:hover", touchpad_hover_down_up, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); - litest_add("touchpad:hover", touchpad_hover_down_hover_down, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); - litest_add("touchpad:hover", touchpad_hover_2fg_noevent, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); - litest_add("touchpad:hover", touchpad_hover_2fg_1fg_down, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); - litest_add("touchpad:hover", touchpad_hover_1fg_tap, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); - - litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_buttons, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); - litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_mb_scroll, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); - litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_mb_click, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); - litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_buttons_softbuttons, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); - litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_buttons_2fg_scroll, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); - litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_no_trackpoint, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); - - litest_add_ranged("touchpad:state", touchpad_initial_state, LITEST_TOUCHPAD, LITEST_ANY, &axis_range); - - litest_add("touchpad:dwt", touchpad_dwt, LITEST_TOUCHPAD, LITEST_ANY); - litest_add_for_device("touchpad:dwt", touchpad_dwt_ext_and_int_keyboard, LITEST_SYNAPTICS_I2C); - litest_add("touchpad:dwt", touchpad_dwt_enable_touch, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_touch_hold, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_key_hold, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_key_hold_timeout, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_key_hold_timeout_existing_touch, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_key_hold_timeout_existing_touch_cornercase, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_type, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_type_short_timeout, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_modifier_no_dwt, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_modifier_combo_no_dwt, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_modifier_combo_dwt_after, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_modifier_combo_dwt_remains, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_fkeys_no_dwt, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_tap, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_tap_drag, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_click, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_edge_scroll, LITEST_TOUCHPAD, LITEST_CLICKPAD); - litest_add("touchpad:dwt", touchpad_dwt_edge_scroll_interrupt, LITEST_TOUCHPAD, LITEST_CLICKPAD); - litest_add("touchpad:dwt", touchpad_dwt_config_default_on, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_config_default_off, LITEST_ANY, LITEST_TOUCHPAD); - litest_add("touchpad:dwt", touchpad_dwt_disabled, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_disable_during_touch, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_disable_before_touch, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_disable_during_key_release, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_disable_during_key_hold, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_enable_during_touch, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_enable_before_touch, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_enable_during_tap, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:dwt", touchpad_dwt_remove_kbd_while_active, LITEST_TOUCHPAD, LITEST_ANY); - litest_add_for_device("touchpad:dwt", touchpad_dwt_apple, LITEST_BCM5974); - litest_add_for_device("touchpad:dwt", touchpad_dwt_acer_hawaii, LITEST_ACER_HAWAII_TOUCHPAD); - litest_add_for_device("touchpad:dwt", touchpad_dwt_multiple_keyboards, LITEST_SYNAPTICS_I2C); - litest_add_for_device("touchpad:dwt", touchpad_dwt_multiple_keyboards_bothkeys, LITEST_SYNAPTICS_I2C); - litest_add_for_device("touchpad:dwt", touchpad_dwt_multiple_keyboards_bothkeys_modifier, LITEST_SYNAPTICS_I2C); - litest_add_ranged_for_device("touchpad:dwt", touchpad_dwt_multiple_keyboards_remove, LITEST_SYNAPTICS_I2C, &twice); - - litest_add("touchpad:thumb", touchpad_thumb_begin_no_motion, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:thumb", touchpad_thumb_update_no_motion, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:thumb", touchpad_thumb_moving, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:thumb", touchpad_thumb_clickfinger, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:thumb", touchpad_thumb_btnarea, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:thumb", touchpad_thumb_tap_begin, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:thumb", touchpad_thumb_tap_touch, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:thumb", touchpad_thumb_tap_hold, LITEST_CLICKPAD, LITEST_ANY); - litest_add("touchpad:thumb", touchpad_thumb_tap_hold_2ndfg, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:thumb", touchpad_thumb_tap_hold_2ndfg_tap, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH); - - litest_add_for_device("touchpad:bugs", touchpad_tool_tripletap_touch_count, LITEST_SYNAPTICS_TOPBUTTONPAD); - litest_add_for_device("touchpad:bugs", touchpad_slot_swap, LITEST_SYNAPTICS_TOPBUTTONPAD); - litest_add_for_device("touchpad:bugs", touchpad_finger_always_down, LITEST_SYNAPTICS_TOPBUTTONPAD); - - litest_add("touchpad:time", touchpad_time_usec, LITEST_TOUCHPAD, LITEST_ANY); - - litest_add_for_device("touchpad:jumps", touchpad_jump_finger_motion, LITEST_SYNAPTICS_CLICKPAD_X220); - - litest_add_for_device("touchpad:sendevents", touchpad_disabled_on_mouse, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_for_device("touchpad:sendevents", touchpad_disabled_on_mouse_suspend_mouse, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_for_device("touchpad:sendevents", touchpad_disabled_double_mouse, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_for_device("touchpad:sendevents", touchpad_disabled_double_mouse_one_suspended, LITEST_SYNAPTICS_CLICKPAD_X220); - - litest_add("touchpad:pressure", touchpad_pressure, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:pressure", touchpad_pressure_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:pressure", touchpad_pressure_2fg_st, LITEST_TOUCHPAD|LITEST_SINGLE_TOUCH, LITEST_ANY); - litest_add("touchpad:pressure", touchpad_pressure_tap, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:pressure", touchpad_pressure_tap_2fg, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("touchpad:pressure", touchpad_pressure_tap_2fg_1fg_light, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("touchpad:pressure", touchpad_pressure_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - - litest_add("touchpad:touch-size", touchpad_touch_size, LITEST_APPLE_CLICKPAD, LITEST_ANY); - litest_add("touchpad:touch-size", touchpad_touch_size_2fg, LITEST_APPLE_CLICKPAD, LITEST_ANY); - - litest_add("touchpad:speed", touchpad_speed_ignore_finger, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); - litest_add("touchpad:speed", touchpad_speed_allow_nearby_finger, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); - litest_add("touchpad:speed", touchpad_speed_ignore_finger_edgescroll, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); -} diff -Nru libinput-1.10.3/test/test-touchpad-tap.c libinput-0.21.0/test/test-touchpad-tap.c --- libinput-1.10.3/test/test-touchpad-tap.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-touchpad-tap.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,3446 +0,0 @@ -/* - * Copyright © 2014-2015 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include -#include -#include -#include - -#include "libinput-util.h" -#include "litest.h" - -START_TEST(touchpad_1fg_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_timeout_tap(); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_doubletap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - uint32_t oldtime, curtime; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - msleep(10); - litest_touch_up(dev, 0); - msleep(10); - litest_touch_down(dev, 0, 50, 50); - msleep(10); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - - libinput_dispatch(li); - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - oldtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_lt(oldtime, curtime); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_lt(oldtime, curtime); - oldtime = curtime; - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_lt(oldtime, curtime); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_multitap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - uint32_t oldtime = 0, - curtime; - int range = _i, /* looped test */ - ntaps; - - litest_enable_tap(dev->libinput_device); - litest_enable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - litest_timeout_tap(); - libinput_dispatch(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_ge(curtime, oldtime); - oldtime = curtime; - } - litest_timeout_tap(); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_multitap_n_drag_move) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - uint32_t oldtime = 0, - curtime; - int range = _i, /* looped test */ - ntaps; - - litest_enable_tap(dev->libinput_device); - litest_enable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - libinput_dispatch(li); - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4); - libinput_dispatch(li); - - for (ntaps = 0; ntaps < range; ntaps++) { - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_ge(curtime, oldtime); - oldtime = curtime; - } - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 0); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_multitap_n_drag_2fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - uint32_t oldtime = 0, - curtime; - int range = _i, - ntaps; - - if (libevdev_has_property(dev->evdev, INPUT_PROP_SEMI_MT)) - return; - - litest_enable_tap(dev->libinput_device); - litest_enable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - libinput_dispatch(li); - litest_touch_down(dev, 0, 50, 50); - msleep(10); - litest_touch_down(dev, 1, 70, 50); - libinput_dispatch(li); - - for (ntaps = 0; ntaps < range; ntaps++) { - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_ge(curtime, oldtime); - oldtime = curtime; - } - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - litest_touch_move_to(dev, 1, 70, 50, 90, 50, 10, 4); - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - litest_timeout_tap(); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_multitap_n_drag_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - uint32_t oldtime = 0, - curtime; - int range = _i, /* looped test */ - ntaps; - - litest_enable_tap(dev->libinput_device); - litest_enable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - litest_touch_down(dev, 0, 50, 50); - libinput_dispatch(li); - litest_button_click(dev, BTN_LEFT, true); - litest_button_click(dev, BTN_LEFT, false); - libinput_dispatch(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_ge(curtime, oldtime); - oldtime = curtime; - } - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_touch_up(dev, 0); - litest_timeout_tap(); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_multitap_timeout) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - uint32_t ptime, rtime; - int range = _i, /* looped test */ - ntaps; - - litest_enable_tap(dev->libinput_device); - litest_enable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - msleep(10); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - ptime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - rtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_lt(ptime, rtime); - } - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_multitap_n_drag_timeout) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - uint32_t oldtime = 0, - curtime; - int range = _i, /* looped test */ - ntaps; - - litest_enable_tap(dev->libinput_device); - litest_enable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - msleep(10); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - libinput_dispatch(li); - litest_touch_down(dev, 0, 50, 50); - libinput_dispatch(li); - - litest_timeout_tap(); - libinput_dispatch(li); - - for (ntaps = 0; ntaps < range; ntaps++) { - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - oldtime = curtime; - } - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4); - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 0); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_multitap_n_drag_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - uint32_t oldtime = 0, - curtime; - int range = _i, /* looped test */ - ntaps; - - litest_enable_tap(dev->libinput_device); - litest_enable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - msleep(10); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - libinput_dispatch(li); - litest_touch_down(dev, 0, 50, 50); - libinput_dispatch(li); - - litest_timeout_tap(); - libinput_dispatch(li); - - for (ntaps = 0; ntaps < range; ntaps++) { - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_ge(curtime, oldtime); - oldtime = curtime; - } - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4); - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 70, 50); - litest_touch_up(dev, 0); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_multitap_n_drag_tap_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - uint32_t oldtime = 0, - curtime; - int range = _i, /* looped test */ - ntaps; - - litest_enable_tap(dev->libinput_device); - litest_enable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - msleep(10); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - libinput_dispatch(li); - litest_touch_down(dev, 0, 50, 50); - libinput_dispatch(li); - - litest_timeout_tap(); - libinput_dispatch(li); - - for (ntaps = 0; ntaps < range; ntaps++) { - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_ge(curtime, oldtime); - oldtime = curtime; - } - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4); - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 70, 50); - litest_button_click(dev, BTN_LEFT, true); - litest_button_click(dev, BTN_LEFT, false); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - /* the physical click */ - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_tap_n_drag) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - - litest_enable_tap(dev->libinput_device); - litest_disable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 80, 80, 20, 2); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 0); - - /* don't use helper functions here, we expect the event be available - * immediately, not after a timeout that the helper functions may - * trigger. - */ - libinput_dispatch(li); - event = libinput_get_event(li); - ck_assert_notnull(event); - litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - libinput_event_destroy(event); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_tap_n_drag_draglock) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - litest_enable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 80, 80, 20, 2); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - /* lift finger, set down again, should continue dragging */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 80, 80, 20, 2); - litest_touch_up(dev, 0); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_timeout_tap(); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_tap_n_drag_draglock_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - litest_enable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 80, 80, 20, 2); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - /* lift finger, set down again, should continue dragging */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 80, 80, 20, 2); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_tap_n_drag_draglock_tap_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - litest_enable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 80, 80, 20, 2); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - libinput_dispatch(li); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 50, 50); - litest_button_click(dev, BTN_LEFT, true); - litest_button_click(dev, BTN_LEFT, false); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - /* the physical click */ - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_tap_n_drag_draglock_timeout) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - litest_enable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 50, 50); - libinput_dispatch(li); - litest_timeout_tap(); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_assert_empty_queue(li); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tapndrag(); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_2fg_tap_n_drag) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - litest_disable_drag_lock(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 30, 70); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 30, 70); - litest_touch_down(dev, 1, 80, 70); - litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_2fg_tap_n_drag_3fg_btntool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) > 2) - return; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 30, 70); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 30, 70); - litest_touch_down(dev, 1, 80, 90); - litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - /* Putting down a third finger should end the drag */ - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - /* Releasing the fingers should not cause any events */ - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_2fg_tap_n_drag_3fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) <= 2) - return; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 30, 70); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 30, 70); - litest_touch_down(dev, 1, 80, 90); - litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40); - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - /* Putting down a third finger should end the drag */ - litest_touch_down(dev, 2, 50, 50); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - /* Releasing the fingers should not cause any events */ - litest_touch_up(dev, 2); - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_2fg_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - enum libinput_config_tap_button_map map = _i; /* ranged test */ - unsigned int button = 0; - struct libinput_event *ev; - struct libinput_event_pointer *ptrev; - uint64_t ptime, rtime; - - litest_enable_tap(dev->libinput_device); - litest_set_tap_map(dev->libinput_device, map); - - switch (map) { - case LIBINPUT_CONFIG_TAP_MAP_LRM: - button = BTN_RIGHT; - break; - case LIBINPUT_CONFIG_TAP_MAP_LMR: - button = BTN_MIDDLE; - break; - default: - litest_abort_msg("Invalid map range %d", map); - } - - litest_drain_events(dev->libinput); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 70); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - libinput_dispatch(li); - - ev = libinput_get_event(li); - ptrev = litest_is_button_event(ev, - button, - LIBINPUT_BUTTON_STATE_PRESSED); - ptime = libinput_event_pointer_get_time_usec(ptrev); - libinput_event_destroy(ev); - ev = libinput_get_event(li); - ptrev = litest_is_button_event(ev, - button, - LIBINPUT_BUTTON_STATE_RELEASED); - rtime = libinput_event_pointer_get_time_usec(ptrev); - libinput_event_destroy(ev); - - ck_assert_int_lt(ptime, rtime); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_2fg_tap_inverted) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - enum libinput_config_tap_button_map map = _i; /* ranged test */ - unsigned int button = 0; - struct libinput_event *ev; - struct libinput_event_pointer *ptrev; - uint64_t ptime, rtime; - - litest_enable_tap(dev->libinput_device); - litest_set_tap_map(dev->libinput_device, map); - - switch (map) { - case LIBINPUT_CONFIG_TAP_MAP_LRM: - button = BTN_RIGHT; - break; - case LIBINPUT_CONFIG_TAP_MAP_LMR: - button = BTN_MIDDLE; - break; - default: - litest_abort_msg("Invalid map range %d", map); - } - - litest_drain_events(dev->libinput); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 70); - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - ev = libinput_get_event(li); - ptrev = litest_is_button_event(ev, - button, - LIBINPUT_BUTTON_STATE_PRESSED); - ptime = libinput_event_pointer_get_time_usec(ptrev); - libinput_event_destroy(ev); - ev = libinput_get_event(li); - ptrev = litest_is_button_event(ev, - button, - LIBINPUT_BUTTON_STATE_RELEASED); - rtime = libinput_event_pointer_get_time_usec(ptrev); - libinput_event_destroy(ev); - - ck_assert_int_lt(ptime, rtime); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_2fg_tap_n_hold_first) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(dev->libinput); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 70); - litest_touch_up(dev, 1); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); - litest_timeout_tap(); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_2fg_tap_n_hold_second) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(dev->libinput); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 70); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); - litest_timeout_tap(); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_2fg_tap_quickrelease) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(dev->libinput); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 70); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_timeout_tap(); - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_tap_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(dev->libinput); - - /* Finger down, finger up -> tap button press - * Physical button click -> no button press/release - * Tap timeout -> tap button release */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_timeout_tap(); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_2fg_tap_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(dev->libinput); - - /* two fingers down, left button click, fingers up - -> one left button, one right button event pair */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_2fg_tap_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(dev->libinput); - - /* two fingers down, button click, fingers up - -> only one button left event pair */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_2fg_tap_click_apple) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(dev->libinput); - - /* two fingers down, button click, fingers up - -> only one button right event pair - (apple have clickfinger enabled by default) */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_no_2fg_tap_after_move) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(dev->libinput); - - /* one finger down, move past threshold, - second finger down, first finger up - -> no event - */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 90, 90, 10, 0); - litest_drain_events(dev->libinput); - - litest_touch_down(dev, 1, 70, 50); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_no_2fg_tap_after_timeout) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(dev->libinput); - - /* one finger down, wait past tap timeout, - second finger down, first finger up - -> no event - */ - litest_touch_down(dev, 0, 50, 50); - libinput_dispatch(dev->libinput); - litest_timeout_tap(); - libinput_dispatch(dev->libinput); - litest_drain_events(dev->libinput); - - litest_touch_down(dev, 1, 70, 50); - litest_touch_up(dev, 0); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_no_first_fg_tap_after_move) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(dev->libinput); - - /* one finger down, second finger down, - second finger moves beyond threshold, - first finger up - -> no event - */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - libinput_dispatch(dev->libinput); - litest_touch_move_to(dev, 1, 70, 50, 90, 90, 10, 0); - libinput_dispatch(dev->libinput); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - libinput_dispatch(dev->libinput); - - while ((event = libinput_get_event(li))) { - ck_assert_int_ne(libinput_event_get_type(event), - LIBINPUT_EVENT_POINTER_BUTTON); - libinput_event_destroy(event); - } -} -END_TEST - -START_TEST(touchpad_1fg_double_tap_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(dev->libinput); - - /* one finger down, up, down, button click, finger up - -> two button left event pairs */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 50, 50); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_1fg_tap_n_drag_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(dev->libinput); - - /* one finger down, up, down, move, button click, finger up - -> two button left event pairs, motion allowed */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 80, 50, 10, 0); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_3fg_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - enum libinput_config_tap_button_map map = _i; /* ranged test */ - unsigned int button = 0; - int i; - - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) <= 2) - return; - - litest_enable_tap(dev->libinput_device); - litest_set_tap_map(dev->libinput_device, map); - - switch (map) { - case LIBINPUT_CONFIG_TAP_MAP_LRM: - button = BTN_MIDDLE; - break; - case LIBINPUT_CONFIG_TAP_MAP_LMR: - button = BTN_RIGHT; - break; - default: - litest_abort_msg("Invalid map range %d", map); - } - - for (i = 0; i < 3; i++) { - uint64_t ptime, rtime; - struct libinput_event *ev; - struct libinput_event_pointer *ptrev; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - msleep(5); - litest_touch_down(dev, 1, 70, 50); - msleep(5); - litest_touch_down(dev, 2, 80, 50); - msleep(10); - - litest_touch_up(dev, (i + 2) % 3); - litest_touch_up(dev, (i + 1) % 3); - litest_touch_up(dev, (i + 0) % 3); - - libinput_dispatch(li); - - ev = libinput_get_event(li); - ptrev = litest_is_button_event(ev, - button, - LIBINPUT_BUTTON_STATE_PRESSED); - ptime = libinput_event_pointer_get_time_usec(ptrev); - libinput_event_destroy(ev); - ev = libinput_get_event(li); - ptrev = litest_is_button_event(ev, - button, - LIBINPUT_BUTTON_STATE_RELEASED); - rtime = libinput_event_pointer_get_time_usec(ptrev); - libinput_event_destroy(ev); - - ck_assert_int_lt(ptime, rtime); - - } -} -END_TEST - -START_TEST(touchpad_3fg_tap_tap_again) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i; - - if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) <= 2) - return; - - litest_enable_tap(dev->libinput_device); - - uint64_t ptime, rtime; - struct libinput_event *ev; - struct libinput_event_pointer *ptrev; - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - msleep(5); - litest_touch_down(dev, 1, 70, 50); - msleep(5); - litest_touch_down(dev, 2, 80, 50); - msleep(10); - litest_touch_up(dev, 0); - msleep(10); - litest_touch_down(dev, 0, 80, 50); - msleep(10); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 2); - - libinput_dispatch(li); - - for (i = 0; i < 2; i++) { - ev = libinput_get_event(li); - ptrev = litest_is_button_event(ev, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - ptime = libinput_event_pointer_get_time_usec(ptrev); - libinput_event_destroy(ev); - ev = libinput_get_event(li); - ptrev = litest_is_button_event(ev, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - rtime = libinput_event_pointer_get_time_usec(ptrev); - libinput_event_destroy(ev); - - ck_assert_int_lt(ptime, rtime); - } -} -END_TEST - -START_TEST(touchpad_3fg_tap_quickrelease) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) <= 2) - return; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - litest_touch_down(dev, 2, 80, 50); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 2); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_timeout_tap(); - litest_assert_button_event(li, BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - - libinput_dispatch(li); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_3fg_tap_pressure_btntool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) >= 2) - return; - - /* libinput doesn't export when it uses pressure detection, so we - * need to reconstruct this here. Specifically, semi-mt devices are - * non-mt in libinput, so if they have ABS_PRESSURE, they'll use it. - */ - if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_PRESSURE)) - return; - - litest_enable_tap(dev->libinput_device); - litest_enable_edge_scroll(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - libinput_dispatch(li); - - litest_touch_move_to(dev, 0, 50, 50, 50, 70, 10, 0); - litest_touch_move_to(dev, 1, 70, 50, 50, 70, 10, 0); - litest_drain_events(li); - - /* drop below the pressure threshold in the same frame as starting a */ - litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 3); - litest_event(dev, EV_ABS, ABS_PRESSURE, 3); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_push_event_frame(dev); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_pop_event_frame(dev); - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); -} -END_TEST - -START_TEST(touchpad_3fg_tap_hover_btntool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) >= 2) - return; - - /* libinput doesn't export when it uses pressure detection, so we - * need to reconstruct this here. Specifically, semi-mt devices are - * non-mt in libinput, so if they have ABS_PRESSURE, they'll use it. - */ - if (libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_PRESSURE)) - return; - - if (libevdev_has_property(dev->evdev, INPUT_PROP_SEMI_MT) && - libevdev_has_event_code(dev->evdev, EV_ABS, ABS_PRESSURE)) - return; - - litest_enable_tap(dev->libinput_device); - litest_enable_edge_scroll(dev); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - libinput_dispatch(li); - - litest_touch_move_to(dev, 0, 50, 50, 50, 70, 10, 0); - litest_touch_move_to(dev, 1, 70, 50, 50, 70, 10, 0); - litest_drain_events(li); - - /* drop below the pressure threshold in the same frame as starting a - * third touch */ - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - litest_push_event_frame(dev); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_pop_event_frame(dev); - litest_assert_empty_queue(li); - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); -} -END_TEST - -START_TEST(touchpad_3fg_tap_btntool) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - enum libinput_config_tap_button_map map = _i; /* ranged test */ - unsigned int button = 0; - - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) > 2) - return; - - litest_enable_tap(dev->libinput_device); - litest_set_tap_map(dev->libinput_device, map); - - switch (map) { - case LIBINPUT_CONFIG_TAP_MAP_LRM: - button = BTN_MIDDLE; - break; - case LIBINPUT_CONFIG_TAP_MAP_LMR: - button = BTN_RIGHT; - break; - default: - litest_abort_msg("Invalid map range %d", map); - } - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, button, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_timeout_tap(); - litest_assert_button_event(li, button, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_3fg_tap_btntool_inverted) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - enum libinput_config_tap_button_map map = _i; /* ranged test */ - unsigned int button = 0; - - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) > 2) - return; - - litest_enable_tap(dev->libinput_device); - litest_set_tap_map(dev->libinput_device, map); - - switch (map) { - case LIBINPUT_CONFIG_TAP_MAP_LRM: - button = BTN_MIDDLE; - break; - case LIBINPUT_CONFIG_TAP_MAP_LMR: - button = BTN_RIGHT; - break; - default: - litest_abort_msg("invalid map range %d", map); - } - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - libinput_dispatch(li); - - litest_assert_button_event(li, button, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_timeout_tap(); - litest_assert_button_event(li, button, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_3fg_tap_btntool_pointerjump) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - enum libinput_config_tap_button_map map = _i; /* ranged test */ - unsigned int button = 0; - - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) > 2) - return; - - litest_enable_tap(dev->libinput_device); - litest_set_tap_map(dev->libinput_device, map); - - switch (map) { - case LIBINPUT_CONFIG_TAP_MAP_LRM: - button = BTN_MIDDLE; - break; - case LIBINPUT_CONFIG_TAP_MAP_LMR: - button = BTN_RIGHT; - break; - default: - litest_abort_msg("Invalid map range %d", map); - } - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - /* Pointer jump should be ignored */ - litest_touch_move_to(dev, 0, 50, 50, 20, 20, 0, 0); - libinput_dispatch(li); - litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); - litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_button_event(li, button, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_timeout_tap(); - litest_assert_button_event(li, button, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_4fg_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i; - - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) <= 3) - return; - - litest_enable_tap(dev->libinput_device); - - for (i = 0; i < 4; i++) { - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - litest_touch_down(dev, 2, 80, 50); - litest_touch_down(dev, 3, 90, 50); - - litest_touch_up(dev, (i + 3) % 4); - litest_touch_up(dev, (i + 2) % 4); - litest_touch_up(dev, (i + 1) % 4); - litest_touch_up(dev, (i + 0) % 4); - - libinput_dispatch(li); - litest_assert_empty_queue(li); - litest_timeout_tap(); - litest_assert_empty_queue(li); - } -} -END_TEST - -START_TEST(touchpad_4fg_tap_quickrelease) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) <= 3) - return; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 50); - litest_touch_down(dev, 2, 80, 50); - litest_touch_down(dev, 3, 90, 50); - - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 2); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 3); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 0); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - litest_assert_empty_queue(li); - litest_timeout_tap(); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_5fg_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - int i; - - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) <= 4) - return; - - litest_enable_tap(dev->libinput_device); - - for (i = 0; i < 5; i++) { - litest_drain_events(li); - - litest_touch_down(dev, 0, 20, 50); - litest_touch_down(dev, 1, 30, 50); - litest_touch_down(dev, 2, 40, 50); - litest_touch_down(dev, 3, 50, 50); - litest_touch_down(dev, 4, 60, 50); - - litest_touch_up(dev, (i + 4) % 5); - litest_touch_up(dev, (i + 3) % 5); - litest_touch_up(dev, (i + 2) % 5); - litest_touch_up(dev, (i + 1) % 5); - litest_touch_up(dev, (i + 0) % 5); - - libinput_dispatch(li); - litest_assert_empty_queue(li); - litest_timeout_tap(); - litest_assert_empty_queue(li); - } -} -END_TEST - -START_TEST(touchpad_5fg_tap_quickrelease) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - if (libevdev_get_abs_maximum(dev->evdev, - ABS_MT_SLOT) <= 4) - return; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 20, 50); - litest_touch_down(dev, 1, 30, 50); - litest_touch_down(dev, 2, 40, 50); - litest_touch_down(dev, 3, 70, 50); - litest_touch_down(dev, 4, 90, 50); - - litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 2); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 3); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_ABS, ABS_MT_SLOT, 4); - litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); - litest_event(dev, EV_KEY, BTN_TOOL_QUINTTAP, 0); - litest_event(dev, EV_KEY, BTN_TOUCH, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - - libinput_dispatch(li); - litest_assert_empty_queue(li); - litest_timeout_tap(); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(clickpad_1fg_tap_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - - litest_drain_events(dev->libinput); - - /* finger down, button click, finger up - -> only one button left event pair */ - litest_touch_down(dev, 0, 50, 50); - litest_event(dev, EV_KEY, BTN_LEFT, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_event(dev, EV_KEY, BTN_LEFT, 0); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_timeout_tap(); - - libinput_dispatch(li); - - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_is_available) -{ - struct litest_device *dev = litest_current_device(); - - ck_assert_int_ge(libinput_device_config_tap_get_finger_count(dev->libinput_device), 1); -} -END_TEST - -START_TEST(touchpad_tap_is_not_available) -{ - struct litest_device *dev = litest_current_device(); - - ck_assert_int_eq(libinput_device_config_tap_get_finger_count(dev->libinput_device), 0); - ck_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device), - LIBINPUT_CONFIG_TAP_DISABLED); - ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, - LIBINPUT_CONFIG_TAP_ENABLED), - LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, - LIBINPUT_CONFIG_TAP_DISABLED), - LIBINPUT_CONFIG_STATUS_SUCCESS); -} -END_TEST - -START_TEST(touchpad_tap_default_disabled) -{ - struct litest_device *dev = litest_current_device(); - - /* this test is only run on specific devices */ - - ck_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device), - LIBINPUT_CONFIG_TAP_DISABLED); - ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device), - LIBINPUT_CONFIG_TAP_DISABLED); -} -END_TEST - -START_TEST(touchpad_tap_default_enabled) -{ - struct litest_device *dev = litest_current_device(); - - /* this test is only run on specific devices */ - - ck_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device), - LIBINPUT_CONFIG_TAP_ENABLED); - ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device), - LIBINPUT_CONFIG_TAP_ENABLED); -} -END_TEST - -START_TEST(touchpad_tap_invalid) -{ - struct litest_device *dev = litest_current_device(); - - ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, 2), - LIBINPUT_CONFIG_STATUS_INVALID); - ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, -1), - LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -START_TEST(touchpad_tap_default_map) -{ - struct litest_device *dev = litest_current_device(); - enum libinput_config_tap_button_map map; - - map = libinput_device_config_tap_get_button_map(dev->libinput_device); - ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); - - map = libinput_device_config_tap_get_default_button_map(dev->libinput_device); - ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); -} -END_TEST - -START_TEST(touchpad_tap_map_unsupported) -{ - struct litest_device *dev = litest_current_device(); - enum libinput_config_tap_button_map map; - enum libinput_config_status status; - - map = libinput_device_config_tap_get_button_map(dev->libinput_device); - ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); - map = libinput_device_config_tap_get_default_button_map(dev->libinput_device); - ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); - - status = libinput_device_config_tap_set_button_map(dev->libinput_device, - LIBINPUT_CONFIG_TAP_MAP_LMR); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - status = libinput_device_config_tap_set_button_map(dev->libinput_device, - LIBINPUT_CONFIG_TAP_MAP_LRM); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); -} -END_TEST - -START_TEST(touchpad_tap_set_map) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_tap_button_map map; - enum libinput_config_status status; - - map = LIBINPUT_CONFIG_TAP_MAP_LRM; - status = libinput_device_config_tap_set_button_map(device, map); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - map = libinput_device_config_tap_get_button_map(dev->libinput_device); - ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); - - map = LIBINPUT_CONFIG_TAP_MAP_LMR; - status = libinput_device_config_tap_set_button_map(device, map); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - map = libinput_device_config_tap_get_button_map(dev->libinput_device); - ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LMR); - - map = LIBINPUT_CONFIG_TAP_MAP_LRM - 1; - status = libinput_device_config_tap_set_button_map(device, map); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); - - map = LIBINPUT_CONFIG_TAP_MAP_LMR + 1; - status = libinput_device_config_tap_set_button_map(device, map); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -START_TEST(touchpad_tap_set_map_no_tapping) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_tap_button_map map; - enum libinput_config_status status; - - map = LIBINPUT_CONFIG_TAP_MAP_LRM; - status = libinput_device_config_tap_set_button_map(device, map); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - - map = LIBINPUT_CONFIG_TAP_MAP_LMR; - status = libinput_device_config_tap_set_button_map(device, map); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - - map = LIBINPUT_CONFIG_TAP_MAP_LRM - 1; - status = libinput_device_config_tap_set_button_map(device, map); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); - - map = LIBINPUT_CONFIG_TAP_MAP_LMR + 1; - status = libinput_device_config_tap_set_button_map(device, map); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -START_TEST(touchpad_tap_get_map_no_tapping) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_tap_button_map map; - - map = libinput_device_config_tap_get_button_map(device); - ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); - - map = libinput_device_config_tap_get_default_button_map(device); - ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LRM); -} -END_TEST - -START_TEST(touchpad_tap_map_delayed) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - enum libinput_config_tap_button_map map; - - litest_enable_tap(dev->libinput_device); - litest_set_tap_map(dev->libinput_device, - LIBINPUT_CONFIG_TAP_MAP_LRM); - litest_drain_events(dev->libinput); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 70, 70); - libinput_dispatch(li); - - litest_set_tap_map(dev->libinput_device, - LIBINPUT_CONFIG_TAP_MAP_LMR); - map = libinput_device_config_tap_get_button_map(dev->libinput_device); - ck_assert_int_eq(map, LIBINPUT_CONFIG_TAP_MAP_LMR); - - litest_touch_up(dev, 0); - litest_touch_up(dev, 1); - - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_timeout_tap(); - litest_assert_button_event(li, BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_drag_default_disabled) -{ - struct litest_device *dev = litest_current_device(); - - /* this test is only run on specific devices */ - - ck_assert_int_eq(libinput_device_config_tap_get_default_drag_enabled(dev->libinput_device), - LIBINPUT_CONFIG_DRAG_DISABLED); - ck_assert_int_eq(libinput_device_config_tap_get_drag_enabled(dev->libinput_device), - LIBINPUT_CONFIG_DRAG_DISABLED); -} -END_TEST - -START_TEST(touchpad_drag_default_enabled) -{ - struct litest_device *dev = litest_current_device(); - - /* this test is only run on specific devices */ - - ck_assert_int_eq(libinput_device_config_tap_get_default_drag_enabled(dev->libinput_device), - LIBINPUT_CONFIG_DRAG_ENABLED); - ck_assert_int_eq(libinput_device_config_tap_get_drag_enabled(dev->libinput_device), - LIBINPUT_CONFIG_DRAG_ENABLED); -} -END_TEST - -START_TEST(touchpad_drag_config_invalid) -{ - struct litest_device *dev = litest_current_device(); - - ck_assert_int_eq(libinput_device_config_tap_set_drag_enabled(dev->libinput_device, 2), - LIBINPUT_CONFIG_STATUS_INVALID); - ck_assert_int_eq(libinput_device_config_tap_set_drag_enabled(dev->libinput_device, -1), - LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -START_TEST(touchpad_drag_config_unsupported) -{ - struct litest_device *dev = litest_current_device(); - enum libinput_config_status status; - - ck_assert_int_eq(libinput_device_config_tap_get_default_drag_enabled(dev->libinput_device), - LIBINPUT_CONFIG_DRAG_DISABLED); - ck_assert_int_eq(libinput_device_config_tap_get_drag_enabled(dev->libinput_device), - LIBINPUT_CONFIG_DRAG_DISABLED); - status = libinput_device_config_tap_set_drag_enabled(dev->libinput_device, - LIBINPUT_CONFIG_DRAG_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - status = libinput_device_config_tap_set_drag_enabled(dev->libinput_device, - LIBINPUT_CONFIG_DRAG_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); -} -END_TEST - -START_TEST(touchpad_drag_config_enabledisable) -{ - struct litest_device *dev = litest_current_device(); - enum libinput_config_drag_state state; - - litest_enable_tap(dev->libinput_device); - - litest_disable_tap_drag(dev->libinput_device); - state = libinput_device_config_tap_get_drag_enabled(dev->libinput_device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_DRAG_DISABLED); - - litest_enable_tap_drag(dev->libinput_device); - state = libinput_device_config_tap_get_drag_enabled(dev->libinput_device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_DRAG_ENABLED); - - /* same thing with tapping disabled */ - litest_enable_tap(dev->libinput_device); - - litest_disable_tap_drag(dev->libinput_device); - state = libinput_device_config_tap_get_drag_enabled(dev->libinput_device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_DRAG_DISABLED); - - litest_enable_tap_drag(dev->libinput_device); - state = libinput_device_config_tap_get_drag_enabled(dev->libinput_device); - ck_assert_int_eq(state, LIBINPUT_CONFIG_DRAG_ENABLED); -} -END_TEST - -START_TEST(touchpad_drag_disabled) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_enable_tap(dev->libinput_device); - litest_disable_tap_drag(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 90, 90, 10, 0); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - -} -END_TEST - -START_TEST(touchpad_drag_disabled_immediate) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *ev; - struct libinput_event_pointer *ptrev; - uint64_t press_time, release_time; - - litest_enable_tap(dev->libinput_device); - litest_disable_tap_drag(dev->libinput_device); - - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - msleep(10); /* to force a time difference */ - libinput_dispatch(li); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - ev = libinput_get_event(li); - ptrev = litest_is_button_event(ev, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - press_time = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(ev); - - ev = libinput_get_event(li); - ptrev = litest_is_button_event(ev, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - release_time = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(ev); - - ck_assert_int_gt(release_time, press_time); -} -END_TEST - -START_TEST(touchpad_drag_disabled_multitap_no_drag) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - uint32_t oldtime = 0, - curtime; - int range = _i, /* looped test */ - ntaps; - - litest_enable_tap(dev->libinput_device); - litest_disable_tap_drag(dev->libinput_device); - - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - libinput_dispatch(li); - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4); - libinput_dispatch(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_gt(curtime, oldtime); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - curtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - ck_assert_int_ge(curtime, oldtime); - oldtime = curtime; - } - - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_drag_lock_default_disabled) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - - ck_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device), - LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); - ck_assert_int_eq(libinput_device_config_tap_get_default_drag_lock_enabled(device), - LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); - - status = libinput_device_config_tap_set_drag_lock_enabled(device, - LIBINPUT_CONFIG_DRAG_LOCK_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - status = libinput_device_config_tap_set_drag_lock_enabled(device, - LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - status = libinput_device_config_tap_set_drag_lock_enabled(device, - LIBINPUT_CONFIG_DRAG_LOCK_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - status = libinput_device_config_tap_set_drag_lock_enabled(device, - 3); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -START_TEST(touchpad_drag_lock_default_unavailable) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - - ck_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device), - LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); - ck_assert_int_eq(libinput_device_config_tap_get_default_drag_lock_enabled(device), - LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); - - status = libinput_device_config_tap_set_drag_lock_enabled(device, - LIBINPUT_CONFIG_DRAG_LOCK_ENABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - - status = libinput_device_config_tap_set_drag_lock_enabled(device, - LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - status = libinput_device_config_tap_set_drag_lock_enabled(device, - 3); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -static inline bool -touchpad_has_palm_pressure(struct litest_device *dev) -{ - struct libevdev *evdev = dev->evdev; - - if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_PRESSURE)) - return true; - - return false; -} - -START_TEST(touchpad_tap_palm_on_idle) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* Finger down is immediately palm */ - - litest_touch_down_extended(dev, 0, 50, 50, axes); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_on_touch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* Finger down is palm after touch begin */ - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_on_touch_hold_timeout) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* Finger down is palm after tap timeout */ - - litest_touch_down(dev, 0, 50, 50); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_on_touch_hold_move) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* Finger down is palm after tap move threshold */ - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to(dev, 0, 50, 50, 60, 60, 10, 1); - litest_drain_events(li); - - litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_on_tapped) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* tap + palm down */ - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1); - litest_touch_up(dev, 0); - - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_on_tapped_2fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* tap + palm down + tap with second finger */ - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1); - - libinput_dispatch(li); - - litest_touch_down(dev, 1, 50, 50); - litest_touch_up(dev, 1); - libinput_dispatch(li); - - litest_timeout_tap(); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_on_drag) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* tap + finger down (->drag), finger turns into palm */ - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_touch_down(dev, 0, 50, 50); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - - litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_on_drag_2fg) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - int which = _i; /* ranged test */ - int this = which % 2, - other = (which + 1) % 2; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* tap + finger down, 2nd finger down, finger turns to palm */ - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_touch_down(dev, this, 50, 50); - litest_touch_down(dev, other, 60, 50); - libinput_dispatch(li); - - litest_touch_move_to_extended(dev, this, 50, 50, 50, 50, axes, 1, 1); - libinput_dispatch(li); - - litest_touch_move_to(dev, other, 60, 50, 65, 50, 10, 1); - litest_assert_only_typed_events(li, - LIBINPUT_EVENT_POINTER_MOTION); - litest_touch_up(dev, other); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_touch_up(dev, this); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_on_touch_2) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - int which = _i; /* ranged test */ - int this = which % 2, - other = (which + 1) % 2; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* 2fg tap with one finger detected as palm */ - litest_touch_down(dev, 0, 50, 50); - litest_touch_down(dev, 1, 60, 60); - litest_drain_events(li); - litest_touch_move_to_extended(dev, this, 50, 50, 50, 50, axes, 1, 1); - - - litest_touch_up(dev, this); - litest_touch_up(dev, other); - - libinput_dispatch(li); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_timeout_tap(); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_on_touch_2_retouch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - int which = _i; /* ranged test */ - int this = which % 2, - other = (which + 1) % 2; - - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* 2fg tap with one finger detected as palm, that finger is lifted - * and taps again as not-palm */ - litest_touch_down(dev, this, 50, 50); - litest_touch_down(dev, other, 60, 60); - litest_drain_events(li); - litest_touch_move_to_extended(dev, this, 50, 50, 50, 50, axes, 1, 1); - litest_touch_up(dev, this); - libinput_dispatch(li); - - litest_touch_down(dev, this, 70, 70); - litest_touch_up(dev, this); - litest_touch_up(dev, other); - - libinput_dispatch(li); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_timeout_tap(); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_on_touch_3) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - int which = _i; /* ranged test */ - int this = which % 3; - - if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) <= 3) - return; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* 3fg tap with one finger detected as palm, that finger is lifted, - other two fingers lifted cause 2fg tap */ - litest_touch_down(dev, this, 50, 50); - litest_touch_down(dev, (this + 1) % 3, 60, 50); - litest_touch_down(dev, (this + 2) % 3, 70, 50); - litest_drain_events(li); - litest_touch_move_to_extended(dev, this, 50, 50, 50, 50, axes, 1, 1); - litest_touch_up(dev, this); - libinput_dispatch(li); - - litest_touch_up(dev, (this + 1) % 3); - litest_touch_up(dev, (this + 2) % 3); - - libinput_dispatch(li); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_timeout_tap(); - litest_assert_button_event(li, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_on_touch_3_retouch) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - int which = _i; /* ranged test */ - int this = which % 3; - - if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) <= 3) - return; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* 3fg tap with one finger detected as palm, that finger is lifted, - then put down again as normal finger -> 3fg tap */ - litest_touch_down(dev, this, 50, 50); - litest_touch_down(dev, (this + 1) % 3, 60, 50); - litest_touch_down(dev, (this + 2) % 3, 70, 50); - litest_drain_events(li); - litest_timeout_tap(); - libinput_dispatch(li); - - litest_touch_move_to_extended(dev, this, 50, 50, 50, 50, axes, 1, 1); - litest_touch_up(dev, this); - libinput_dispatch(li); - - litest_touch_down(dev, this, 50, 50); - litest_touch_up(dev, this); - litest_touch_up(dev, (this + 1) % 3); - litest_touch_up(dev, (this + 2) % 3); - - libinput_dispatch(li); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_timeout_tap(); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_on_touch_4) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - int which = _i; /* ranged test */ - int this = which % 4; - - if (libevdev_get_abs_maximum(dev->evdev, ABS_MT_SLOT) <= 4) - return; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - /* 3fg tap with one finger detected as palm, that finger is lifted, - other two fingers lifted cause 2fg tap */ - litest_touch_down(dev, this, 50, 50); - litest_touch_down(dev, (this + 1) % 4, 60, 50); - litest_touch_down(dev, (this + 2) % 4, 70, 50); - litest_touch_down(dev, (this + 3) % 4, 80, 50); - litest_drain_events(li); - litest_touch_move_to_extended(dev, this, 50, 50, 50, 50, axes, 1, 1); - litest_touch_up(dev, this); - libinput_dispatch(li); - - litest_touch_up(dev, (this + 1) % 4); - litest_touch_up(dev, (this + 2) % 4); - litest_touch_up(dev, (this + 3) % 4); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_after_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - libinput_dispatch(li); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1); - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_timeout_tap(); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_multitap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - int range = _i, /* ranged test */ - ntaps; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1); - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - } - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_multitap_timeout) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - int range = _i, /* ranged test */ - ntaps; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - } - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_multitap_down_again) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - int range = _i, /* ranged test */ - ntaps; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1); - libinput_dispatch(li); - - /* keep palm finger down */ - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 1, 50, 50); - litest_touch_up(dev, 1); - libinput_dispatch(li); - msleep(10); - } - - for (ntaps = 0; ntaps <= 2 * range; ntaps++) { - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - } - - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_multitap_click) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - int range = _i, /* ranged test */ - ntaps; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - msleep(10); - } - - litest_touch_down(dev, 0, 50, 50); - litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1); - libinput_dispatch(li); - /* keep palm finger down */ - - litest_button_click(dev, BTN_LEFT, true); - litest_button_click(dev, BTN_LEFT, false); - libinput_dispatch(li); - - for (ntaps = 0; ntaps <= range; ntaps++) { - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - } - - /* the click */ - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_click_then_tap) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - litest_touch_down_extended(dev, 0, 50, 50, axes); - libinput_dispatch(li); - - litest_button_click(dev, BTN_LEFT, true); - litest_button_click(dev, BTN_LEFT, false); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_touch_up(dev, 0); - litest_assert_empty_queue(li); - - litest_touch_down(dev, 0, 50, 50); - litest_touch_up(dev, 0); - libinput_dispatch(li); - litest_timeout_tap(); - libinput_dispatch(li); - - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(touchpad_tap_palm_dwt_tap) -{ - struct litest_device *dev = litest_current_device(); - struct litest_device *keyboard; - struct libinput *li = dev->libinput; - struct axis_replacement axes[] = { - { ABS_MT_PRESSURE, 75 }, - { -1, 0 } - }; - - if (!touchpad_has_palm_pressure(dev)) - return; - - keyboard = litest_add_device(li, LITEST_KEYBOARD); - - litest_enable_tap(dev->libinput_device); - litest_drain_events(li); - - litest_keyboard_key(keyboard, KEY_A, true); - litest_keyboard_key(keyboard, KEY_B, true); - litest_keyboard_key(keyboard, KEY_A, false); - litest_drain_events(li); - - litest_touch_down(dev, 0, 50, 50); - libinput_dispatch(li); - - litest_keyboard_key(keyboard, KEY_B, false); - litest_drain_events(li); - litest_timeout_dwt_long(); - libinput_dispatch(li); - - /* Changes to palm after dwt timeout */ - litest_touch_move_to_extended(dev, 0, 50, 50, 50, 50, axes, 1, 1); - libinput_dispatch(li); - - litest_touch_up(dev, 0); - libinput_dispatch(li); - - litest_assert_empty_queue(li); -} -END_TEST - -void -litest_setup_tests_touchpad_tap(void) -{ - struct range multitap_range = {3, 5}; - struct range tap_map_range = { LIBINPUT_CONFIG_TAP_MAP_LRM, - LIBINPUT_CONFIG_TAP_MAP_LMR + 1 }; - struct range range_2fg = {0, 2}; - struct range range_3fg = {0, 3}; - struct range range_4fg = {0, 4}; - - litest_add("tap-1fg:1fg", touchpad_1fg_tap, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap-1fg:1fg", touchpad_1fg_doubletap, LITEST_TOUCHPAD, LITEST_ANY); - litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); - litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_timeout, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); - litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_n_drag_timeout, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); - litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_n_drag_tap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); - litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_n_drag_move, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); - litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_n_drag_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &multitap_range); - litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY, &multitap_range); - litest_add("tap-1fg:1fg", touchpad_1fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap-1fg:1fg", touchpad_1fg_tap_n_drag_draglock, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap-1fg:1fg", touchpad_1fg_tap_n_drag_draglock_tap, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap-1fg:1fg", touchpad_1fg_tap_n_drag_draglock_timeout, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_drag_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD); - litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_drag_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add_ranged("tap-2fg:2fg", touchpad_2fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT, &tap_map_range); - litest_add_ranged("tap-2fg:2fg", touchpad_2fg_tap_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &tap_map_range); - litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_hold_first, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("tap-2fg:2fg", touchpad_2fg_tap_n_hold_second, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("tap-2fg:2fg", touchpad_2fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); - litest_add("tap-2fg:2fg", touchpad_1fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); - litest_add("tap-2fg:2fg", touchpad_2fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_SINGLE_TOUCH|LITEST_CLICKPAD); - - litest_add("tap-2fg:2fg", touchpad_2fg_tap_click_apple, LITEST_APPLE_CLICKPAD, LITEST_ANY); - litest_add("tap-2fg:2fg", touchpad_no_2fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); - litest_add("tap-2fg:2fg", touchpad_no_2fg_tap_after_timeout, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); - litest_add("tap-2fg:2fg", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add_ranged("tap-3fg:3fg", touchpad_3fg_tap_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &tap_map_range); - litest_add_ranged("tap-3fg:3fg", touchpad_3fg_tap_btntool_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &tap_map_range); - litest_add_ranged("tap-3fg:3fg", touchpad_3fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &tap_map_range); - litest_add("tap-3fg:3fg", touchpad_3fg_tap_tap_again, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("tap-3fg:3fg", touchpad_3fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("tap-3fg:3fg", touchpad_3fg_tap_hover_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("tap-3fg:3fg", touchpad_3fg_tap_pressure_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add_for_device("tap-3fg:3fg", touchpad_3fg_tap_btntool_pointerjump, LITEST_SYNAPTICS_TOPBUTTONPAD); - litest_add("tap-4fg:4fg", touchpad_4fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); - litest_add("tap-4fg:4fg", touchpad_4fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); - litest_add("tap-5fg:5fg", touchpad_5fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); - litest_add("tap-5fg:5fg", touchpad_5fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); - - /* Real buttons don't interfere with tapping, so don't run those for - pads with buttons */ - litest_add("tap-1fg:1fg", touchpad_1fg_double_tap_click, LITEST_CLICKPAD, LITEST_ANY); - litest_add("tap-1fg:1fg", touchpad_1fg_tap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY); - litest_add_ranged("tap-multitap:1fg", touchpad_1fg_multitap_n_drag_tap_click, LITEST_CLICKPAD, LITEST_ANY, &multitap_range); - litest_add("tap-1fg:1fg", touchpad_1fg_tap_n_drag_draglock_tap_click, LITEST_CLICKPAD, LITEST_ANY); - - litest_add("tap:config", touchpad_tap_default_disabled, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_ANY); - litest_add("tap:config", touchpad_tap_default_enabled, LITEST_TOUCHPAD, LITEST_BUTTON); - litest_add("tap:config", touchpad_tap_invalid, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:config", touchpad_tap_is_available, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:config", touchpad_tap_is_not_available, LITEST_ANY, LITEST_TOUCHPAD); - - litest_add("tap:config", touchpad_tap_default_map, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:config", touchpad_tap_map_unsupported, LITEST_ANY, LITEST_TOUCHPAD); - litest_add("tap:config", touchpad_tap_set_map, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:config", touchpad_tap_set_map_no_tapping, LITEST_ANY, LITEST_TOUCHPAD); - litest_add("tap:config", touchpad_tap_get_map_no_tapping, LITEST_ANY, LITEST_TOUCHPAD); - litest_add("tap:config", touchpad_tap_map_delayed, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); - - litest_add("tap-1fg:1fg", clickpad_1fg_tap_click, LITEST_CLICKPAD, LITEST_ANY); - litest_add("tap-2fg:2fg", clickpad_2fg_tap_click, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD); - - litest_add("tap:draglock", touchpad_drag_lock_default_disabled, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:draglock", touchpad_drag_lock_default_unavailable, LITEST_ANY, LITEST_TOUCHPAD); - - litest_add("tap:drag", touchpad_drag_default_disabled, LITEST_ANY, LITEST_TOUCHPAD); - litest_add("tap:drag", touchpad_drag_default_enabled, LITEST_TOUCHPAD, LITEST_BUTTON); - litest_add("tap:drag", touchpad_drag_config_invalid, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:drag", touchpad_drag_config_unsupported, LITEST_ANY, LITEST_TOUCHPAD); - litest_add("tap:drag", touchpad_drag_config_enabledisable, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:drag", touchpad_drag_disabled, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:drag", touchpad_drag_disabled_immediate, LITEST_TOUCHPAD, LITEST_ANY); - litest_add_ranged("tap-multitap:drag", touchpad_drag_disabled_multitap_no_drag, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); - - litest_add("tap:palm", touchpad_tap_palm_on_idle, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:palm", touchpad_tap_palm_on_touch, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:palm", touchpad_tap_palm_on_touch_hold_timeout, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:palm", touchpad_tap_palm_on_touch_hold_move, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:palm", touchpad_tap_palm_on_tapped, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:palm", touchpad_tap_palm_on_tapped_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); - litest_add("tap:palm", touchpad_tap_palm_on_drag, LITEST_TOUCHPAD, LITEST_ANY); - litest_add_ranged("tap:palm", touchpad_tap_palm_on_drag_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &range_2fg); - litest_add_ranged("tap:palm", touchpad_tap_palm_on_touch_2, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &range_2fg); - litest_add_ranged("tap:palm", touchpad_tap_palm_on_touch_2_retouch, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &range_2fg); - litest_add_ranged("tap:palm", touchpad_tap_palm_on_touch_3, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &range_3fg); - litest_add_ranged("tap:palm", touchpad_tap_palm_on_touch_3_retouch, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &range_3fg); - litest_add_ranged("tap:palm", touchpad_tap_palm_on_touch_4, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &range_4fg); - litest_add("tap:palm", touchpad_tap_palm_after_tap, LITEST_TOUCHPAD, LITEST_ANY); - litest_add_ranged("tap:palm", touchpad_tap_palm_multitap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); - litest_add_ranged("tap:palm", touchpad_tap_palm_multitap_timeout, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); - litest_add_ranged("tap:palm", touchpad_tap_palm_multitap_down_again, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &multitap_range); - litest_add_ranged("tap:palm", touchpad_tap_palm_multitap_click, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); - litest_add("tap:palm", touchpad_tap_palm_click_then_tap, LITEST_TOUCHPAD, LITEST_ANY); - litest_add("tap:palm", touchpad_tap_palm_dwt_tap, LITEST_TOUCHPAD, LITEST_ANY); -} diff -Nru libinput-1.10.3/test/test-trackball.c libinput-0.21.0/test/test-trackball.c --- libinput-1.10.3/test/test-trackball.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-trackball.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,273 +0,0 @@ -/* - * Copyright © 2016 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include -#include -#include -#include - -#include "libinput-util.h" -#include "litest.h" - -START_TEST(trackball_rotation_config_defaults) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - int angle; - - ck_assert(libinput_device_config_rotation_is_available(device)); - - angle = libinput_device_config_rotation_get_angle(device); - ck_assert_int_eq(angle, 0); - angle = libinput_device_config_rotation_get_default_angle(device); - ck_assert_int_eq(angle, 0); -} -END_TEST - -START_TEST(trackball_rotation_config_invalid_range) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - - status = libinput_device_config_rotation_set_angle(device, 360); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); - status = libinput_device_config_rotation_set_angle(device, 361); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); - status = libinput_device_config_rotation_set_angle(device, -1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); -} -END_TEST - -START_TEST(trackball_rotation_config_no_rotation) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - int angle; - - ck_assert(!libinput_device_config_rotation_is_available(device)); - - angle = libinput_device_config_rotation_get_angle(device); - ck_assert_int_eq(angle, 0); - angle = libinput_device_config_rotation_get_default_angle(device); - ck_assert_int_eq(angle, 0); - - /* 0 always succeeds */ - status = libinput_device_config_rotation_set_angle(device, 0); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - for (angle = 1; angle < 360; angle++) { - if (angle % 90 == 0) - continue; - status = libinput_device_config_rotation_set_angle(device, - angle); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); - } -} -END_TEST - -START_TEST(trackball_rotation_config_right_angle) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - int angle; - - ck_assert(libinput_device_config_rotation_is_available(device)); - - for (angle = 0; angle < 360; angle += 90) { - status = libinput_device_config_rotation_set_angle(device, - angle); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - } -} -END_TEST - -START_TEST(trackball_rotation_config_odd_angle) -{ - struct litest_device *dev = litest_current_device(); - struct libinput_device *device = dev->libinput_device; - enum libinput_config_status status; - int angle; - - ck_assert(libinput_device_config_rotation_is_available(device)); - - for (angle = 0; angle < 360; angle++) { - if (angle % 90 == 0) - continue; - status = libinput_device_config_rotation_set_angle(device, - angle); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); - } -} -END_TEST - -START_TEST(trackball_rotation_x) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device = dev->libinput_device; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - int angle; - double dx, dy; - - litest_drain_events(li); - - for (angle = 0; angle < 360; angle++) { - libinput_device_config_rotation_set_angle(device, angle); - - litest_event(dev, EV_REL, REL_X, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - ptrev = litest_is_motion_event(event); - - /* Test unaccelerated because pointer accel may mangle the - other coords */ - dx = libinput_event_pointer_get_dx_unaccelerated(ptrev); - dy = libinput_event_pointer_get_dy_unaccelerated(ptrev); - - switch (angle) { - case 0: - ck_assert_double_eq(dx, 1.0); - ck_assert_double_eq(dy, 0.0); - break; - case 90: - ck_assert_double_eq(dx, 0.0); - ck_assert_double_eq(dy, 1.0); - break; - case 180: - ck_assert_double_eq(dx, -1.0); - ck_assert_double_eq(dy, 0.0); - break; - case 270: - ck_assert_double_eq(dx, 0.0); - ck_assert_double_eq(dy, -1.0); - break; - } - libinput_event_destroy(event); - } -} -END_TEST - -START_TEST(trackball_rotation_y) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device = dev->libinput_device; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - int angle; - double dx, dy; - - litest_drain_events(li); - - for (angle = 0; angle < 360; angle++) { - libinput_device_config_rotation_set_angle(device, angle); - - litest_event(dev, EV_REL, REL_Y, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - ptrev = litest_is_motion_event(event); - - /* Test unaccelerated because pointer accel may mangle the - other coords */ - dx = libinput_event_pointer_get_dx_unaccelerated(ptrev); - dy = libinput_event_pointer_get_dy_unaccelerated(ptrev); - - switch (angle) { - case 0: - ck_assert_double_eq(dx, 0.0); - ck_assert_double_eq(dy, 1.0); - break; - case 90: - ck_assert_double_eq(dx, -1.0); - ck_assert_double_eq(dy, 0.0); - break; - case 180: - ck_assert_double_eq(dx, 0.0); - ck_assert_double_eq(dy, -1.0); - break; - case 270: - ck_assert_double_eq(dx, 1.0); - ck_assert_double_eq(dy, 0.0); - break; - } - libinput_event_destroy(event); - } -} -END_TEST - -START_TEST(trackball_rotation_accel) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_device *device = dev->libinput_device; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - double dx, dy; - - litest_drain_events(li); - - /* Pointer accel mangles the coordinates, so we only test one angle - * and rely on the unaccelerated tests above to warn us when - * something's off */ - libinput_device_config_rotation_set_angle(device, 90); - - litest_event(dev, EV_REL, REL_Y, 1); - litest_event(dev, EV_REL, REL_X, 1); - litest_event(dev, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - ptrev = litest_is_motion_event(event); - - dx = libinput_event_pointer_get_dx(ptrev); - dy = libinput_event_pointer_get_dy(ptrev); - - ck_assert_double_lt(dx, 0.0); - ck_assert_double_gt(dy, 0.0); - libinput_event_destroy(event); -} -END_TEST - -void -litest_setup_tests_trackball(void) -{ - litest_add("trackball:rotation", trackball_rotation_config_defaults, LITEST_TRACKBALL, LITEST_ANY); - litest_add("trackball:rotation", trackball_rotation_config_invalid_range, LITEST_TRACKBALL, LITEST_ANY); - litest_add("trackball:rotation", trackball_rotation_config_no_rotation, LITEST_ANY, LITEST_TRACKBALL); - litest_add("trackball:rotation", trackball_rotation_config_right_angle, LITEST_TRACKBALL, LITEST_ANY); - litest_add("trackball:rotation", trackball_rotation_config_odd_angle, LITEST_TRACKBALL, LITEST_ANY); - litest_add("trackball:rotation", trackball_rotation_x, LITEST_TRACKBALL, LITEST_ANY); - litest_add("trackball:rotation", trackball_rotation_y, LITEST_TRACKBALL, LITEST_ANY); - litest_add("trackball:rotation", trackball_rotation_accel, LITEST_TRACKBALL, LITEST_ANY); -} diff -Nru libinput-1.10.3/test/test-trackpoint.c libinput-0.21.0/test/test-trackpoint.c --- libinput-1.10.3/test/test-trackpoint.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-trackpoint.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,396 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include -#include -#include -#include - -#include "libinput-util.h" -#include "litest.h" - -START_TEST(trackpoint_middlebutton) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - uint64_t ptime, rtime; - - litest_drain_events(li); - - /* A quick middle button click should get reported normally */ - litest_button_click_debounced(dev, li, BTN_MIDDLE, 1); - msleep(2); - litest_button_click_debounced(dev, li, BTN_MIDDLE, 0); - - litest_wait_for_event(li); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - ptime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - - event = libinput_get_event(li); - ptrev = litest_is_button_event(event, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - rtime = libinput_event_pointer_get_time(ptrev); - libinput_event_destroy(event); - - ck_assert_int_lt(ptime, rtime); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(trackpoint_scroll) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - - litest_drain_events(li); - - litest_button_scroll(dev, BTN_MIDDLE, 1, 6); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 6); - litest_button_scroll(dev, BTN_MIDDLE, 1, -7); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -7); - litest_button_scroll(dev, BTN_MIDDLE, 8, 1); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 8); - litest_button_scroll(dev, BTN_MIDDLE, -9, 1); - litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -9); - - /* scroll smaller than the threshold should not generate axis events */ - litest_button_scroll(dev, BTN_MIDDLE, 1, 1); - - litest_button_scroll(dev, BTN_MIDDLE, 0, 0); - litest_assert_button_event(li, BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_PRESSED); - litest_assert_button_event(li, - BTN_MIDDLE, - LIBINPUT_BUTTON_STATE_RELEASED); - - litest_assert_empty_queue(li); -} -END_TEST - -START_TEST(trackpoint_middlebutton_noscroll) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - - /* Disable middle button scrolling */ - libinput_device_config_scroll_set_method(dev->libinput_device, - LIBINPUT_CONFIG_SCROLL_NO_SCROLL); - - litest_drain_events(li); - - /* A long middle button click + motion should get reported normally now */ - litest_button_scroll(dev, BTN_MIDDLE, 0, 10); - - litest_assert_button_event(li, BTN_MIDDLE, 1); - - event = libinput_get_event(li); - ck_assert(event != NULL); - ck_assert_int_eq(libinput_event_get_type(event), LIBINPUT_EVENT_POINTER_MOTION); - libinput_event_destroy(event); - - litest_assert_button_event(li, BTN_MIDDLE, 0); - - litest_assert_empty_queue(li); - - /* Restore default scroll behavior */ - libinput_device_config_scroll_set_method(dev->libinput_device, - libinput_device_config_scroll_get_default_method( - dev->libinput_device)); -} -END_TEST - -START_TEST(trackpoint_scroll_source) -{ - struct litest_device *dev = litest_current_device(); - struct libinput *li = dev->libinput; - struct libinput_event *event; - struct libinput_event_pointer *ptrev; - - litest_drain_events(li); - - litest_button_scroll(dev, BTN_MIDDLE, 0, 6); - litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS, -1); - - while ((event = libinput_get_event(li))) { - ptrev = libinput_event_get_pointer_event(event); - - ck_assert_int_eq(libinput_event_pointer_get_axis_source(ptrev), - LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS); - - libinput_event_destroy(event); - } -} -END_TEST - -START_TEST(trackpoint_topsoftbuttons_left_handed_trackpoint) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *trackpoint; - struct libinput *li = touchpad->libinput; - enum libinput_config_status status; - struct libinput_event *event; - struct libinput_device *device; - - trackpoint = litest_add_device(li, LITEST_TRACKPOINT); - litest_drain_events(li); - /* touchpad right-handed, trackpoint left-handed */ - status = libinput_device_config_left_handed_set( - trackpoint->libinput_device, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_touch_down(touchpad, 0, 5, 5); - libinput_dispatch(li); - litest_button_click_debounced(touchpad, li, BTN_LEFT, true); - libinput_dispatch(li); - - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - device = libinput_event_get_device(event); - ck_assert(device == trackpoint->libinput_device); - libinput_event_destroy(event); - - litest_button_click_debounced(touchpad, li, BTN_LEFT, false); - libinput_dispatch(li); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - device = libinput_event_get_device(event); - ck_assert(device == trackpoint->libinput_device); - libinput_event_destroy(event); - - litest_delete_device(trackpoint); -} -END_TEST - -START_TEST(trackpoint_topsoftbuttons_left_handed_touchpad) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *trackpoint; - struct libinput *li = touchpad->libinput; - enum libinput_config_status status; - struct libinput_event *event; - struct libinput_device *device; - - trackpoint = litest_add_device(li, LITEST_TRACKPOINT); - litest_drain_events(li); - /* touchpad left-handed, trackpoint right-handed */ - status = libinput_device_config_left_handed_set( - touchpad->libinput_device, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_touch_down(touchpad, 0, 5, 5); - libinput_dispatch(li); - litest_button_click_debounced(touchpad, li, BTN_LEFT, true); - libinput_dispatch(li); - - event = libinput_get_event(li); - litest_is_button_event(event, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); - device = libinput_event_get_device(event); - ck_assert(device == trackpoint->libinput_device); - libinput_event_destroy(event); - - litest_button_click_debounced(touchpad, li, BTN_LEFT, false); - libinput_dispatch(li); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_LEFT, - LIBINPUT_BUTTON_STATE_RELEASED); - device = libinput_event_get_device(event); - ck_assert(device == trackpoint->libinput_device); - libinput_event_destroy(event); - - litest_delete_device(trackpoint); -} -END_TEST - -START_TEST(trackpoint_topsoftbuttons_left_handed_both) -{ - struct litest_device *touchpad = litest_current_device(); - struct litest_device *trackpoint; - struct libinput *li = touchpad->libinput; - enum libinput_config_status status; - struct libinput_event *event; - struct libinput_device *device; - - trackpoint = litest_add_device(li, LITEST_TRACKPOINT); - litest_drain_events(li); - /* touchpad left-handed, trackpoint left-handed */ - status = libinput_device_config_left_handed_set( - touchpad->libinput_device, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - status = libinput_device_config_left_handed_set( - trackpoint->libinput_device, 1); - ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); - - litest_touch_down(touchpad, 0, 5, 5); - libinput_dispatch(li); - litest_button_click_debounced(touchpad, li, BTN_LEFT, true); - libinput_dispatch(li); - - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_PRESSED); - device = libinput_event_get_device(event); - ck_assert(device == trackpoint->libinput_device); - libinput_event_destroy(event); - - litest_button_click_debounced(touchpad, li, BTN_LEFT, false); - libinput_dispatch(li); - event = libinput_get_event(li); - litest_is_button_event(event, - BTN_RIGHT, - LIBINPUT_BUTTON_STATE_RELEASED); - device = libinput_event_get_device(event); - ck_assert(device == trackpoint->libinput_device); - libinput_event_destroy(event); - - litest_delete_device(trackpoint); -} -END_TEST - -START_TEST(trackpoint_palmdetect) -{ - struct litest_device *trackpoint = litest_current_device(); - struct litest_device *touchpad; - struct libinput *li = trackpoint->libinput; - int i; - - touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C); - litest_drain_events(li); - - for (i = 0; i < 10; i++) { - litest_event(trackpoint, EV_REL, REL_X, 1); - litest_event(trackpoint, EV_REL, REL_Y, 1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 30, 30); - litest_touch_move_to(touchpad, 0, 30, 30, 80, 80, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_empty_queue(li); - - litest_timeout_trackpoint(); - libinput_dispatch(li); - - litest_touch_down(touchpad, 0, 30, 30); - litest_touch_move_to(touchpad, 0, 30, 30, 80, 80, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(touchpad); -} -END_TEST - -START_TEST(trackpoint_palmdetect_resume_touch) -{ - struct litest_device *trackpoint = litest_current_device(); - struct litest_device *touchpad; - struct libinput *li = trackpoint->libinput; - int i; - - touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C); - litest_drain_events(li); - - for (i = 0; i < 10; i++) { - litest_event(trackpoint, EV_REL, REL_X, 1); - litest_event(trackpoint, EV_REL, REL_Y, 1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - } - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 30, 30); - litest_touch_move_to(touchpad, 0, 30, 30, 80, 80, 10, 1); - litest_assert_empty_queue(li); - - litest_timeout_trackpoint(); - libinput_dispatch(li); - - /* touch started after last tp event, expect resume */ - litest_touch_move_to(touchpad, 0, 80, 80, 30, 30, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(touchpad); -} -END_TEST - -START_TEST(trackpoint_palmdetect_require_min_events) -{ - struct litest_device *trackpoint = litest_current_device(); - struct litest_device *touchpad; - struct libinput *li = trackpoint->libinput; - - touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C); - litest_drain_events(li); - - /* A single event does not trigger palm detection */ - litest_event(trackpoint, EV_REL, REL_X, 1); - litest_event(trackpoint, EV_REL, REL_Y, 1); - litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); - libinput_dispatch(li); - litest_drain_events(li); - - litest_touch_down(touchpad, 0, 30, 30); - litest_touch_move_to(touchpad, 0, 30, 30, 80, 80, 10, 1); - litest_touch_up(touchpad, 0); - litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); - - litest_delete_device(touchpad); -} -END_TEST - -void -litest_setup_tests_trackpoint(void) -{ - litest_add("trackpoint:middlebutton", trackpoint_middlebutton, LITEST_POINTINGSTICK, LITEST_ANY); - litest_add("trackpoint:middlebutton", trackpoint_middlebutton_noscroll, LITEST_POINTINGSTICK, LITEST_ANY); - litest_add("trackpoint:scroll", trackpoint_scroll, LITEST_POINTINGSTICK, LITEST_ANY); - litest_add("trackpoint:scroll", trackpoint_scroll_source, LITEST_POINTINGSTICK, LITEST_ANY); - litest_add("trackpoint:left-handed", trackpoint_topsoftbuttons_left_handed_trackpoint, LITEST_TOPBUTTONPAD, LITEST_ANY); - litest_add("trackpoint:left-handed", trackpoint_topsoftbuttons_left_handed_touchpad, LITEST_TOPBUTTONPAD, LITEST_ANY); - litest_add("trackpoint:left-handed", trackpoint_topsoftbuttons_left_handed_both, LITEST_TOPBUTTONPAD, LITEST_ANY); - - litest_add("trackpoint:palmdetect", trackpoint_palmdetect, LITEST_POINTINGSTICK, LITEST_ANY); - litest_add("trackpoint:palmdetect", trackpoint_palmdetect_resume_touch, LITEST_POINTINGSTICK, LITEST_ANY); - litest_add("trackpoint:palmdetect", trackpoint_palmdetect_require_min_events, LITEST_POINTINGSTICK, LITEST_ANY); -} diff -Nru libinput-1.10.3/test/test-udev.c libinput-0.21.0/test/test-udev.c --- libinput-1.10.3/test/test-udev.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/test-udev.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,672 +0,0 @@ -/* - * Copyright © 2013 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "litest.h" - -static int open_restricted(const char *path, int flags, void *data) -{ - int fd; - fd = open(path, flags); - return fd < 0 ? -errno : fd; -} -static void close_restricted(int fd, void *data) -{ - close(fd); -} - -static const struct libinput_interface simple_interface = { - .open_restricted = open_restricted, - .close_restricted = close_restricted, -}; - -START_TEST(udev_create_NULL) -{ - struct libinput *li; - struct udev *udev; - - udev = udev_new(); - - li = libinput_udev_create_context(NULL, NULL, NULL); - ck_assert(li == NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, NULL); - ck_assert(li == NULL); - - li = libinput_udev_create_context(NULL, NULL, udev); - ck_assert(li == NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, NULL), -1); - - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -START_TEST(udev_create_seat0) -{ - struct libinput *li; - struct libinput_event *event; - struct udev *udev; - int fd; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); - - fd = libinput_get_fd(li); - ck_assert_int_ge(fd, 0); - - /* expect at least one event */ - libinput_dispatch(li); - event = libinput_get_event(li); - ck_assert(event != NULL); - - libinput_event_destroy(event); - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -START_TEST(udev_create_empty_seat) -{ - struct libinput *li; - struct libinput_event *event; - struct udev *udev; - int fd; - - udev = udev_new(); - ck_assert(udev != NULL); - - /* expect a libinput reference, but no events */ - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, "seatdoesntexist"), 0); - - fd = libinput_get_fd(li); - ck_assert_int_ge(fd, 0); - - libinput_dispatch(li); - event = libinput_get_event(li); - ck_assert(event == NULL); - - libinput_event_destroy(event); - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -START_TEST(udev_set_user_data) -{ - struct libinput *li; - struct udev *udev; - int data1, data2; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, &data1, udev); - ck_assert(li != NULL); - ck_assert(libinput_get_user_data(li) == &data1); - libinput_set_user_data(li, &data2); - ck_assert(libinput_get_user_data(li) == &data2); - - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -/** - * This test only works if there's at least one device in the system that is - * assigned the default seat. Should cover the 99% case. - */ -START_TEST(udev_added_seat_default) -{ - struct libinput *li; - struct libinput_event *event; - struct udev *udev; - struct libinput_device *device; - struct libinput_seat *seat; - const char *seat_name; - enum libinput_event_type type; - int default_seat_found = 0; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); - libinput_dispatch(li); - - while (!default_seat_found && (event = libinput_get_event(li))) { - type = libinput_event_get_type(event); - if (type != LIBINPUT_EVENT_DEVICE_ADDED) { - libinput_event_destroy(event); - continue; - } - - device = libinput_event_get_device(event); - seat = libinput_device_get_seat(device); - ck_assert(seat != NULL); - - seat_name = libinput_seat_get_logical_name(seat); - default_seat_found = streq(seat_name, "default"); - libinput_event_destroy(event); - } - - ck_assert(default_seat_found); - - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -/** - * This test only works if there's at least one device in the system that is - * assigned the default seat. Should cover the 99% case. - */ -START_TEST(udev_change_seat) -{ - struct libinput *li; - struct udev *udev; - struct libinput_event *event; - struct libinput_device *device; - struct libinput_seat *seat1, *seat2; - const char *seat1_name; - const char *seat2_name = "new seat"; - int rc; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - ck_assert(event != NULL); - - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_DEVICE_ADDED); - - device = libinput_event_get_device(event); - libinput_device_ref(device); - - seat1 = libinput_device_get_seat(device); - libinput_seat_ref(seat1); - - seat1_name = libinput_seat_get_logical_name(seat1); - libinput_event_destroy(event); - - litest_drain_events(li); - - rc = libinput_device_set_seat_logical_name(device, - seat2_name); - ck_assert_int_eq(rc, 0); - - libinput_dispatch(li); - - event = libinput_get_event(li); - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_DEVICE_REMOVED); - - ck_assert(libinput_event_get_device(event) == device); - libinput_event_destroy(event); - - event = libinput_get_event(li); - ck_assert_int_eq(libinput_event_get_type(event), - LIBINPUT_EVENT_DEVICE_ADDED); - ck_assert(libinput_event_get_device(event) != device); - libinput_device_unref(device); - - device = libinput_event_get_device(event); - seat2 = libinput_device_get_seat(device); - - ck_assert_str_ne(libinput_seat_get_logical_name(seat2), - seat1_name); - ck_assert_str_eq(libinput_seat_get_logical_name(seat2), - seat2_name); - libinput_event_destroy(event); - - libinput_seat_unref(seat1); - - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -START_TEST(udev_double_suspend) -{ - struct libinput *li; - struct libinput_event *event; - struct udev *udev; - int fd; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); - - fd = libinput_get_fd(li); - ck_assert_int_ge(fd, 0); - - /* expect at least one event */ - ck_assert_int_ge(libinput_dispatch(li), 0); - event = libinput_get_event(li); - ck_assert(event != NULL); - - libinput_suspend(li); - libinput_suspend(li); - libinput_resume(li); - - libinput_event_destroy(event); - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -START_TEST(udev_double_resume) -{ - struct libinput *li; - struct libinput_event *event; - struct udev *udev; - int fd; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); - - fd = libinput_get_fd(li); - ck_assert_int_ge(fd, 0); - - /* expect at least one event */ - ck_assert_int_ge(libinput_dispatch(li), 0); - event = libinput_get_event(li); - ck_assert(event != NULL); - - libinput_suspend(li); - libinput_resume(li); - libinput_resume(li); - - libinput_event_destroy(event); - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -static void -process_events_count_devices(struct libinput *li, int *device_count) -{ - struct libinput_event *event; - - while ((event = libinput_get_event(li))) { - switch (libinput_event_get_type(event)) { - case LIBINPUT_EVENT_DEVICE_ADDED: - (*device_count)++; - break; - case LIBINPUT_EVENT_DEVICE_REMOVED: - (*device_count)--; - break; - default: - break; - } - libinput_event_destroy(event); - } -} - -START_TEST(udev_suspend_resume) -{ - struct libinput *li; - struct udev *udev; - int fd; - int num_devices = 0; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); - - fd = libinput_get_fd(li); - ck_assert_int_ge(fd, 0); - - /* Check that at least one device was discovered after creation. */ - ck_assert_int_ge(libinput_dispatch(li), 0); - process_events_count_devices(li, &num_devices); - ck_assert_int_gt(num_devices, 0); - - /* Check that after a suspend, no devices are left. */ - libinput_suspend(li); - ck_assert_int_ge(libinput_dispatch(li), 0); - process_events_count_devices(li, &num_devices); - ck_assert_int_eq(num_devices, 0); - - /* Check that after a resume, at least one device is discovered. */ - libinput_resume(li); - ck_assert_int_ge(libinput_dispatch(li), 0); - process_events_count_devices(li, &num_devices); - ck_assert_int_gt(num_devices, 0); - - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -START_TEST(udev_resume_before_seat) -{ - struct libinput *li; - struct udev *udev; - int rc; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - - rc = libinput_resume(li); - ck_assert_int_eq(rc, 0); - - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -START_TEST(udev_suspend_resume_before_seat) -{ - struct libinput *li; - struct udev *udev; - int rc; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - - libinput_suspend(li); - rc = libinput_resume(li); - ck_assert_int_eq(rc, 0); - - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -START_TEST(udev_device_sysname) -{ - struct libinput *li; - struct libinput_event *ev; - struct libinput_device *device; - const char *sysname; - struct udev *udev; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); - - libinput_dispatch(li); - - while ((ev = libinput_get_event(li))) { - if (libinput_event_get_type(ev) != - LIBINPUT_EVENT_DEVICE_ADDED) { - libinput_event_destroy(ev); - continue; - } - - device = libinput_event_get_device(ev); - sysname = libinput_device_get_sysname(device); - ck_assert(sysname != NULL && strlen(sysname) > 1); - ck_assert(strchr(sysname, '/') == NULL); - ck_assert_int_eq(strncmp(sysname, "event", 5), 0); - libinput_event_destroy(ev); - } - - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -START_TEST(udev_seat_recycle) -{ - struct udev *udev; - struct libinput *li; - struct libinput_event *ev; - struct libinput_device *device; - struct libinput_seat *saved_seat = NULL; - struct libinput_seat *seat; - int data = 0; - int found = 0; - void *user_data; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); - - libinput_dispatch(li); - while ((ev = libinput_get_event(li))) { - switch (libinput_event_get_type(ev)) { - case LIBINPUT_EVENT_DEVICE_ADDED: - if (saved_seat) - break; - - device = libinput_event_get_device(ev); - ck_assert(device != NULL); - saved_seat = libinput_device_get_seat(device); - libinput_seat_set_user_data(saved_seat, &data); - libinput_seat_ref(saved_seat); - break; - default: - break; - } - - libinput_event_destroy(ev); - } - - ck_assert(saved_seat != NULL); - - libinput_suspend(li); - - litest_drain_events(li); - - libinput_resume(li); - - libinput_dispatch(li); - while ((ev = libinput_get_event(li))) { - switch (libinput_event_get_type(ev)) { - case LIBINPUT_EVENT_DEVICE_ADDED: - device = libinput_event_get_device(ev); - ck_assert(device != NULL); - - seat = libinput_device_get_seat(device); - user_data = libinput_seat_get_user_data(seat); - if (user_data == &data) { - found = 1; - ck_assert(seat == saved_seat); - } - break; - default: - break; - } - - libinput_event_destroy(ev); - } - - ck_assert(found == 1); - - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -START_TEST(udev_path_add_device) -{ - struct udev *udev; - struct libinput *li; - struct libinput_device *device; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); - - litest_set_log_handler_bug(li); - device = libinput_path_add_device(li, "/dev/input/event0"); - ck_assert(device == NULL); - litest_restore_log_handler(li); - - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -START_TEST(udev_path_remove_device) -{ - struct udev *udev; - struct libinput *li; - struct libinput_device *device; - struct libinput_event *event; - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); - libinput_dispatch(li); - - litest_wait_for_event_of_type(li, LIBINPUT_EVENT_DEVICE_ADDED, -1); - event = libinput_get_event(li); - device = libinput_event_get_device(event); - ck_assert(device != NULL); - - /* no effect bug a bug log msg */ - litest_set_log_handler_bug(li); - libinput_path_remove_device(device); - litest_restore_log_handler(li); - - libinput_event_destroy(event); - libinput_unref(li); - udev_unref(udev); -} -END_TEST - -START_TEST(udev_ignore_device) -{ - struct udev *udev; - struct libinput *li; - struct libinput_device *device; - struct libinput_event *event; - struct litest_device *dev; - const char *devname; - - dev = litest_create(LITEST_IGNORED_MOUSE, NULL, NULL, NULL, NULL); - devname = libevdev_get_name(dev->evdev); - - udev = udev_new(); - ck_assert(udev != NULL); - - li = libinput_udev_create_context(&simple_interface, NULL, udev); - ck_assert(li != NULL); - litest_restore_log_handler(li); - - ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); - libinput_dispatch(li); - - event = libinput_get_event(li); - ck_assert(event != NULL); - while (event) { - if (libinput_event_get_type(event) == - LIBINPUT_EVENT_DEVICE_ADDED) { - const char *name; - - device = libinput_event_get_device(event); - name = libinput_device_get_name(device); - ck_assert_str_ne(devname, name); - } - libinput_event_destroy(event); - libinput_dispatch(li); - event = libinput_get_event(li); - } - - libinput_unref(li); - udev_unref(udev); - - litest_delete_device(dev); -} -END_TEST - -void -litest_setup_tests_udev(void) -{ - litest_add_no_device("udev:create", udev_create_NULL); - litest_add_no_device("udev:create", udev_create_seat0); - litest_add_no_device("udev:create", udev_create_empty_seat); - litest_add_no_device("udev:create", udev_set_user_data); - - litest_add_no_device("udev:seat", udev_added_seat_default); - litest_add_no_device("udev:seat", udev_change_seat); - - litest_add_for_device("udev:suspend", udev_double_suspend, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_for_device("udev:suspend", udev_double_resume, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_for_device("udev:suspend", udev_suspend_resume, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_for_device("udev:suspend", udev_resume_before_seat, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_for_device("udev:suspend", udev_suspend_resume_before_seat, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_for_device("udev:device events", udev_device_sysname, LITEST_SYNAPTICS_CLICKPAD_X220); - litest_add_for_device("udev:seat", udev_seat_recycle, LITEST_SYNAPTICS_CLICKPAD_X220); - - litest_add_no_device("udev:path", udev_path_add_device); - litest_add_for_device("udev:path", udev_path_remove_device, LITEST_SYNAPTICS_CLICKPAD_X220); - - litest_add_no_device("udev:ignore", udev_ignore_device); -} diff -Nru libinput-1.10.3/test/touch.c libinput-0.21.0/test/touch.c --- libinput-1.10.3/test/touch.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/touch.c 2015-08-03 03:44:47.000000000 +0000 @@ -0,0 +1,704 @@ +/* + * Copyright © 2013 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include "libinput-util.h" +#include "litest.h" + +START_TEST(touch_frame_events) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + int have_frame_event = 0; + + litest_drain_events(dev->libinput); + + litest_touch_down(dev, 0, 10, 10); + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + if (libinput_event_get_type(event) == LIBINPUT_EVENT_TOUCH_FRAME) + have_frame_event++; + libinput_event_destroy(event); + } + ck_assert_int_eq(have_frame_event, 1); + + litest_touch_down(dev, 1, 10, 10); + libinput_dispatch(li); + + while ((event = libinput_get_event(li))) { + if (libinput_event_get_type(event) == LIBINPUT_EVENT_TOUCH_FRAME) + have_frame_event++; + libinput_event_destroy(event); + } + ck_assert_int_eq(have_frame_event, 2); +} +END_TEST + +START_TEST(touch_abs_transform) +{ + struct litest_device *dev; + struct libinput *libinput; + struct libinput_event *ev; + struct libinput_event_touch *tev; + double fx, fy; + bool tested = false; + + struct input_absinfo abs[] = { + { ABS_X, 0, 32767, 75, 0, 10 }, + { ABS_Y, 0, 32767, 129, 0, 9 }, + { ABS_MT_POSITION_X, 0, 32767, 0, 0, 10 }, + { ABS_MT_POSITION_Y, 0, 32767, 0, 0, 9 }, + { .value = -1 }, + }; + + dev = litest_create_device_with_overrides(LITEST_WACOM_TOUCH, + "litest Highres touch device", + NULL, abs, NULL); + + libinput = dev->libinput; + + litest_touch_down(dev, 0, 100, 100); + + libinput_dispatch(libinput); + + while ((ev = libinput_get_event(libinput))) { + if (libinput_event_get_type(ev) != LIBINPUT_EVENT_TOUCH_DOWN) { + libinput_event_destroy(ev); + continue; + } + + tev = libinput_event_get_touch_event(ev); + fx = libinput_event_touch_get_x_transformed(tev, 1920); + ck_assert_int_eq(fx, 1919.0); + fy = libinput_event_touch_get_y_transformed(tev, 720); + ck_assert_int_eq(fy, 719.0); + + tested = true; + + libinput_event_destroy(ev); + } + + ck_assert(tested); + + litest_delete_device(dev); +} +END_TEST + +START_TEST(touch_many_slots) +{ + struct libinput *libinput; + struct litest_device *dev; + struct libinput_event *ev; + int slot; + const int num_tps = 100; + int slot_count = 0; + enum libinput_event_type type; + + struct input_absinfo abs[] = { + { ABS_MT_SLOT, 0, num_tps - 1, 0, 0, 0 }, + { .value = -1 }, + }; + + dev = litest_create_device_with_overrides(LITEST_WACOM_TOUCH, + "litest Multi-touch device", + NULL, abs, NULL); + libinput = dev->libinput; + + for (slot = 0; slot < num_tps; ++slot) + litest_touch_down(dev, slot, 0, 0); + for (slot = 0; slot < num_tps; ++slot) + litest_touch_up(dev, slot); + + libinput_dispatch(libinput); + while ((ev = libinput_get_event(libinput))) { + type = libinput_event_get_type(ev); + + if (type == LIBINPUT_EVENT_TOUCH_DOWN) + slot_count++; + else if (type == LIBINPUT_EVENT_TOUCH_UP) + break; + + libinput_event_destroy(ev); + libinput_dispatch(libinput); + } + + ck_assert_notnull(ev); + ck_assert_int_gt(slot_count, 0); + + libinput_dispatch(libinput); + do { + type = libinput_event_get_type(ev); + ck_assert_int_ne(type, LIBINPUT_EVENT_TOUCH_DOWN); + if (type == LIBINPUT_EVENT_TOUCH_UP) + slot_count--; + + libinput_event_destroy(ev); + libinput_dispatch(libinput); + } while ((ev = libinput_get_event(libinput))); + + ck_assert_int_eq(slot_count, 0); + + litest_delete_device(dev); +} +END_TEST + +START_TEST(touch_double_touch_down_up) +{ + struct libinput *libinput; + struct litest_device *dev; + struct libinput_event *ev; + bool got_down = false; + bool got_up = false; + + dev = litest_current_device(); + libinput = dev->libinput; + + /* note: this test is a false negative, libevdev will filter + * tracking IDs re-used in the same slot. */ + + litest_touch_down(dev, 0, 0, 0); + litest_touch_down(dev, 0, 0, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 0); + + libinput_dispatch(libinput); + + while ((ev = libinput_get_event(libinput))) { + switch (libinput_event_get_type(ev)) { + case LIBINPUT_EVENT_TOUCH_DOWN: + ck_assert(!got_down); + got_down = true; + break; + case LIBINPUT_EVENT_TOUCH_UP: + ck_assert(got_down); + ck_assert(!got_up); + got_up = true; + break; + default: + break; + } + + libinput_event_destroy(ev); + libinput_dispatch(libinput); + } + + ck_assert(got_down); + ck_assert(got_up); +} +END_TEST + +START_TEST(touch_calibration_scale) +{ + struct libinput *li; + struct litest_device *dev; + struct libinput_event *ev; + struct libinput_event_touch *tev; + float matrix[6] = { + 1, 0, 0, + 0, 1, 0 + }; + + float calibration; + double x, y; + const int width = 640, height = 480; + + dev = litest_current_device(); + li = dev->libinput; + + for (calibration = 0.1; calibration < 1; calibration += 0.1) { + libinput_device_config_calibration_set_matrix(dev->libinput_device, + matrix); + litest_drain_events(li); + + litest_touch_down(dev, 0, 100, 100); + litest_touch_up(dev, 0); + + litest_wait_for_event(li); + ev = libinput_get_event(li); + tev = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); + + x = libinput_event_touch_get_x_transformed(tev, width); + y = libinput_event_touch_get_y_transformed(tev, height); + + ck_assert_int_eq(round(x), round(width * matrix[0])); + ck_assert_int_eq(round(y), round(height * matrix[4])); + + libinput_event_destroy(ev); + litest_drain_events(li); + + matrix[0] = calibration; + matrix[4] = 1 - calibration; + } +} +END_TEST + +START_TEST(touch_calibration_rotation) +{ + struct libinput *li; + struct litest_device *dev; + struct libinput_event *ev; + struct libinput_event_touch *tev; + float matrix[6]; + int i; + double x, y; + int width = 1024, height = 480; + + dev = litest_current_device(); + li = dev->libinput; + + for (i = 0; i < 4; i++) { + float angle = i * M_PI/2; + + /* [ cos -sin tx ] + [ sin cos ty ] + [ 0 0 1 ] */ + matrix[0] = cos(angle); + matrix[1] = -sin(angle); + matrix[3] = sin(angle); + matrix[4] = cos(angle); + + switch(i) { + case 0: /* 0 deg */ + matrix[2] = 0; + matrix[5] = 0; + break; + case 1: /* 90 deg cw */ + matrix[2] = 1; + matrix[5] = 0; + break; + case 2: /* 180 deg cw */ + matrix[2] = 1; + matrix[5] = 1; + break; + case 3: /* 270 deg cw */ + matrix[2] = 0; + matrix[5] = 1; + break; + } + + libinput_device_config_calibration_set_matrix(dev->libinput_device, + matrix); + litest_drain_events(li); + + litest_touch_down(dev, 0, 80, 20); + litest_touch_up(dev, 0); + litest_wait_for_event(li); + ev = libinput_get_event(li); + tev = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); + + x = libinput_event_touch_get_x_transformed(tev, width); + y = libinput_event_touch_get_y_transformed(tev, height); + + /* rounding errors... */ +#define almost_equal(a_, b_) \ + { ck_assert_int_ge((a_) + 0.5, (b_) - 1); \ + ck_assert_int_le((a_) + 0.5, (b_) + 1); } + switch(i) { + case 0: /* 0 deg */ + almost_equal(x, width * 0.8); + almost_equal(y, height * 0.2); + break; + case 1: /* 90 deg cw */ + almost_equal(x, width * 0.8); + almost_equal(y, height * 0.8); + break; + case 2: /* 180 deg cw */ + almost_equal(x, width * 0.2); + almost_equal(y, height * 0.8); + break; + case 3: /* 270 deg cw */ + almost_equal(x, width * 0.2); + almost_equal(y, height * 0.2); + break; + } +#undef almost_equal + + libinput_event_destroy(ev); + litest_drain_events(li); + } +} +END_TEST + +START_TEST(touch_calibration_translation) +{ + struct libinput *li; + struct litest_device *dev; + struct libinput_event *ev; + struct libinput_event_touch *tev; + float matrix[6] = { + 1, 0, 0, + 0, 1, 0 + }; + + float translate; + double x, y; + const int width = 640, height = 480; + + dev = litest_current_device(); + li = dev->libinput; + + /* translating from 0 up to 1 device width/height */ + for (translate = 0.1; translate <= 1; translate += 0.1) { + libinput_device_config_calibration_set_matrix(dev->libinput_device, + matrix); + litest_drain_events(li); + + litest_touch_down(dev, 0, 100, 100); + litest_touch_up(dev, 0); + + litest_wait_for_event(li); + ev = libinput_get_event(li); + tev = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); + + x = libinput_event_touch_get_x_transformed(tev, width); + y = libinput_event_touch_get_y_transformed(tev, height); + + /* sigh. rounding errors */ + ck_assert_int_ge(round(x), width + round(width * matrix[2]) - 1); + ck_assert_int_ge(round(y), height + round(height * matrix[5]) - 1); + ck_assert_int_le(round(x), width + round(width * matrix[2]) + 1); + ck_assert_int_le(round(y), height + round(height * matrix[5]) + 1); + + libinput_event_destroy(ev); + litest_drain_events(li); + + matrix[2] = translate; + matrix[5] = 1 - translate; + } +} +END_TEST + +START_TEST(touch_no_left_handed) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + enum libinput_config_status status; + int rc; + + rc = libinput_device_config_left_handed_is_available(d); + ck_assert_int_eq(rc, 0); + + rc = libinput_device_config_left_handed_get(d); + ck_assert_int_eq(rc, 0); + + rc = libinput_device_config_left_handed_get_default(d); + ck_assert_int_eq(rc, 0); + + status = libinput_device_config_left_handed_set(d, 0); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); +} +END_TEST + +START_TEST(fake_mt_exists) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_device *device; + + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_DEVICE_ADDED, -1); + event = libinput_get_event(li); + device = libinput_event_get_device(event); + + ck_assert(!libinput_device_has_capability(device, + LIBINPUT_DEVICE_CAP_TOUCH)); + + /* This test may need fixing if we add other fake-mt devices that + * have different capabilities */ + ck_assert(libinput_device_has_capability(device, + LIBINPUT_DEVICE_CAP_POINTER)); + + libinput_event_destroy(event); +} +END_TEST + +START_TEST(fake_mt_no_touch_events) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 70, 70, 5, 10); + litest_touch_up(dev, 0); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 70); + litest_touch_move_to(dev, 0, 50, 50, 90, 40, 10, 10); + litest_touch_move_to(dev, 0, 70, 70, 40, 50, 10, 10); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_only_typed_events(li, + LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE); +} +END_TEST + +START_TEST(touch_protocol_a_init) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_device *device = dev->libinput_device; + + ck_assert_int_ne(libinput_next_event_type(li), + LIBINPUT_EVENT_NONE); + + ck_assert(libinput_device_has_capability(device, + LIBINPUT_DEVICE_CAP_TOUCH)); +} +END_TEST + +START_TEST(touch_protocol_a_touch) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *ev; + struct libinput_event_touch *tev; + double x, y, oldx, oldy; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 5, 95); + + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TOUCH_DOWN, -1); + + ev = libinput_get_event(li); + tev = litest_is_touch_event(ev, LIBINPUT_EVENT_TOUCH_DOWN); + + oldx = libinput_event_touch_get_x(tev); + oldy = libinput_event_touch_get_y(tev); + + libinput_event_destroy(ev); + + litest_touch_move_to(dev, 0, 10, 90, 90, 10, 20, 1); + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TOUCH_MOTION, -1); + + while ((ev = libinput_get_event(li))) { + if (libinput_event_get_type(ev) == + LIBINPUT_EVENT_TOUCH_FRAME) { + libinput_event_destroy(ev); + continue; + } + ck_assert_int_eq(libinput_event_get_type(ev), + LIBINPUT_EVENT_TOUCH_MOTION); + + tev = libinput_event_get_touch_event(ev); + x = libinput_event_touch_get_x(tev); + y = libinput_event_touch_get_y(tev); + + ck_assert_int_gt(x, oldx); + ck_assert_int_lt(y, oldy); + + oldx = x; + oldy = y; + + libinput_event_destroy(ev); + } + + litest_touch_up(dev, 0); + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TOUCH_UP, -1); +} +END_TEST + +START_TEST(touch_protocol_a_2fg_touch) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *ev; + struct libinput_event_touch *tev; + int pos; + + litest_drain_events(li); + + litest_push_event_frame(dev); + litest_touch_down(dev, 0, 5, 95); + litest_touch_down(dev, 0, 95, 5); + litest_pop_event_frame(dev); + + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TOUCH_DOWN, -1); + + ev = libinput_get_event(li); + libinput_event_destroy(ev); + + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TOUCH_DOWN, -1); + + ev = libinput_get_event(li); + libinput_event_destroy(ev); + + for (pos = 10; pos < 100; pos += 10) { + litest_push_event_frame(dev); + litest_touch_move_to(dev, 0, pos, 100 - pos, pos, 100 - pos, 1, 1); + litest_touch_move_to(dev, 0, 100 - pos, pos, 100 - pos, pos, 1, 1); + litest_pop_event_frame(dev); + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TOUCH_MOTION, -1); + ev = libinput_get_event(li); + tev = libinput_event_get_touch_event(ev); + ck_assert_int_eq(libinput_event_touch_get_slot(tev), + 0); + libinput_event_destroy(ev); + + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TOUCH_MOTION, -1); + ev = libinput_get_event(li); + tev = libinput_event_get_touch_event(ev); + ck_assert_int_eq(libinput_event_touch_get_slot(tev), + 1); + libinput_event_destroy(ev); + } + + litest_event(dev, EV_SYN, SYN_MT_REPORT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TOUCH_UP, -1); + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_TOUCH_UP, -1); +} +END_TEST + +START_TEST(touch_initial_state) +{ + struct litest_device *dev; + struct libinput *libinput1, *libinput2; + struct libinput_event *ev1 = NULL; + struct libinput_event *ev2 = NULL; + struct libinput_event_touch *t1, *t2; + struct libinput_device *device1, *device2; + int axis = _i; /* looped test */ + + dev = litest_current_device(); + device1 = dev->libinput_device; + libinput_device_config_tap_set_enabled(device1, + LIBINPUT_CONFIG_TAP_DISABLED); + + libinput1 = dev->libinput; + litest_touch_down(dev, 0, 40, 60); + litest_touch_up(dev, 0); + + /* device is now on some x/y value */ + litest_drain_events(libinput1); + + libinput2 = litest_create_context(); + device2 = libinput_path_add_device(libinput2, + libevdev_uinput_get_devnode( + dev->uinput)); + libinput_device_config_tap_set_enabled(device2, + LIBINPUT_CONFIG_TAP_DISABLED); + litest_drain_events(libinput2); + + if (axis == ABS_X) + litest_touch_down(dev, 0, 40, 70); + else + litest_touch_down(dev, 0, 70, 60); + litest_touch_up(dev, 0); + + litest_wait_for_event(libinput1); + litest_wait_for_event(libinput2); + + while (libinput_next_event_type(libinput1)) { + ev1 = libinput_get_event(libinput1); + ev2 = libinput_get_event(libinput2); + + t1 = litest_is_touch_event(ev1, 0); + t2 = litest_is_touch_event(ev2, 0); + + ck_assert_int_eq(libinput_event_get_type(ev1), + libinput_event_get_type(ev2)); + + if (libinput_event_get_type(ev1) == LIBINPUT_EVENT_TOUCH_UP || + libinput_event_get_type(ev1) == LIBINPUT_EVENT_TOUCH_FRAME) + break; + + ck_assert_int_eq(libinput_event_touch_get_x(t1), + libinput_event_touch_get_x(t2)); + ck_assert_int_eq(libinput_event_touch_get_y(t1), + libinput_event_touch_get_y(t2)); + + libinput_event_destroy(ev1); + libinput_event_destroy(ev2); + } + + libinput_event_destroy(ev1); + libinput_event_destroy(ev2); + + libinput_unref(libinput2); +} +END_TEST + +START_TEST(touch_time_usec) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_touch *tev; + + litest_drain_events(dev->libinput); + + litest_touch_down(dev, 0, 10, 10); + + litest_wait_for_event(li); + + event = libinput_get_event(li); + tev = litest_is_touch_event(event, LIBINPUT_EVENT_TOUCH_DOWN); + ck_assert_int_eq(libinput_event_touch_get_time(tev), + libinput_event_touch_get_time_usec(tev) / 1000); + libinput_event_destroy(event); +} +END_TEST + +void +litest_setup_tests(void) +{ + struct range axes = { ABS_X, ABS_Y + 1}; + + litest_add("touch:frame", touch_frame_events, LITEST_TOUCH, LITEST_ANY); + litest_add_no_device("touch:abs-transform", touch_abs_transform); + litest_add_no_device("touch:many-slots", touch_many_slots); + litest_add("touch:double-touch-down-up", touch_double_touch_down_up, LITEST_TOUCH, LITEST_ANY); + litest_add("touch:calibration", touch_calibration_scale, LITEST_TOUCH, LITEST_TOUCHPAD); + litest_add("touch:calibration", touch_calibration_scale, LITEST_SINGLE_TOUCH, LITEST_TOUCHPAD); + litest_add("touch:calibration", touch_calibration_rotation, LITEST_TOUCH, LITEST_TOUCHPAD); + litest_add("touch:calibration", touch_calibration_rotation, LITEST_SINGLE_TOUCH, LITEST_TOUCHPAD); + litest_add("touch:calibration", touch_calibration_translation, LITEST_TOUCH, LITEST_TOUCHPAD); + litest_add("touch:calibration", touch_calibration_translation, LITEST_SINGLE_TOUCH, LITEST_TOUCHPAD); + + litest_add("touch:left-handed", touch_no_left_handed, LITEST_TOUCH, LITEST_ANY); + + litest_add("touch:fake-mt", fake_mt_exists, LITEST_FAKE_MT, LITEST_ANY); + litest_add("touch:fake-mt", fake_mt_no_touch_events, LITEST_FAKE_MT, LITEST_ANY); + + litest_add("touch:protocol a", touch_protocol_a_init, LITEST_PROTOCOL_A, LITEST_ANY); + litest_add("touch:protocol a", touch_protocol_a_touch, LITEST_PROTOCOL_A, LITEST_ANY); + litest_add("touch:protocol a", touch_protocol_a_2fg_touch, LITEST_PROTOCOL_A, LITEST_ANY); + + litest_add_ranged("touch:state", touch_initial_state, LITEST_TOUCH, LITEST_PROTOCOL_A, &axes); + + litest_add("touch:time", touch_time_usec, LITEST_TOUCH, LITEST_TOUCHPAD); +} diff -Nru libinput-1.10.3/test/touchpad-buttons.c libinput-0.21.0/test/touchpad-buttons.c --- libinput-1.10.3/test/touchpad-buttons.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/touchpad-buttons.c 2015-08-03 04:35:00.000000000 +0000 @@ -0,0 +1,1602 @@ +/* + * Copyright © 2014 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include + +#include +#include +#include +#include +#include + +#include "libinput-util.h" +#include "litest.h" + +START_TEST(touchpad_click_defaults_clickfinger) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + uint32_t methods, method; + enum libinput_config_status status; + + /* call this test for apple touchpads */ + + methods = libinput_device_config_click_get_methods(device); + ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); + ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); + + method = libinput_device_config_click_get_method(device); + ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); + method = libinput_device_config_click_get_default_method(device); + ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); + + status = libinput_device_config_click_set_method(device, + LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + status = libinput_device_config_click_set_method(device, + LIBINPUT_CONFIG_CLICK_METHOD_NONE); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); +} +END_TEST + +START_TEST(touchpad_click_defaults_btnarea) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + uint32_t methods, method; + enum libinput_config_status status; + + /* call this test for non-apple clickpads */ + + methods = libinput_device_config_click_get_methods(device); + ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); + ck_assert(methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); + + method = libinput_device_config_click_get_method(device); + ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); + method = libinput_device_config_click_get_default_method(device); + ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); + + status = libinput_device_config_click_set_method(device, + LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + status = libinput_device_config_click_set_method(device, + LIBINPUT_CONFIG_CLICK_METHOD_NONE); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); +} +END_TEST + +START_TEST(touchpad_click_defaults_none) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + uint32_t methods, method; + enum libinput_config_status status; + + /* call this test for non-clickpads */ + + methods = libinput_device_config_click_get_methods(device); + ck_assert_int_eq(methods, 0); + + method = libinput_device_config_click_get_method(device); + ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_NONE); + method = libinput_device_config_click_get_default_method(device); + ck_assert_int_eq(method, LIBINPUT_CONFIG_CLICK_METHOD_NONE); + + status = libinput_device_config_click_set_method(device, + LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); + status = libinput_device_config_click_set_method(device, + LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); +} +END_TEST + +START_TEST(touchpad_1fg_clickfinger) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_1fg_clickfinger_no_touch) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_2fg_clickfinger) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 70); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_3fg_clickfinger) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (libevdev_get_num_slots(dev->evdev) < 3) + return; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 60, 70); + litest_touch_down(dev, 2, 70, 70); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + litest_touch_up(dev, 2); + + libinput_dispatch(li); + + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_3fg_clickfinger_btntool) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (libevdev_get_num_slots(dev->evdev) >= 3 || + !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) + return; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 60, 70); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + libinput_dispatch(li); + + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_4fg_clickfinger) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + + if (libevdev_get_num_slots(dev->evdev) < 4) + return; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 60, 70); + litest_touch_down(dev, 2, 70, 70); + litest_touch_down(dev, 3, 80, 70); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + litest_touch_up(dev, 2); + litest_touch_up(dev, 3); + + libinput_dispatch(li); + + litest_wait_for_event(li); + event = libinput_get_event(li); + litest_is_button_event(event, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + libinput_event_destroy(event); + event = libinput_get_event(li); + litest_is_button_event(event, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + libinput_event_destroy(event); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_4fg_clickfinger_btntool_2slots) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + + if (libevdev_get_num_slots(dev->evdev) >= 3 || + !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP)) + return; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 60, 70); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); + litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_wait_for_event(li); + event = libinput_get_event(li); + litest_is_button_event(event, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + libinput_event_destroy(event); + event = libinput_get_event(li); + litest_is_button_event(event, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + libinput_event_destroy(event); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_4fg_clickfinger_btntool_3slots) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + + if (libevdev_get_num_slots(dev->evdev) >= 4 || + libevdev_get_num_slots(dev->evdev) < 3 || + !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) + return; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 60, 70); + litest_touch_down(dev, 2, 70, 70); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); + litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + litest_touch_up(dev, 2); + + libinput_dispatch(li); + + litest_wait_for_event(li); + event = libinput_get_event(li); + litest_is_button_event(event, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + libinput_event_destroy(event); + event = libinput_get_event(li); + litest_is_button_event(event, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + libinput_event_destroy(event); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_2fg_clickfinger_distance) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + double w, h; + bool small_touchpad = false; + unsigned int expected_button; + + if (libinput_device_get_size(dev->libinput_device, &w, &h) == 0 && + h < 50.0) + small_touchpad = true; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 90, 50); + litest_touch_down(dev, 1, 10, 50); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 50, 5); + litest_touch_down(dev, 1, 50, 95); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + /* if the touchpad is small enough, we expect all fingers to count + * for clickfinger */ + if (small_touchpad) + expected_button = BTN_RIGHT; + else + expected_button = BTN_LEFT; + + litest_assert_button_event(li, + expected_button, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + expected_button, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_3fg_clickfinger_distance) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (libevdev_get_num_slots(dev->evdev) < 3) + return; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 90, 90); + litest_touch_down(dev, 1, 10, 15); + litest_touch_down(dev, 2, 10, 15); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + litest_touch_up(dev, 2); + + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_3fg_clickfinger_distance_btntool) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (libevdev_get_num_slots(dev->evdev) > 2) + return; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 90, 90); + litest_touch_down(dev, 1, 10, 15); + libinput_dispatch(li); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_2fg_clickfinger_bottom) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + /* this test is run for the T440s touchpad only, makes getting the + * mm correct easier */ + + libinput_device_config_click_set_method(dev->libinput_device, + LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); + litest_drain_events(li); + + /* one above, one below the magic line, vert spread ca 27mm */ + litest_touch_down(dev, 0, 40, 60); + litest_touch_down(dev, 1, 60, 100); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); + + /* both below the magic line */ + litest_touch_down(dev, 0, 40, 100); + litest_touch_down(dev, 1, 60, 95); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + /* one above, one below the magic line, vert spread 17mm */ + litest_touch_down(dev, 0, 50, 75); + litest_touch_down(dev, 1, 55, 100); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_clickfinger_to_area_method) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + litest_enable_buttonareas(dev); + + litest_touch_down(dev, 0, 95, 95); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + /* use bottom right corner to catch accidental softbutton right */ + litest_touch_down(dev, 0, 95, 95); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + +} +END_TEST + +START_TEST(touchpad_clickfinger_to_area_method_while_down) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + litest_enable_buttonareas(dev); + + litest_touch_down(dev, 0, 95, 95); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_enable_clickfinger(dev); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_drain_events(li); + + /* use bottom right corner to catch accidental softbutton right */ + litest_touch_down(dev, 0, 95, 95); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + +} +END_TEST + +START_TEST(touchpad_area_to_clickfinger_method) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + /* use bottom right corner to catch accidental softbutton right */ + litest_touch_down(dev, 0, 95, 95); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_enable_buttonareas(dev); + + litest_touch_down(dev, 0, 95, 95); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + +} +END_TEST + +START_TEST(touchpad_area_to_clickfinger_method_while_down) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + /* use bottom right corner to catch accidental softbutton right */ + litest_touch_down(dev, 0, 95, 95); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_enable_buttonareas(dev); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_touch_down(dev, 0, 95, 95); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + +} +END_TEST + +START_TEST(touchpad_clickfinger_3fg_tool_position) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_clickfinger(dev); + litest_drain_events(li); + + /* one in thumb area, one in normal area + TRIPLETAP. spread is wide + * but any 3fg touch+click counts as middle */ + litest_touch_down(dev, 0, 5, 99); + litest_touch_down(dev, 1, 90, 15); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_clickfinger_4fg_tool_position) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_clickfinger(dev); + litest_drain_events(li); + + litest_touch_down(dev, 0, 5, 99); + litest_touch_down(dev, 1, 90, 15); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_btn_left) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(clickpad_btn_left) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_buttonareas(dev); + + litest_drain_events(li); + + /* A clickpad always needs a finger down to tell where the + click happens */ + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + ck_assert_int_eq(libinput_next_event_type(li), LIBINPUT_EVENT_NONE); +} +END_TEST + +START_TEST(clickpad_click_n_drag) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + libinput_dispatch(li); + ck_assert_int_eq(libinput_next_event_type(li), LIBINPUT_EVENT_NONE); + + /* now put a second finger down */ + litest_touch_down(dev, 1, 70, 70); + litest_touch_move_to(dev, 1, 70, 70, 80, 50, 5, 0); + litest_touch_up(dev, 1); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(clickpad_finger_pin) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libevdev *evdev = dev->evdev; + const struct input_absinfo *abs; + double w, h; + double dist; + + abs = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X); + ck_assert_notnull(abs); + if (abs->resolution == 0) + return; + + if (libinput_device_get_size(dev->libinput_device, &w, &h) != 0) + return; + + dist = 100.0/max(w, h); + + litest_drain_events(li); + + /* make sure the movement generates pointer events when + not pinned */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 52, 52, 10, 1); + litest_touch_move_to(dev, 0, 52, 52, 48, 48, 10, 1); + litest_touch_move_to(dev, 0, 48, 48, 50, 50, 10, 1); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_button_click(dev, BTN_LEFT, true); + litest_drain_events(li); + + litest_touch_move_to(dev, 0, 50, 50, 50 + dist, 50 + dist, 10, 1); + litest_touch_move_to(dev, 0, 50 + dist, 50 + dist, 50, 50, 10, 1); + litest_touch_move_to(dev, 0, 50, 50, 50 - dist, 50 - dist, 10, 1); + + litest_assert_empty_queue(li); + + litest_button_click(dev, BTN_LEFT, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); + + /* still pinned after release */ + litest_touch_move_to(dev, 0, 50, 50, 50 + dist, 50 + dist, 10, 1); + litest_touch_move_to(dev, 0, 50 + dist, 50 + dist, 50, 50, 10, 1); + litest_touch_move_to(dev, 0, 50, 50, 50 - dist, 50 - dist, 10, 1); + + litest_assert_empty_queue(li); + + /* move to unpin */ + litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10, 1); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); +} +END_TEST + +START_TEST(clickpad_softbutton_left) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 10, 90); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + libinput_dispatch(li); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_softbutton_right) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 90, 90); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + libinput_dispatch(li); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_softbutton_left_tap_n_drag) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + /* Tap in left button area, then finger down, button click + -> expect left button press/release and left button press + Release button, finger up + -> expect right button release + */ + litest_touch_down(dev, 0, 20, 90); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 20, 90); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_softbutton_right_tap_n_drag) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + /* Tap in right button area, then finger down, button click + -> expect left button press/release and right button press + Release button, finger up + -> expect right button release + */ + litest_touch_down(dev, 0, 90, 90); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 90, 90); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_softbutton_left_1st_fg_move) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + double x = 0, y = 0; + int nevents = 0; + + litest_drain_events(li); + + /* One finger down in the left button area, button press + -> expect a button event + Move finger up out of the area, wait for timeout + Move finger around diagonally down left + -> expect motion events down left + Release finger + -> expect a button event */ + + /* finger down, press in left button */ + litest_touch_down(dev, 0, 20, 90); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + + /* move out of the area, then wait for softbutton timer */ + litest_touch_move_to(dev, 0, 20, 90, 90, 20, 10, 0); + libinput_dispatch(li); + litest_timeout_softbuttons(); + libinput_dispatch(li); + litest_drain_events(li); + + /* move down left, expect motion */ + litest_touch_move_to(dev, 0, 90, 20, 20, 90, 10, 0); + + libinput_dispatch(li); + event = libinput_get_event(li); + ck_assert(event != NULL); + while (event) { + struct libinput_event_pointer *p; + + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_MOTION); + p = libinput_event_get_pointer_event(event); + + /* we moved up/right, now down/left so the pointer accel + code may lag behind with the dx/dy vectors. Hence, add up + the x/y movements and expect that on average we moved + left and down */ + x += libinput_event_pointer_get_dx(p); + y += libinput_event_pointer_get_dy(p); + nevents++; + + libinput_event_destroy(event); + libinput_dispatch(li); + event = libinput_get_event(li); + } + + ck_assert(x/nevents < 0); + ck_assert(y/nevents > 0); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_softbutton_left_2nd_fg_move) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + + litest_drain_events(li); + + /* One finger down in the left button area, button press + -> expect a button event + Put a second finger down in the area, move it right, release + -> expect motion events right + Put a second finger down in the area, move it down, release + -> expect motion events down + Release second finger, release first finger + -> expect a button event */ + litest_touch_down(dev, 0, 20, 90); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + + litest_touch_down(dev, 1, 20, 20); + litest_touch_move_to(dev, 1, 20, 20, 80, 20, 10, 0); + + libinput_dispatch(li); + event = libinput_get_event(li); + ck_assert(event != NULL); + while (event) { + struct libinput_event_pointer *p; + double x, y; + + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_MOTION); + p = libinput_event_get_pointer_event(event); + + x = libinput_event_pointer_get_dx(p); + y = libinput_event_pointer_get_dy(p); + + /* Ignore events only containing an unaccelerated motion + * vector. */ + if (x != 0 || y != 0) { + ck_assert(x > 0); + ck_assert(y == 0); + } + + libinput_event_destroy(event); + libinput_dispatch(li); + event = libinput_get_event(li); + } + litest_touch_up(dev, 1); + + /* second finger down */ + litest_touch_down(dev, 1, 20, 20); + litest_touch_move_to(dev, 1, 20, 20, 20, 80, 10, 0); + + libinput_dispatch(li); + event = libinput_get_event(li); + ck_assert(event != NULL); + while (event) { + struct libinput_event_pointer *p; + double x, y; + + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_MOTION); + p = libinput_event_get_pointer_event(event); + + x = libinput_event_pointer_get_dx(p); + y = libinput_event_pointer_get_dy(p); + + ck_assert(x == 0); + ck_assert(y > 0); + + libinput_event_destroy(event); + libinput_dispatch(li); + event = libinput_get_event(li); + } + + litest_touch_up(dev, 1); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_softbutton_left_to_right) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + /* One finger down in left software button area, + move to right button area immediately, click + -> expect right button event + */ + + litest_touch_down(dev, 0, 20, 90); + litest_touch_move_to(dev, 0, 20, 90, 90, 90, 10, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_softbutton_right_to_left) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + /* One finger down in right software button area, + move to left button area immediately, click + -> expect left button event + */ + + litest_touch_down(dev, 0, 90, 90); + litest_touch_move_to(dev, 0, 90, 90, 20, 90, 10, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_topsoftbuttons_left) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 10, 5); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_topsoftbuttons_right) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 90, 5); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_topsoftbuttons_middle) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 5); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_empty_queue(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_topsoftbuttons_move_out_ignore) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + /* Finger down in top button area, wait past enter timeout + Move into main area, wait past leave timeout + Click + -> expect no events + */ + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 5); + libinput_dispatch(li); + litest_timeout_softbuttons(); + libinput_dispatch(li); + litest_assert_empty_queue(li); + + litest_touch_move_to(dev, 0, 50, 5, 80, 90, 20, 0); + libinput_dispatch(li); + litest_timeout_softbuttons(); + libinput_dispatch(li); + + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_topsoftbuttons_clickfinger) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_clickfinger(dev); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 90, 5); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 90, 5); + litest_touch_down(dev, 1, 80, 5); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(clickpad_topsoftbuttons_clickfinger_dev_disabled) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct litest_device *trackpoint = litest_add_device(li, + LITEST_TRACKPOINT); + + libinput_device_config_send_events_set_mode(dev->libinput_device, + LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); + litest_enable_clickfinger(dev); + litest_drain_events(li); + + litest_touch_down(dev, 0, 90, 5); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 90, 5); + litest_touch_down(dev, 1, 10, 5); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_delete_device(trackpoint); +} +END_TEST + +void +litest_setup_tests(void) +{ + litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", touchpad_1fg_clickfinger_no_touch, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", touchpad_2fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", touchpad_3fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", touchpad_3fg_clickfinger_btntool, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", touchpad_4fg_clickfinger, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", touchpad_4fg_clickfinger_btntool_2slots, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", touchpad_4fg_clickfinger_btntool_3slots, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", touchpad_2fg_clickfinger_distance, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", touchpad_3fg_clickfinger_distance, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", touchpad_3fg_clickfinger_distance_btntool, LITEST_CLICKPAD, LITEST_ANY); + litest_add_for_device("touchpad:clickfinger", touchpad_2fg_clickfinger_bottom, LITEST_SYNAPTICS_TOPBUTTONPAD); + litest_add("touchpad:clickfinger", touchpad_clickfinger_to_area_method, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", + touchpad_clickfinger_to_area_method_while_down, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", touchpad_area_to_clickfinger_method, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:clickfinger", + touchpad_area_to_clickfinger_method_while_down, LITEST_CLICKPAD, LITEST_ANY); + /* run those two for the T440 one only so we don't have to worry + * about small touchpads messing with thumb detection expectations */ + litest_add_for_device("touchpad:clickfinger", touchpad_clickfinger_3fg_tool_position, LITEST_SYNAPTICS_TOPBUTTONPAD); + litest_add_for_device("touchpad:clickfinger", touchpad_clickfinger_4fg_tool_position, LITEST_SYNAPTICS_TOPBUTTONPAD); + + litest_add("touchpad:click", touchpad_click_defaults_clickfinger, LITEST_APPLE_CLICKPAD, LITEST_ANY); + litest_add("touchpad:click", touchpad_click_defaults_btnarea, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("touchpad:click", touchpad_click_defaults_none, LITEST_TOUCHPAD, LITEST_CLICKPAD); + + litest_add("touchpad:click", touchpad_btn_left, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); + litest_add("touchpad:click", clickpad_btn_left, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:click", clickpad_click_n_drag, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:click", clickpad_finger_pin, LITEST_CLICKPAD, LITEST_ANY); + + litest_add("touchpad:softbutton", clickpad_softbutton_left, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("touchpad:softbutton", clickpad_softbutton_right, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("touchpad:softbutton", clickpad_softbutton_left_tap_n_drag, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("touchpad:softbutton", clickpad_softbutton_right_tap_n_drag, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("touchpad:softbutton", clickpad_softbutton_left_1st_fg_move, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("touchpad:softbutton", clickpad_softbutton_left_2nd_fg_move, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("touchpad:softbutton", clickpad_softbutton_left_to_right, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("touchpad:softbutton", clickpad_softbutton_right_to_left, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + + litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_left, LITEST_TOPBUTTONPAD, LITEST_ANY); + litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_right, LITEST_TOPBUTTONPAD, LITEST_ANY); + litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_middle, LITEST_TOPBUTTONPAD, LITEST_ANY); + litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_move_out_ignore, LITEST_TOPBUTTONPAD, LITEST_ANY); + litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_clickfinger, LITEST_TOPBUTTONPAD, LITEST_ANY); + litest_add("touchpad:topsoftbuttons", clickpad_topsoftbuttons_clickfinger_dev_disabled, LITEST_TOPBUTTONPAD, LITEST_ANY); +} diff -Nru libinput-1.10.3/test/touchpad.c libinput-0.21.0/test/touchpad.c --- libinput-1.10.3/test/touchpad.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/touchpad.c 2015-08-03 04:55:04.000000000 +0000 @@ -0,0 +1,3543 @@ +/* + * Copyright © 2014 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include + +#include +#include +#include +#include +#include + +#include "libinput-util.h" +#include "litest.h" + +START_TEST(touchpad_1fg_motion) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + + litest_disable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 80, 50, 5, 0); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + event = libinput_get_event(li); + ck_assert(event != NULL); + + while (event) { + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_MOTION); + + ptrev = libinput_event_get_pointer_event(event); + ck_assert_int_ge(libinput_event_pointer_get_dx(ptrev), 0); + ck_assert_int_eq(libinput_event_pointer_get_dy(ptrev), 0); + libinput_event_destroy(event); + event = libinput_get_event(li); + } +} +END_TEST + +START_TEST(touchpad_2fg_no_motion) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + + libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_DISABLED); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 20, 20); + litest_touch_down(dev, 1, 70, 20); + litest_touch_move_to(dev, 0, 20, 20, 80, 80, 5, 0); + litest_touch_move_to(dev, 1, 70, 20, 80, 50, 5, 0); + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + event = libinput_get_event(li); + while (event) { + ck_assert_int_ne(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_MOTION); + libinput_event_destroy(event); + event = libinput_get_event(li); + } +} +END_TEST + +static void +test_2fg_scroll(struct litest_device *dev, double dx, double dy, int want_sleep) +{ + struct libinput *li = dev->libinput; + + litest_touch_down(dev, 0, 49, 50); + litest_touch_down(dev, 1, 51, 50); + + litest_touch_move_two_touches(dev, 49, 50, 51, 50, dx, dy, 10, 0); + + /* Avoid a small scroll being seen as a tap */ + if (want_sleep) { + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); + } + + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + + libinput_dispatch(li); +} + +START_TEST(touchpad_2fg_scroll) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!litest_has_2fg_scroll(dev)) + return; + + litest_enable_2fg_scroll(dev); + litest_drain_events(li); + + test_2fg_scroll(dev, 0.1, 40, 0); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 10); + test_2fg_scroll(dev, 0.1, -40, 0); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -10); + test_2fg_scroll(dev, 40, 0.1, 0); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 10); + test_2fg_scroll(dev, -40, 0.1, 0); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -10); + + /* 2fg scroll smaller than the threshold should not generate events */ + test_2fg_scroll(dev, 0.1, 0.1, 200); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_2fg_scroll_slow_distance) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + const struct input_absinfo *y; + double y_move; + + if (!litest_has_2fg_scroll(dev)) + return; + + /* We want to move > 5 mm. */ + y = libevdev_get_abs_info(dev->evdev, ABS_Y); + if (y->resolution) { + y_move = 7.0 * y->resolution / + (y->maximum - y->minimum) * 100; + } else { + y_move = 20.0; + } + + litest_enable_2fg_scroll(dev); + litest_drain_events(li); + + litest_touch_down(dev, 0, 49, 50); + litest_touch_down(dev, 1, 51, 50); + litest_touch_move_two_touches(dev, 49, 50, 51, 50, 0, y_move, 100, 10); + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + event = libinput_get_event(li); + ck_assert_notnull(event); + + /* last event is value 0, tested elsewhere */ + while (libinput_next_event_type(li) != LIBINPUT_EVENT_NONE) { + double axisval; + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_AXIS); + ptrev = libinput_event_get_pointer_event(event); + + axisval = libinput_event_pointer_get_axis_value(ptrev, + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); + ck_assert(axisval > 0.0); + + /* this is to verify we test the right thing, if the value + is greater than scroll.threshold we triggered the wrong + condition */ + ck_assert(axisval < 5.0); + + libinput_event_destroy(event); + event = libinput_get_event(li); + } + + litest_assert_empty_queue(li); + libinput_event_destroy(event); +} +END_TEST + +START_TEST(touchpad_2fg_scroll_source) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + + if (!litest_has_2fg_scroll(dev)) + return; + + litest_enable_2fg_scroll(dev); + litest_drain_events(li); + + test_2fg_scroll(dev, 0, 30, 0); + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS, -1); + + while ((event = libinput_get_event(li))) { + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_AXIS); + ptrev = libinput_event_get_pointer_event(event); + ck_assert_int_eq(libinput_event_pointer_get_axis_source(ptrev), + LIBINPUT_POINTER_AXIS_SOURCE_FINGER); + libinput_event_destroy(event); + } +} +END_TEST + +START_TEST(touchpad_2fg_scroll_semi_mt) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!litest_has_2fg_scroll(dev)) + return; + + litest_enable_2fg_scroll(dev); + litest_drain_events(li); + + litest_touch_down(dev, 0, 20, 20); + litest_touch_down(dev, 1, 30, 20); + libinput_dispatch(li); + litest_touch_move_to(dev, 1, 30, 20, 30, 70, 10, 5); + + litest_assert_empty_queue(li); + + litest_touch_move_to(dev, 0, 20, 20, 20, 70, 10, 5); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); +} +END_TEST + +START_TEST(touchpad_2fg_scroll_return_to_motion) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!litest_has_2fg_scroll(dev)) + return; + + litest_enable_2fg_scroll(dev); + litest_drain_events(li); + + /* start with motion */ + litest_touch_down(dev, 0, 70, 70); + litest_touch_move_to(dev, 0, 70, 70, 49, 50, 10, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + /* 2fg scroll */ + litest_touch_down(dev, 1, 51, 50); + litest_touch_move_two_touches(dev, 49, 50, 51, 50, 0, 20, 5, 0); + litest_touch_up(dev, 1); + libinput_dispatch(li); + litest_timeout_finger_switch(); + libinput_dispatch(li); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + + litest_touch_move_to(dev, 0, 49, 70, 49, 50, 10, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + /* back to 2fg scroll, lifting the other finger */ + litest_touch_down(dev, 1, 51, 50); + litest_touch_move_two_touches(dev, 49, 50, 51, 50, 0, 20, 5, 0); + litest_touch_up(dev, 0); + libinput_dispatch(li); + litest_timeout_finger_switch(); + libinput_dispatch(li); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + + /* move with second finger */ + litest_touch_move_to(dev, 1, 51, 70, 51, 50, 10, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_touch_up(dev, 1); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_scroll_natural_defaults) +{ + struct litest_device *dev = litest_current_device(); + + ck_assert_int_ge(libinput_device_config_scroll_has_natural_scroll(dev->libinput_device), 1); + ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); + ck_assert_int_eq(libinput_device_config_scroll_get_default_natural_scroll_enabled(dev->libinput_device), 0); +} +END_TEST + +START_TEST(touchpad_scroll_natural_enable_config) +{ + struct litest_device *dev = litest_current_device(); + enum libinput_config_status status; + + status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 1); + + status = libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 0); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + ck_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled(dev->libinput_device), 0); +} +END_TEST + +START_TEST(touchpad_scroll_natural_2fg) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!litest_has_2fg_scroll(dev)) + return; + + litest_enable_2fg_scroll(dev); + litest_drain_events(li); + + libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, 1); + + test_2fg_scroll(dev, 0.1, 40, 0); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -10); + test_2fg_scroll(dev, 0.1, -40, 0); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 10); + test_2fg_scroll(dev, 40, 0.1, 0); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -10); + test_2fg_scroll(dev, -40, 0.1, 0); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 10); + +} +END_TEST + +START_TEST(touchpad_edge_scroll) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + litest_enable_edge_scroll(dev); + + litest_touch_down(dev, 0, 99, 20); + litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 4); + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 99, 80); + litest_touch_move_to(dev, 0, 99, 80, 99, 20, 10, 0); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -4); + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 20, 99); + litest_touch_move_to(dev, 0, 20, 99, 70, 99, 10, 0); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 4); + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 70, 99); + litest_touch_move_to(dev, 0, 70, 99, 20, 99, 10, 0); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -4); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_scroll_defaults) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + struct libevdev *evdev = dev->evdev; + enum libinput_config_scroll_method method, expected; + enum libinput_config_status status; + + method = libinput_device_config_scroll_get_methods(device); + ck_assert(method & LIBINPUT_CONFIG_SCROLL_EDGE); + if (libevdev_get_num_slots(evdev) > 1) + ck_assert(method & LIBINPUT_CONFIG_SCROLL_2FG); + else + ck_assert((method & LIBINPUT_CONFIG_SCROLL_2FG) == 0); + + if (libevdev_get_num_slots(evdev) > 1) + expected = LIBINPUT_CONFIG_SCROLL_2FG; + else + expected = LIBINPUT_CONFIG_SCROLL_EDGE; + + method = libinput_device_config_scroll_get_method(device); + ck_assert_int_eq(method, expected); + method = libinput_device_config_scroll_get_default_method(device); + ck_assert_int_eq(method, expected); + + status = libinput_device_config_scroll_set_method(device, + LIBINPUT_CONFIG_SCROLL_EDGE); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + status = libinput_device_config_scroll_set_method(device, + LIBINPUT_CONFIG_SCROLL_2FG); + + if (libevdev_get_num_slots(evdev) > 1) + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + else + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); +} +END_TEST + +START_TEST(touchpad_edge_scroll_timeout) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + double width = 0, height = 0; + int y_movement = 30; /* in percent of height */ + + /* account for different touchpad heights, let's move 100% on a 15mm + high touchpad, less on anything else. This number is picked at + random, we just want deltas less than 5. + */ + if (libinput_device_get_size(dev->libinput_device, + &width, + &height) != -1) { + y_movement = 100 * 15/height; + } + + litest_drain_events(li); + litest_enable_edge_scroll(dev); + + litest_touch_down(dev, 0, 99, 20); + libinput_dispatch(li); + litest_timeout_edgescroll(); + libinput_dispatch(li); + + litest_touch_move_to(dev, 0, 99, 20, 99, 20 + y_movement, 100, 10); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + event = libinput_get_event(li); + ck_assert_notnull(event); + + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS, -1); + + while (libinput_next_event_type(li) != LIBINPUT_EVENT_NONE) { + double axisval; + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_AXIS); + ptrev = libinput_event_get_pointer_event(event); + + axisval = libinput_event_pointer_get_axis_value(ptrev, + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); + ck_assert(axisval > 0.0); + + /* this is to verify we test the right thing, if the value + is greater than scroll.threshold we triggered the wrong + condition */ + ck_assert(axisval < 5.0); + + libinput_event_destroy(event); + event = libinput_get_event(li); + } + + litest_assert_empty_queue(li); + libinput_event_destroy(event); +} +END_TEST + +START_TEST(touchpad_edge_scroll_no_motion) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + litest_enable_edge_scroll(dev); + + litest_touch_down(dev, 0, 99, 10); + litest_touch_move_to(dev, 0, 99, 10, 99, 70, 10, 0); + /* moving outside -> no motion event */ + litest_touch_move_to(dev, 0, 99, 70, 20, 80, 10, 0); + /* moving down outside edge once scrolling had started -> scroll */ + litest_touch_move_to(dev, 0, 20, 80, 40, 99, 10, 0); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 4); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_edge_scroll_no_edge_after_motion) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + litest_enable_edge_scroll(dev); + + /* moving into the edge zone must not trigger scroll events */ + litest_touch_down(dev, 0, 20, 20); + litest_touch_move_to(dev, 0, 20, 20, 99, 20, 10, 0); + litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_edge_scroll_source) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + + litest_drain_events(li); + litest_enable_edge_scroll(dev); + + litest_touch_down(dev, 0, 99, 20); + litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10, 0); + litest_touch_up(dev, 0); + + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS, -1); + + while ((event = libinput_get_event(li))) { + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_AXIS); + ptrev = libinput_event_get_pointer_event(event); + ck_assert_int_eq(libinput_event_pointer_get_axis_source(ptrev), + LIBINPUT_POINTER_AXIS_SOURCE_FINGER); + libinput_event_destroy(event); + } +} +END_TEST + +START_TEST(touchpad_edge_scroll_no_2fg) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + litest_enable_edge_scroll(dev); + + litest_touch_down(dev, 0, 49, 50); + litest_touch_down(dev, 1, 51, 50); + litest_touch_move_two_touches(dev, 49, 50, 51, 50, 20, 30, 5, 0); + libinput_dispatch(li); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + libinput_dispatch(li); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_edge_scroll_into_buttonareas) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_buttonareas(dev); + litest_enable_edge_scroll(dev); + litest_drain_events(li); + + litest_touch_down(dev, 0, 99, 40); + litest_touch_move_to(dev, 0, 99, 40, 99, 95, 10, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + /* in the button zone now, make sure we still get events */ + litest_touch_move_to(dev, 0, 99, 95, 99, 100, 10, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + + /* and out of the zone again */ + litest_touch_move_to(dev, 0, 99, 100, 99, 70, 10, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + + /* still out of the zone */ + litest_touch_move_to(dev, 0, 99, 70, 99, 50, 10, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); +} +END_TEST + +START_TEST(touchpad_edge_scroll_within_buttonareas) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_buttonareas(dev); + litest_enable_edge_scroll(dev); + litest_drain_events(li); + + litest_touch_down(dev, 0, 20, 99); + + /* within left button */ + litest_touch_move_to(dev, 0, 20, 99, 40, 99, 10, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + + /* over to right button */ + litest_touch_move_to(dev, 0, 40, 99, 60, 99, 10, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + + /* within right button */ + litest_touch_move_to(dev, 0, 60, 99, 80, 99, 10, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); +} +END_TEST + +START_TEST(touchpad_edge_scroll_buttonareas_click_stops_scroll) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + double val; + + litest_enable_buttonareas(dev); + litest_enable_edge_scroll(dev); + litest_drain_events(li); + + litest_touch_down(dev, 0, 20, 95); + litest_touch_move_to(dev, 0, 20, 95, 70, 95, 10, 5); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + + litest_button_click(dev, BTN_LEFT, true); + libinput_dispatch(li); + + event = libinput_get_event(li); + ptrev = litest_is_axis_event(event, + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, + LIBINPUT_POINTER_AXIS_SOURCE_FINGER); + val = libinput_event_pointer_get_axis_value(ptrev, + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL); + ck_assert(val == 0.0); + libinput_event_destroy(event); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + + libinput_event_destroy(event); + + /* within button areas -> no movement */ + litest_touch_move_to(dev, 0, 70, 95, 90, 95, 10, 0); + litest_assert_empty_queue(li); + + litest_button_click(dev, BTN_LEFT, false); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); + + litest_touch_up(dev, 0); +} +END_TEST + +START_TEST(touchpad_edge_scroll_clickfinger_click_stops_scroll) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + double val; + + litest_enable_clickfinger(dev); + litest_enable_edge_scroll(dev); + litest_drain_events(li); + + litest_touch_down(dev, 0, 20, 95); + litest_touch_move_to(dev, 0, 20, 95, 70, 95, 10, 5); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + + litest_button_click(dev, BTN_LEFT, true); + libinput_dispatch(li); + + event = libinput_get_event(li); + ptrev = litest_is_axis_event(event, + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, + LIBINPUT_POINTER_AXIS_SOURCE_FINGER); + val = libinput_event_pointer_get_axis_value(ptrev, + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL); + ck_assert(val == 0.0); + libinput_event_destroy(event); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + libinput_event_destroy(event); + + /* clickfinger releases pointer -> expect movement */ + litest_touch_move_to(dev, 0, 70, 95, 90, 95, 10, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + litest_assert_empty_queue(li); + + litest_button_click(dev, BTN_LEFT, false); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); + + litest_touch_up(dev, 0); +} +END_TEST + +START_TEST(touchpad_edge_scroll_into_area) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_edge_scroll(dev); + litest_drain_events(li); + + /* move into area, move vertically, move back to edge */ + + litest_touch_down(dev, 0, 99, 20); + litest_touch_move_to(dev, 0, 99, 20, 99, 50, 10, 2); + litest_touch_move_to(dev, 0, 99, 50, 20, 50, 10, 2); + litest_assert_only_typed_events(li, + LIBINPUT_EVENT_POINTER_AXIS); + litest_touch_move_to(dev, 0, 20, 50, 20, 20, 10, 2); + litest_touch_move_to(dev, 0, 20, 20, 99, 20, 10, 2); + litest_assert_empty_queue(li); + + litest_touch_move_to(dev, 0, 99, 20, 99, 50, 10, 2); + litest_assert_only_typed_events(li, + LIBINPUT_EVENT_POINTER_AXIS); +} +END_TEST + +static int +touchpad_has_palm_detect_size(struct litest_device *dev) +{ + double width, height; + unsigned int vendor; + int rc; + + vendor = libinput_device_get_id_vendor(dev->libinput_device); + if (vendor == VENDOR_ID_WACOM) + return 0; + if (vendor == VENDOR_ID_APPLE) + return 1; + + rc = libinput_device_get_size(dev->libinput_device, &width, &height); + + return rc == 0 && width >= 70; +} + +START_TEST(touchpad_palm_detect_at_edge) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!touchpad_has_palm_detect_size(dev) || + !litest_has_2fg_scroll(dev)) + return; + + litest_enable_2fg_scroll(dev); + + litest_disable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 99, 50); + litest_touch_move_to(dev, 0, 99, 50, 99, 70, 5, 0); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 5, 50); + litest_touch_move_to(dev, 0, 5, 50, 5, 70, 5, 0); + litest_touch_up(dev, 0); +} +END_TEST + +START_TEST(touchpad_no_palm_detect_at_edge_for_edge_scrolling) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!touchpad_has_palm_detect_size(dev)) + return; + + litest_enable_edge_scroll(dev); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 99, 50); + litest_touch_move_to(dev, 0, 99, 50, 99, 70, 5, 0); + litest_touch_up(dev, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); +} +END_TEST + +START_TEST(touchpad_palm_detect_at_bottom_corners) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!touchpad_has_palm_detect_size(dev) || + !litest_has_2fg_scroll(dev)) + return; + + litest_enable_2fg_scroll(dev); + + litest_disable_tap(dev->libinput_device); + + /* Run for non-clickpads only: make sure the bottom corners trigger + palm detection too */ + litest_drain_events(li); + + litest_touch_down(dev, 0, 99, 95); + litest_touch_move_to(dev, 0, 99, 95, 99, 99, 10, 0); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 5, 95); + litest_touch_move_to(dev, 0, 5, 95, 5, 99, 5, 0); + litest_touch_up(dev, 0); +} +END_TEST + +START_TEST(touchpad_palm_detect_at_top_corners) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!touchpad_has_palm_detect_size(dev) || + !litest_has_2fg_scroll(dev)) + return; + + litest_enable_2fg_scroll(dev); + + litest_disable_tap(dev->libinput_device); + + /* Run for non-clickpads only: make sure the bottom corners trigger + palm detection too */ + litest_drain_events(li); + + litest_touch_down(dev, 0, 99, 5); + litest_touch_move_to(dev, 0, 99, 5, 99, 9, 10, 0); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 5, 5); + litest_touch_move_to(dev, 0, 5, 5, 5, 9, 5, 0); + litest_touch_up(dev, 0); +} +END_TEST + +START_TEST(touchpad_palm_detect_palm_stays_palm) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!touchpad_has_palm_detect_size(dev) || + !litest_has_2fg_scroll(dev)) + return; + + litest_enable_2fg_scroll(dev); + + litest_disable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 99, 20); + litest_touch_move_to(dev, 0, 99, 20, 75, 99, 5, 0); + litest_touch_up(dev, 0); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_palm_detect_palm_becomes_pointer) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!touchpad_has_palm_detect_size(dev) || + !litest_has_2fg_scroll(dev)) + return; + + litest_enable_2fg_scroll(dev); + + litest_disable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 99, 50); + litest_touch_move_to(dev, 0, 99, 50, 0, 70, 5, 0); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_palm_detect_no_palm_moving_into_edges) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!touchpad_has_palm_detect_size(dev)) + return; + + litest_disable_tap(dev->libinput_device); + + /* moving non-palm into the edge does not label it as palm */ + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 99, 50, 5, 0); + + litest_drain_events(li); + + litest_touch_move_to(dev, 0, 99, 50, 99, 90, 5, 0); + libinput_dispatch(li); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_touch_up(dev, 0); + libinput_dispatch(li); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_palm_detect_tap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (!touchpad_has_palm_detect_size(dev)) + return; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 95, 5); + litest_touch_up(dev, 0); + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 5, 5); + litest_touch_up(dev, 0); + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 5, 90); + litest_touch_up(dev, 0); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_empty_queue(li); + + litest_touch_down(dev, 0, 95, 90); + litest_touch_up(dev, 0); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_left_handed) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + struct libinput *li = dev->libinput; + enum libinput_config_status status; + + status = libinput_device_config_left_handed_set(d, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_drain_events(li); + litest_button_click(dev, BTN_LEFT, 1); + litest_button_click(dev, BTN_LEFT, 0); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_button_click(dev, BTN_RIGHT, 1); + litest_button_click(dev, BTN_RIGHT, 0); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + if (libevdev_has_event_code(dev->evdev, + EV_KEY, + BTN_MIDDLE)) { + litest_button_click(dev, BTN_MIDDLE, 1); + litest_button_click(dev, BTN_MIDDLE, 0); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + } +} +END_TEST + +START_TEST(touchpad_left_handed_clickpad) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + struct libinput *li = dev->libinput; + enum libinput_config_status status; + + status = libinput_device_config_left_handed_set(d, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_drain_events(li); + litest_touch_down(dev, 0, 10, 90); + litest_button_click(dev, BTN_LEFT, 1); + litest_button_click(dev, BTN_LEFT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_drain_events(li); + litest_touch_down(dev, 0, 90, 90); + litest_button_click(dev, BTN_LEFT, 1); + litest_button_click(dev, BTN_LEFT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_drain_events(li); + litest_touch_down(dev, 0, 50, 50); + litest_button_click(dev, BTN_LEFT, 1); + litest_button_click(dev, BTN_LEFT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_left_handed_clickfinger) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + struct libinput *li = dev->libinput; + enum libinput_config_status status; + + status = libinput_device_config_left_handed_set(d, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_drain_events(li); + litest_touch_down(dev, 0, 10, 90); + litest_button_click(dev, BTN_LEFT, 1); + litest_button_click(dev, BTN_LEFT, 0); + litest_touch_up(dev, 0); + + /* Clickfinger is unaffected by left-handed setting */ + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_drain_events(li); + litest_touch_down(dev, 0, 10, 90); + litest_touch_down(dev, 1, 30, 90); + litest_button_click(dev, BTN_LEFT, 1); + litest_button_click(dev, BTN_LEFT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_left_handed_tapping) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + struct libinput *li = dev->libinput; + enum libinput_config_status status; + + litest_enable_tap(dev->libinput_device); + + status = libinput_device_config_left_handed_set(d, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); + + /* Tapping is unaffected by left-handed setting */ + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_left_handed_tapping_2fg) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + struct libinput *li = dev->libinput; + enum libinput_config_status status; + + litest_enable_tap(dev->libinput_device); + + status = libinput_device_config_left_handed_set(d, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 50); + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); + + /* Tapping is unaffected by left-handed setting */ + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_left_handed_delayed) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + struct libinput *li = dev->libinput; + enum libinput_config_status status; + + litest_drain_events(li); + litest_button_click(dev, BTN_LEFT, 1); + libinput_dispatch(li); + + status = libinput_device_config_left_handed_set(d, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_button_click(dev, BTN_LEFT, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + /* left-handed takes effect now */ + litest_button_click(dev, BTN_RIGHT, 1); + libinput_dispatch(li); + litest_timeout_middlebutton(); + libinput_dispatch(li); + litest_button_click(dev, BTN_LEFT, 1); + libinput_dispatch(li); + + status = libinput_device_config_left_handed_set(d, 0); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_button_click(dev, BTN_RIGHT, 0); + litest_button_click(dev, BTN_LEFT, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_button_event(li, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +START_TEST(touchpad_left_handed_clickpad_delayed) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *d = dev->libinput_device; + struct libinput *li = dev->libinput; + enum libinput_config_status status; + + litest_drain_events(li); + litest_touch_down(dev, 0, 10, 90); + litest_button_click(dev, BTN_LEFT, 1); + libinput_dispatch(li); + + status = libinput_device_config_left_handed_set(d, 1); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_button_click(dev, BTN_LEFT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + /* left-handed takes effect now */ + litest_drain_events(li); + litest_touch_down(dev, 0, 90, 90); + litest_button_click(dev, BTN_LEFT, 1); + libinput_dispatch(li); + + status = libinput_device_config_left_handed_set(d, 0); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_button_click(dev, BTN_LEFT, 0); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); +} +END_TEST + +static void +hover_continue(struct litest_device *dev, unsigned int slot, + int x, int y) +{ + litest_event(dev, EV_ABS, ABS_MT_SLOT, slot); + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); + litest_event(dev, EV_ABS, ABS_X, x); + litest_event(dev, EV_ABS, ABS_Y, y); + litest_event(dev, EV_ABS, ABS_PRESSURE, 10); + litest_event(dev, EV_ABS, ABS_TOOL_WIDTH, 6); + /* WARNING: no SYN_REPORT! */ +} + +static void +hover_start(struct litest_device *dev, unsigned int slot, + int x, int y) +{ + static unsigned int tracking_id; + + litest_event(dev, EV_ABS, ABS_MT_SLOT, slot); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, ++tracking_id); + hover_continue(dev, slot, x, y); + /* WARNING: no SYN_REPORT! */ +} + +START_TEST(touchpad_semi_mt_hover_noevent) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + int i; + int x = 2400, + y = 2400; + + litest_drain_events(li); + + hover_start(dev, 0, x, y); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + for (i = 0; i < 10; i++) { + x += 200; + y -= 200; + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); + litest_event(dev, EV_ABS, ABS_X, x); + litest_event(dev, EV_ABS, ABS_Y, y); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + } + + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_semi_mt_hover_down) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + int i; + int x = 2400, + y = 2400; + + litest_drain_events(li); + + hover_start(dev, 0, x, y); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + for (i = 0; i < 10; i++) { + x += 200; + y -= 200; + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); + litest_event(dev, EV_ABS, ABS_X, x); + litest_event(dev, EV_ABS, ABS_Y, y); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + } + + litest_assert_empty_queue(li); + + litest_event(dev, EV_ABS, ABS_X, x + 100); + litest_event(dev, EV_ABS, ABS_Y, y + 100); + litest_event(dev, EV_KEY, BTN_TOUCH, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + for (i = 0; i < 10; i++) { + x -= 200; + y += 200; + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); + litest_event(dev, EV_ABS, ABS_X, x); + litest_event(dev, EV_ABS, ABS_Y, y); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + } + + libinput_dispatch(li); + + ck_assert_int_ne(libinput_next_event_type(li), + LIBINPUT_EVENT_NONE); + while ((event = libinput_get_event(li)) != NULL) { + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_MOTION); + libinput_event_destroy(event); + libinput_dispatch(li); + } + + /* go back to hover */ + hover_continue(dev, 0, x, y); + litest_event(dev, EV_KEY, BTN_TOUCH, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + for (i = 0; i < 10; i++) { + x += 200; + y -= 200; + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); + litest_event(dev, EV_ABS, ABS_X, x); + litest_event(dev, EV_ABS, ABS_Y, y); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + } + + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_semi_mt_hover_down_hover_down) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + int i, j; + int x = 1400, + y = 1400; + + litest_drain_events(li); + + /* hover */ + hover_start(dev, 0, x, y); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_assert_empty_queue(li); + + for (i = 0; i < 3; i++) { + /* touch */ + litest_event(dev, EV_ABS, ABS_X, x + 100); + litest_event(dev, EV_ABS, ABS_Y, y + 100); + litest_event(dev, EV_KEY, BTN_TOUCH, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + for (j = 0; j < 5; j++) { + x += 200; + y += 200; + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); + litest_event(dev, EV_ABS, ABS_X, x); + litest_event(dev, EV_ABS, ABS_Y, y); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + } + + libinput_dispatch(li); + + ck_assert_int_ne(libinput_next_event_type(li), + LIBINPUT_EVENT_NONE); + while ((event = libinput_get_event(li)) != NULL) { + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_MOTION); + libinput_event_destroy(event); + libinput_dispatch(li); + } + + /* go back to hover */ + hover_continue(dev, 0, x, y); + litest_event(dev, EV_KEY, BTN_TOUCH, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + for (j = 0; j < 5; j++) { + x -= 200; + y -= 200; + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); + litest_event(dev, EV_ABS, ABS_X, x); + litest_event(dev, EV_ABS, ABS_Y, y); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + } + + litest_assert_empty_queue(li); + } + + /* touch */ + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_empty_queue(li); + + /* start a new touch to be sure */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10, 10); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + ck_assert_int_ne(libinput_next_event_type(li), + LIBINPUT_EVENT_NONE); + while ((event = libinput_get_event(li)) != NULL) { + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_MOTION); + libinput_event_destroy(event); + libinput_dispatch(li); + } +} +END_TEST + +START_TEST(touchpad_semi_mt_hover_down_up) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + int i; + int x = 1400, + y = 1400; + + litest_drain_events(li); + + /* hover two fingers, then touch */ + hover_start(dev, 0, x, y); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_assert_empty_queue(li); + + hover_start(dev, 1, x, y); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_assert_empty_queue(li); + + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); + litest_event(dev, EV_KEY, BTN_TOUCH, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_empty_queue(li); + + /* hover first finger, end second in same frame */ + litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); + litest_event(dev, EV_KEY, BTN_TOUCH, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_empty_queue(li); + + litest_event(dev, EV_KEY, BTN_TOUCH, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + /* now move the finger */ + for (i = 0; i < 10; i++) { + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); + litest_event(dev, EV_ABS, ABS_X, x); + litest_event(dev, EV_ABS, ABS_Y, y); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + x -= 100; + y -= 100; + } + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); + litest_event(dev, EV_KEY, BTN_TOUCH, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); +} +END_TEST + +START_TEST(touchpad_semi_mt_hover_2fg_noevent) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + int i; + int x = 2400, + y = 2400; + + litest_drain_events(li); + + hover_start(dev, 0, x, y); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + hover_start(dev, 1, x + 500, y + 500); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + for (i = 0; i < 10; i++) { + x += 200; + y -= 200; + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x + 500); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y + 500); + litest_event(dev, EV_ABS, ABS_X, x); + litest_event(dev, EV_ABS, ABS_Y, y); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + } + + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_empty_queue(li); + + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_semi_mt_hover_2fg_1fg_down) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + int i; + int x = 2400, + y = 2400; + + litest_drain_events(li); + + /* two slots active, but BTN_TOOL_FINGER only */ + hover_start(dev, 0, x, y); + hover_start(dev, 1, x + 500, y + 500); + litest_event(dev, EV_KEY, BTN_TOUCH, 1); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + for (i = 0; i < 10; i++) { + x += 200; + y -= 200; + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x + 500); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y + 500); + litest_event(dev, EV_ABS, ABS_X, x); + litest_event(dev, EV_ABS, ABS_Y, y); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + } + + litest_event(dev, EV_KEY, BTN_TOUCH, 0); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + + ck_assert_int_ne(libinput_next_event_type(li), + LIBINPUT_EVENT_NONE); + while ((event = libinput_get_event(li)) != NULL) { + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_MOTION); + libinput_event_destroy(event); + libinput_dispatch(li); + } +} +END_TEST + +START_TEST(touchpad_hover_noevent) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + litest_hover_start(dev, 0, 50, 50); + litest_hover_move_to(dev, 0, 50, 50, 70, 70, 10, 10); + litest_hover_end(dev, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_hover_down) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + /* hover the finger */ + litest_hover_start(dev, 0, 50, 50); + + litest_hover_move_to(dev, 0, 50, 50, 70, 70, 10, 10); + + litest_assert_empty_queue(li); + + /* touch the finger on the sensor */ + litest_touch_move_to(dev, 0, 70, 70, 50, 50, 10, 10); + + libinput_dispatch(li); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + /* go back to hover */ + litest_hover_move_to(dev, 0, 50, 50, 70, 70, 10, 10); + litest_hover_end(dev, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_hover_down_hover_down) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + int i; + + litest_drain_events(li); + + litest_hover_start(dev, 0, 50, 50); + + for (i = 0; i < 3; i++) { + + /* hover the finger */ + litest_hover_move_to(dev, 0, 50, 50, 70, 70, 10, 10); + + litest_assert_empty_queue(li); + + /* touch the finger */ + litest_touch_move_to(dev, 0, 70, 70, 50, 50, 10, 10); + + libinput_dispatch(li); + + litest_assert_only_typed_events(li, + LIBINPUT_EVENT_POINTER_MOTION); + } + + litest_hover_end(dev, 0); + + /* start a new touch to be sure */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10, 10); + litest_touch_up(dev, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); +} +END_TEST + +START_TEST(touchpad_hover_down_up) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + /* hover two fingers, and a touch */ + litest_push_event_frame(dev); + litest_hover_start(dev, 0, 50, 50); + litest_hover_start(dev, 1, 50, 50); + litest_touch_down(dev, 2, 50, 50); + litest_pop_event_frame(dev);; + + litest_assert_empty_queue(li); + + /* hover first finger, end second and third in same frame */ + litest_push_event_frame(dev); + litest_hover_move(dev, 0, 70, 70); + litest_hover_end(dev, 1); + litest_touch_up(dev, 2); + litest_pop_event_frame(dev);; + + litest_assert_empty_queue(li); + + /* now move the finger */ + litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10, 10); + + litest_touch_up(dev, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); +} +END_TEST + +START_TEST(touchpad_hover_2fg_noevent) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + /* hover two fingers */ + litest_push_event_frame(dev); + litest_hover_start(dev, 0, 25, 25); + litest_hover_start(dev, 1, 50, 50); + litest_pop_event_frame(dev);; + + litest_hover_move_two_touches(dev, 25, 25, 50, 50, 50, 50, 10, 0); + + litest_push_event_frame(dev); + litest_hover_end(dev, 0); + litest_hover_end(dev, 1); + litest_pop_event_frame(dev);; + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_hover_2fg_1fg_down) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + int i; + + litest_drain_events(li); + + /* hover two fingers */ + litest_push_event_frame(dev); + litest_hover_start(dev, 0, 25, 25); + litest_touch_down(dev, 1, 50, 50); + litest_pop_event_frame(dev);; + + for (i = 0; i < 10; i++) { + litest_push_event_frame(dev); + litest_hover_move(dev, 0, 25 + 5 * i, 25 + 5 * i); + litest_touch_move(dev, 1, 50 + 5 * i, 50 - 5 * i); + litest_pop_event_frame(dev);; + } + + litest_push_event_frame(dev); + litest_hover_end(dev, 0); + litest_touch_up(dev, 1); + litest_pop_event_frame(dev);; + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); +} +END_TEST + +static void +assert_btnevent_from_device(struct litest_device *device, + unsigned int button, + enum libinput_button_state state) +{ + struct libinput *li = device->libinput; + struct libinput_event *e; + + libinput_dispatch(li); + e = libinput_get_event(li); + litest_is_button_event(e, button, state); + + litest_assert_ptr_eq(libinput_event_get_device(e), device->libinput_device); + libinput_event_destroy(e); +} + +START_TEST(touchpad_trackpoint_buttons) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *trackpoint; + struct libinput *li = touchpad->libinput; + + const struct buttons { + unsigned int device_value; + unsigned int real_value; + } buttons[] = { + { BTN_0, BTN_LEFT }, + { BTN_1, BTN_RIGHT }, + { BTN_2, BTN_MIDDLE }, + }; + const struct buttons *b; + + trackpoint = litest_add_device(li, + LITEST_TRACKPOINT); + libinput_device_config_scroll_set_method(trackpoint->libinput_device, + LIBINPUT_CONFIG_SCROLL_NO_SCROLL); + + litest_drain_events(li); + + ARRAY_FOR_EACH(buttons, b) { + litest_button_click(touchpad, b->device_value, true); + assert_btnevent_from_device(trackpoint, + b->real_value, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_button_click(touchpad, b->device_value, false); + + assert_btnevent_from_device(trackpoint, + b->real_value, + LIBINPUT_BUTTON_STATE_RELEASED); + } + + litest_delete_device(trackpoint); +} +END_TEST + +START_TEST(touchpad_trackpoint_mb_scroll) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *trackpoint; + struct libinput *li = touchpad->libinput; + + trackpoint = litest_add_device(li, + LITEST_TRACKPOINT); + + litest_drain_events(li); + litest_button_click(touchpad, BTN_2, true); /* middle */ + libinput_dispatch(li); + litest_timeout_buttonscroll(); + libinput_dispatch(li); + litest_event(trackpoint, EV_REL, REL_Y, -2); + litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); + litest_event(trackpoint, EV_REL, REL_Y, -2); + litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); + litest_event(trackpoint, EV_REL, REL_Y, -2); + litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); + litest_event(trackpoint, EV_REL, REL_Y, -2); + litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); + litest_button_click(touchpad, BTN_2, false); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + + litest_delete_device(trackpoint); +} +END_TEST + +START_TEST(touchpad_trackpoint_mb_click) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *trackpoint; + struct libinput *li = touchpad->libinput; + enum libinput_config_status status; + + trackpoint = litest_add_device(li, + LITEST_TRACKPOINT); + status = libinput_device_config_scroll_set_method( + trackpoint->libinput_device, + LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + litest_drain_events(li); + litest_button_click(touchpad, BTN_2, true); /* middle */ + litest_button_click(touchpad, BTN_2, false); + + assert_btnevent_from_device(trackpoint, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + assert_btnevent_from_device(trackpoint, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_delete_device(trackpoint); +} +END_TEST + +START_TEST(touchpad_trackpoint_buttons_softbuttons) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *trackpoint; + struct libinput *li = touchpad->libinput; + + trackpoint = litest_add_device(li, + LITEST_TRACKPOINT); + + litest_drain_events(li); + + litest_touch_down(touchpad, 0, 95, 90); + litest_button_click(touchpad, BTN_LEFT, true); + litest_button_click(touchpad, BTN_1, true); + litest_button_click(touchpad, BTN_LEFT, false); + litest_touch_up(touchpad, 0); + litest_button_click(touchpad, BTN_1, false); + + assert_btnevent_from_device(touchpad, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + assert_btnevent_from_device(trackpoint, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + assert_btnevent_from_device(touchpad, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + assert_btnevent_from_device(trackpoint, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_touch_down(touchpad, 0, 95, 90); + litest_button_click(touchpad, BTN_LEFT, true); + litest_button_click(touchpad, BTN_1, true); + litest_button_click(touchpad, BTN_1, false); + litest_button_click(touchpad, BTN_LEFT, false); + litest_touch_up(touchpad, 0); + + assert_btnevent_from_device(touchpad, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + assert_btnevent_from_device(trackpoint, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + assert_btnevent_from_device(trackpoint, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + assert_btnevent_from_device(touchpad, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_delete_device(trackpoint); +} +END_TEST + +START_TEST(touchpad_trackpoint_buttons_2fg_scroll) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *trackpoint; + struct libinput *li = touchpad->libinput; + struct libinput_event *e; + struct libinput_event_pointer *pev; + double val; + + trackpoint = litest_add_device(li, + LITEST_TRACKPOINT); + + litest_drain_events(li); + + litest_touch_down(touchpad, 0, 49, 70); + litest_touch_down(touchpad, 1, 51, 70); + litest_touch_move_two_touches(touchpad, 49, 70, 51, 70, 0, -40, 10, 0); + + libinput_dispatch(li); + litest_wait_for_event(li); + + /* Make sure we get scroll events but _not_ the scroll release */ + while ((e = libinput_get_event(li))) { + ck_assert_int_eq(libinput_event_get_type(e), + LIBINPUT_EVENT_POINTER_AXIS); + pev = libinput_event_get_pointer_event(e); + val = libinput_event_pointer_get_axis_value(pev, + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); + ck_assert(val != 0.0); + libinput_event_destroy(e); + } + + litest_button_click(touchpad, BTN_1, true); + assert_btnevent_from_device(trackpoint, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_touch_move_to(touchpad, 0, 40, 30, 40, 70, 10, 0); + litest_touch_move_to(touchpad, 1, 60, 30, 60, 70, 10, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + + while ((e = libinput_get_event(li))) { + ck_assert_int_eq(libinput_event_get_type(e), + LIBINPUT_EVENT_POINTER_AXIS); + pev = libinput_event_get_pointer_event(e); + val = libinput_event_pointer_get_axis_value(pev, + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); + ck_assert(val != 0.0); + libinput_event_destroy(e); + } + + litest_button_click(touchpad, BTN_1, false); + assert_btnevent_from_device(trackpoint, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + /* the movement lags behind the touch movement, so the first couple + events can be downwards even though we started scrolling up. do a + short scroll up, drain those events, then we can use + litest_assert_scroll() which tests for the trailing 0/0 scroll + for us. + */ + litest_touch_move_to(touchpad, 0, 40, 70, 40, 60, 10, 0); + litest_touch_move_to(touchpad, 1, 60, 70, 60, 60, 10, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + litest_touch_move_to(touchpad, 0, 40, 60, 40, 30, 10, 0); + litest_touch_move_to(touchpad, 1, 60, 60, 60, 30, 10, 0); + + litest_touch_up(touchpad, 0); + litest_touch_up(touchpad, 1); + + libinput_dispatch(li); + + litest_assert_scroll(li, + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, + -1); + + litest_delete_device(trackpoint); +} +END_TEST + +START_TEST(touchpad_trackpoint_no_trackpoint) +{ + struct litest_device *touchpad = litest_current_device(); + struct libinput *li = touchpad->libinput; + + litest_drain_events(li); + litest_button_click(touchpad, BTN_0, true); /* left */ + litest_button_click(touchpad, BTN_0, false); + litest_assert_empty_queue(li); + + litest_button_click(touchpad, BTN_1, true); /* right */ + litest_button_click(touchpad, BTN_1, false); + litest_assert_empty_queue(li); + + litest_button_click(touchpad, BTN_2, true); /* middle */ + litest_button_click(touchpad, BTN_2, false); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_initial_state) +{ + struct litest_device *dev; + struct libinput *libinput1, *libinput2; + struct libinput_event *ev1, *ev2; + struct libinput_event_pointer *p1, *p2; + int axis = _i; /* looped test */ + int x = 40, y = 60; + + dev = litest_current_device(); + libinput1 = dev->libinput; + + litest_disable_tap(dev->libinput_device); + + litest_touch_down(dev, 0, x, y); + litest_touch_up(dev, 0); + + /* device is now on some x/y value */ + litest_drain_events(libinput1); + + libinput2 = litest_create_context(); + libinput_path_add_device(libinput2, + libevdev_uinput_get_devnode(dev->uinput)); + litest_drain_events(libinput2); + + if (axis == ABS_X) + x = 30; + else + y = 30; + litest_touch_down(dev, 0, x, y); + litest_touch_move_to(dev, 0, x, y, 80, 80, 10, 1); + litest_touch_up(dev, 0); + libinput_dispatch(libinput1); + libinput_dispatch(libinput2); + + litest_wait_for_event(libinput1); + litest_wait_for_event(libinput2); + + while (libinput_next_event_type(libinput1)) { + ev1 = libinput_get_event(libinput1); + ev2 = libinput_get_event(libinput2); + + p1 = litest_is_motion_event(ev1); + p2 = litest_is_motion_event(ev2); + + ck_assert_int_eq(libinput_event_get_type(ev1), + libinput_event_get_type(ev2)); + + ck_assert_int_eq(libinput_event_pointer_get_dx(p1), + libinput_event_pointer_get_dx(p2)); + ck_assert_int_eq(libinput_event_pointer_get_dy(p1), + libinput_event_pointer_get_dy(p2)); + libinput_event_destroy(ev1); + libinput_event_destroy(ev2); + } + + libinput_unref(libinput2); +} +END_TEST + +static inline bool +has_disable_while_typing(struct litest_device *device) +{ + return libinput_device_config_dwt_is_available(device->libinput_device); +} + +START_TEST(touchpad_dwt) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + libinput_dispatch(li); + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); + litest_touch_up(touchpad, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + /* within timeout - no events */ + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); + litest_touch_up(touchpad, 0); + litest_assert_empty_queue(li); + + litest_timeout_dwt_short(); + libinput_dispatch(li); + + /* after timeout - motion events*/ + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); + litest_touch_up(touchpad, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_enable_touch) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + libinput_dispatch(li); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + /* finger down after last key event, but + we're still within timeout - no events */ + msleep(10); + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); + litest_assert_empty_queue(li); + + litest_timeout_dwt_short(); + libinput_dispatch(li); + + /* same touch after timeout - motion events*/ + litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 10, 1); + litest_touch_up(touchpad, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_touch_hold) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + msleep(1); /* make sure touch starts after key press */ + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + /* touch still down - no events */ + litest_keyboard_key(keyboard, KEY_A, false); + libinput_dispatch(li); + litest_touch_move_to(touchpad, 0, 70, 50, 30, 50, 5, 1); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + /* touch still down - no events */ + litest_timeout_dwt_short(); + libinput_dispatch(li); + litest_touch_move_to(touchpad, 0, 30, 50, 50, 50, 5, 1); + litest_touch_up(touchpad, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_key_hold) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + libinput_dispatch(li); + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); + litest_touch_up(touchpad, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_type) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + int i; + + if (!has_disable_while_typing(touchpad)) + return; + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + for (i = 0; i < 5; i++) { + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + libinput_dispatch(li); + } + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); + litest_touch_up(touchpad, 0); + litest_assert_empty_queue(li); + + litest_timeout_dwt_long(); + libinput_dispatch(li); + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); + litest_touch_up(touchpad, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_type_short_timeout) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + int i; + + if (!has_disable_while_typing(touchpad)) + return; + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + for (i = 0; i < 5; i++) { + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + libinput_dispatch(li); + } + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); + litest_touch_up(touchpad, 0); + litest_assert_empty_queue(li); + + litest_timeout_dwt_short(); + libinput_dispatch(li); + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); + litest_touch_up(touchpad, 0); + litest_assert_empty_queue(li); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_tap) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_enable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + libinput_dispatch(li); + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_up(touchpad, 0); + + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_timeout_dwt_short(); + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_up(touchpad, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_tap_drag) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_enable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + libinput_dispatch(li); + msleep(1); /* make sure touch starts after key press */ + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_up(touchpad, 0); + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5, 1); + + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_timeout_dwt_short(); + libinput_dispatch(li); + litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 5, 1); + litest_touch_up(touchpad, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_click) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_touch_down(touchpad, 0, 50, 50); + litest_button_click(touchpad, BTN_LEFT, true); + litest_button_click(touchpad, BTN_LEFT, false); + libinput_dispatch(li); + litest_touch_up(touchpad, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); + + litest_keyboard_key(keyboard, KEY_A, false); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_edge_scroll) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + litest_enable_edge_scroll(touchpad); + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_touch_down(touchpad, 0, 99, 20); + libinput_dispatch(li); + litest_timeout_edgescroll(); + libinput_dispatch(li); + litest_assert_empty_queue(li); + + /* edge scroll timeout is 300ms atm, make sure we don't accidentally + exit the DWT timeout */ + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + libinput_dispatch(li); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_touch_move_to(touchpad, 0, 99, 20, 99, 80, 60, 10); + libinput_dispatch(li); + litest_assert_empty_queue(li); + + litest_touch_move_to(touchpad, 0, 99, 80, 99, 20, 60, 10); + litest_touch_up(touchpad, 0); + libinput_dispatch(li); + litest_assert_empty_queue(li); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_edge_scroll_interrupt) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + struct libinput_event_pointer *stop_event; + + if (!has_disable_while_typing(touchpad)) + return; + + litest_enable_edge_scroll(touchpad); + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_drain_events(li); + + litest_touch_down(touchpad, 0, 99, 20); + libinput_dispatch(li); + litest_timeout_edgescroll(); + litest_touch_move_to(touchpad, 0, 99, 20, 99, 30, 10, 10); + libinput_dispatch(li); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + + /* scroll stop event */ + litest_wait_for_event(li); + stop_event = litest_is_axis_event(libinput_get_event(li), + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, + LIBINPUT_POINTER_AXIS_SOURCE_FINGER); + libinput_event_destroy(libinput_event_pointer_get_base_event(stop_event)); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_timeout_dwt_long(); + + /* Known bad behavior: a touch starting to edge-scroll before dwt + * kicks in will stop to scroll but be recognized as normal + * pointer-moving touch once the timeout expires. We'll fix that + * when we need to. + */ + litest_touch_move_to(touchpad, 0, 99, 30, 99, 80, 10, 5); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_config_default_on) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_status status; + enum libinput_config_dwt_state state; + + if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM || + libevdev_get_id_bustype(dev->evdev) == BUS_BLUETOOTH) { + ck_assert(!libinput_device_config_dwt_is_available(device)); + return; + } + + ck_assert(libinput_device_config_dwt_is_available(device)); + state = libinput_device_config_dwt_get_enabled(device); + ck_assert_int_eq(state, LIBINPUT_CONFIG_DWT_ENABLED); + state = libinput_device_config_dwt_get_default_enabled(device); + ck_assert_int_eq(state, LIBINPUT_CONFIG_DWT_ENABLED); + + status = libinput_device_config_dwt_set_enabled(device, + LIBINPUT_CONFIG_DWT_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + status = libinput_device_config_dwt_set_enabled(device, + LIBINPUT_CONFIG_DWT_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + status = libinput_device_config_dwt_set_enabled(device, 3); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); +} +END_TEST + +START_TEST(touchpad_dwt_config_default_off) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_status status; + enum libinput_config_dwt_state state; + + ck_assert(!libinput_device_config_dwt_is_available(device)); + state = libinput_device_config_dwt_get_enabled(device); + ck_assert_int_eq(state, LIBINPUT_CONFIG_DWT_DISABLED); + state = libinput_device_config_dwt_get_default_enabled(device); + ck_assert_int_eq(state, LIBINPUT_CONFIG_DWT_DISABLED); + + status = libinput_device_config_dwt_set_enabled(device, + LIBINPUT_CONFIG_DWT_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); + status = libinput_device_config_dwt_set_enabled(device, + LIBINPUT_CONFIG_DWT_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + status = libinput_device_config_dwt_set_enabled(device, 3); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); +} +END_TEST + +static inline void +disable_dwt(struct litest_device *dev) +{ + enum libinput_config_status status, + expected = LIBINPUT_CONFIG_STATUS_SUCCESS; + status = libinput_device_config_dwt_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_DWT_DISABLED); + litest_assert_int_eq(status, expected); +} + +static inline void +enable_dwt(struct litest_device *dev) +{ + enum libinput_config_status status, + expected = LIBINPUT_CONFIG_STATUS_SUCCESS; + status = libinput_device_config_dwt_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_DWT_ENABLED); + litest_assert_int_eq(status, expected); +} + +START_TEST(touchpad_dwt_disabled) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + disable_dwt(touchpad); + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); + litest_touch_up(touchpad, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_disable_during_touch) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + enable_dwt(touchpad); + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); + litest_assert_empty_queue(li); + + disable_dwt(touchpad); + + /* touch already down -> keeps being ignored */ + litest_touch_move_to(touchpad, 0, 70, 50, 50, 70, 10, 1); + litest_touch_up(touchpad, 0); + + litest_assert_empty_queue(li); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_disable_before_touch) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + enable_dwt(touchpad); + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + disable_dwt(touchpad); + libinput_dispatch(li); + + /* touch down during timeout -> still discarded */ + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); + litest_assert_empty_queue(li); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_enable_during_touch) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + disable_dwt(touchpad); + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + enable_dwt(touchpad); + + /* touch already down -> still sends events */ + litest_touch_move_to(touchpad, 0, 70, 50, 50, 70, 10, 1); + litest_touch_up(touchpad, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_enable_before_touch) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + disable_dwt(touchpad); + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + enable_dwt(touchpad); + libinput_dispatch(li); + + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_delete_device(keyboard); +} +END_TEST + +START_TEST(touchpad_dwt_enable_during_tap) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard; + struct libinput *li = touchpad->libinput; + + if (!has_disable_while_typing(touchpad)) + return; + + litest_enable_tap(touchpad->libinput_device); + disable_dwt(touchpad); + + keyboard = litest_add_device(li, LITEST_KEYBOARD); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); + litest_keyboard_key(keyboard, KEY_A, false); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); + + litest_touch_down(touchpad, 0, 50, 50); + libinput_dispatch(li); + enable_dwt(touchpad); + libinput_dispatch(li); + litest_touch_up(touchpad, 0); + libinput_dispatch(li); + + litest_timeout_tap(); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); + + litest_touch_down(touchpad, 0, 50, 50); + litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); + litest_touch_up(touchpad, 0); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_delete_device(keyboard); +} +END_TEST +static int +has_thumb_detect(struct litest_device *dev) +{ + double w, h; + + if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_PRESSURE)) + return 0; + + if (libinput_device_get_size(dev->libinput_device, &w, &h) != 0) + return 0; + + return h >= 50.0; +} + +START_TEST(touchpad_thumb_begin_no_motion) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct axis_replacement axes[] = { + { ABS_MT_PRESSURE, 190 }, + { -1, 0 } + }; + + if (!has_thumb_detect(dev)) + return; + + litest_disable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down_extended(dev, 0, 50, 99, axes); + litest_touch_move_to(dev, 0, 50, 99, 80, 99, 10, 0); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_thumb_update_no_motion) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct axis_replacement axes[] = { + { ABS_MT_PRESSURE, 190 }, + { -1, 0 } + }; + + litest_disable_tap(dev->libinput_device); + litest_enable_clickfinger(dev); + + if (!has_thumb_detect(dev)) + return; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 59, 99); + litest_touch_move_extended(dev, 0, 59, 99, axes); + litest_touch_move_to(dev, 0, 60, 99, 80, 99, 10, 0); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_thumb_moving) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct axis_replacement axes[] = { + { ABS_MT_PRESSURE, 190 }, + { -1, 0 } + }; + + litest_disable_tap(dev->libinput_device); + litest_enable_clickfinger(dev); + + if (!has_thumb_detect(dev)) + return; + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 99); + litest_touch_move_to(dev, 0, 50, 99, 60, 99, 10, 0); + litest_touch_move_extended(dev, 0, 65, 99, axes); + litest_touch_move_to(dev, 0, 65, 99, 80, 99, 10, 0); + litest_touch_up(dev, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); +} +END_TEST + +START_TEST(touchpad_thumb_clickfinger) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + struct axis_replacement axes[] = { + { ABS_MT_PRESSURE, 190 }, + { -1, 0 } + }; + + if (!has_thumb_detect(dev)) + return; + + litest_disable_tap(dev->libinput_device); + + libinput_device_config_click_set_method(dev->libinput_device, + LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 99); + litest_touch_down(dev, 1, 60, 99); + litest_touch_move_extended(dev, 0, 55, 99, axes); + litest_button_click(dev, BTN_LEFT, true); + + libinput_dispatch(li); + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + libinput_event_destroy(libinput_event_pointer_get_base_event(ptrev)); + + litest_assert_empty_queue(li); + + litest_button_click(dev, BTN_LEFT, false); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 99); + litest_touch_down(dev, 1, 60, 99); + litest_touch_move_extended(dev, 1, 65, 99, axes); + litest_button_click(dev, BTN_LEFT, true); + + libinput_dispatch(li); + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + libinput_event_destroy(libinput_event_pointer_get_base_event(ptrev)); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_thumb_btnarea) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + struct axis_replacement axes[] = { + { ABS_MT_PRESSURE, 190 }, + { -1, 0 } + }; + + if (!has_thumb_detect(dev)) + return; + + litest_disable_tap(dev->libinput_device); + + libinput_device_config_click_set_method(dev->libinput_device, + LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 90, 99); + litest_touch_move_extended(dev, 0, 95, 99, axes); + litest_button_click(dev, BTN_LEFT, true); + + /* button areas work as usual with a thumb */ + + libinput_dispatch(li); + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + libinput_event_destroy(libinput_event_pointer_get_base_event(ptrev)); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_thumb_edgescroll) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct axis_replacement axes[] = { + { ABS_MT_PRESSURE, 190 }, + { -1, 0 } + }; + + if (!has_thumb_detect(dev)) + return; + + litest_enable_edge_scroll(dev); + litest_disable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 99, 30); + litest_touch_move_to(dev, 0, 99, 30, 99, 50, 10, 0); + litest_drain_events(li); + + litest_touch_move_extended(dev, 0, 99, 55, axes); + libinput_dispatch(li); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); + + litest_touch_move_to(dev, 0, 99, 55, 99, 70, 10, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS); +} +END_TEST + +START_TEST(touchpad_thumb_tap_begin) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct axis_replacement axes[] = { + { ABS_MT_PRESSURE, 190 }, + { -1, 0 } + }; + + if (!has_thumb_detect(dev)) + return; + + litest_enable_tap(dev->libinput_device); + litest_enable_clickfinger(dev); + litest_drain_events(li); + + /* touch down is a thumb */ + litest_touch_down_extended(dev, 0, 50, 99, axes); + litest_touch_up(dev, 0); + libinput_dispatch(li); + litest_timeout_tap(); + + litest_assert_empty_queue(li); + + /* make sure normal tap still works */ + litest_touch_down(dev, 0, 50, 99); + litest_touch_up(dev, 0); + libinput_dispatch(li); + litest_timeout_tap(); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); +} +END_TEST + +START_TEST(touchpad_thumb_tap_touch) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct axis_replacement axes[] = { + { ABS_MT_PRESSURE, 190 }, + { -1, 0 } + }; + + if (!has_thumb_detect(dev)) + return; + + litest_enable_tap(dev->libinput_device); + litest_enable_clickfinger(dev); + litest_drain_events(li); + + /* event after touch down is thumb */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_extended(dev, 0, 51, 99, axes); + litest_touch_up(dev, 0); + libinput_dispatch(li); + litest_timeout_tap(); + litest_assert_empty_queue(li); + + /* make sure normal tap still works */ + litest_touch_down(dev, 0, 50, 99); + litest_touch_up(dev, 0); + libinput_dispatch(li); + litest_timeout_tap(); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); +} +END_TEST + +START_TEST(touchpad_thumb_tap_hold) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct axis_replacement axes[] = { + { ABS_MT_PRESSURE, 190 }, + { -1, 0 } + }; + + if (!has_thumb_detect(dev)) + return; + + litest_enable_tap(dev->libinput_device); + litest_enable_clickfinger(dev); + litest_drain_events(li); + + /* event in state HOLD is thumb */ + litest_touch_down(dev, 0, 50, 99); + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); + litest_touch_move_extended(dev, 0, 51, 99, axes); + litest_touch_up(dev, 0); + litest_assert_empty_queue(li); + + /* make sure normal tap still works */ + litest_touch_down(dev, 0, 50, 99); + litest_touch_up(dev, 0); + libinput_dispatch(li); + litest_timeout_tap(); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); +} +END_TEST + +START_TEST(touchpad_thumb_tap_hold_2ndfg) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct axis_replacement axes[] = { + { ABS_MT_PRESSURE, 190 }, + { -1, 0 } + }; + + if (!has_thumb_detect(dev)) + return; + + litest_enable_tap(dev->libinput_device); + litest_enable_clickfinger(dev); + litest_drain_events(li); + + /* event in state HOLD is thumb */ + litest_touch_down(dev, 0, 50, 99); + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); + litest_touch_move_extended(dev, 0, 51, 99, axes); + + litest_assert_empty_queue(li); + + /* one finger is a thumb, now get second finger down */ + litest_touch_down(dev, 1, 60, 50); + litest_assert_empty_queue(li); + + /* release thumb */ + litest_touch_up(dev, 0); + litest_assert_empty_queue(li); + + /* timeout -> into HOLD, no event on release */ + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); + litest_touch_up(dev, 1); + litest_assert_empty_queue(li); + + /* make sure normal tap still works */ + litest_touch_down(dev, 0, 50, 99); + litest_touch_up(dev, 0); + libinput_dispatch(li); + litest_timeout_tap(); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); +} +END_TEST + +START_TEST(touchpad_thumb_tap_hold_2ndfg_tap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + struct axis_replacement axes[] = { + { ABS_MT_PRESSURE, 190 }, + { -1, 0 } + }; + + if (!has_thumb_detect(dev)) + return; + + litest_enable_tap(dev->libinput_device); + litest_drain_events(li); + + /* event in state HOLD is thumb */ + litest_touch_down(dev, 0, 50, 99); + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); + litest_touch_move_extended(dev, 0, 51, 99, axes); + + litest_assert_empty_queue(li); + + /* one finger is a thumb, now get second finger down */ + litest_touch_down(dev, 1, 60, 50); + litest_assert_empty_queue(li); + + /* release thumb */ + litest_touch_up(dev, 0); + litest_assert_empty_queue(li); + + /* release second finger, within timeout, ergo event */ + litest_touch_up(dev, 1); + libinput_dispatch(li); + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + libinput_event_destroy(libinput_event_pointer_get_base_event(ptrev)); + + libinput_dispatch(li); + litest_timeout_tap(); + libinput_dispatch(li); + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + libinput_event_destroy(libinput_event_pointer_get_base_event(ptrev)); + + /* make sure normal tap still works */ + litest_touch_down(dev, 0, 50, 99); + litest_touch_up(dev, 0); + libinput_dispatch(li); + litest_timeout_tap(); + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); +} +END_TEST + +START_TEST(touchpad_tool_tripletap_touch_count) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + + /* Synaptics touchpads sometimes end one touch point while + * simultaneously setting BTN_TOOL_TRIPLETAP. + * https://bugs.freedesktop.org/show_bug.cgi?id=91352 + */ + litest_drain_events(li); + litest_enable_clickfinger(dev); + + /* touch 1 down */ + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 1); + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 1200); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3200); + litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 78); + litest_event(dev, EV_ABS, ABS_X, 1200); + litest_event(dev, EV_ABS, ABS_Y, 3200); + litest_event(dev, EV_ABS, ABS_PRESSURE, 78); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); + litest_event(dev, EV_KEY, BTN_TOUCH, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + msleep(2); + + /* touch 2 down */ + litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 1); + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 2200); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3200); + litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 73); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + msleep(2); + + /* touch 3 down, coordinate jump + ends slot 1 */ + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 4000); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 4000); + litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 78); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_ABS, ABS_X, 4000); + litest_event(dev, EV_ABS, ABS_Y, 4000); + litest_event(dev, EV_ABS, ABS_PRESSURE, 78); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + msleep(2); + + /* slot 2 reactivated: + * Note, slot is activated close enough that we don't accidentally + * trigger the clickfinger distance check, remains to be seen if + * that is true for real-world interaction. + */ + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 4000); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 4000); + litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 78); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 3); + litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 3500); + litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3500); + litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 73); + litest_event(dev, EV_ABS, ABS_X, 4000); + litest_event(dev, EV_ABS, ABS_Y, 4000); + litest_event(dev, EV_ABS, ABS_PRESSURE, 78); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + msleep(2); + + /* now a click should trigger middle click */ + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + litest_wait_for_event(li); + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + libinput_event_destroy(event); + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + /* silence gcc set-but-not-used warning, litest_is_button_event + * checks what we care about */ + event = libinput_event_pointer_get_base_event(ptrev); + libinput_event_destroy(event); + + /* release everything */ + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOUCH, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); +} +END_TEST + +START_TEST(touchpad_time_usec) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + + litest_disable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 80, 50, 5, 0); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + event = libinput_get_event(li); + ck_assert_notnull(event); + + while (event) { + uint64_t utime; + + ptrev = litest_is_motion_event(event); + utime = libinput_event_pointer_get_time_usec(ptrev); + + ck_assert_int_eq(libinput_event_pointer_get_time(ptrev), + utime / 1000); + libinput_event_destroy(event); + event = libinput_get_event(li); + } +} +END_TEST + +void +litest_setup_tests(void) +{ + struct range axis_range = {ABS_X, ABS_Y + 1}; + + litest_add("touchpad:motion", touchpad_1fg_motion, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:motion", touchpad_2fg_no_motion, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + + litest_add("touchpad:scroll", touchpad_2fg_scroll, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:scroll", touchpad_2fg_scroll_slow_distance, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:scroll", touchpad_2fg_scroll_return_to_motion, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:scroll", touchpad_2fg_scroll_source, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:scroll", touchpad_2fg_scroll_semi_mt, LITEST_SEMI_MT, LITEST_SINGLE_TOUCH); + litest_add("touchpad:scroll", touchpad_scroll_natural_defaults, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_scroll_natural_enable_config, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_scroll_natural_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:scroll", touchpad_scroll_defaults, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_edge_scroll, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_edge_scroll_no_motion, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_edge_scroll_no_edge_after_motion, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_edge_scroll_timeout, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_edge_scroll_source, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_edge_scroll_no_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:scroll", touchpad_edge_scroll_into_buttonareas, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_edge_scroll_within_buttonareas, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_edge_scroll_buttonareas_click_stops_scroll, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_edge_scroll_clickfinger_click_stops_scroll, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:scroll", touchpad_edge_scroll_into_area, LITEST_TOUCHPAD, LITEST_ANY); + + litest_add("touchpad:palm", touchpad_palm_detect_at_edge, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:palm", touchpad_palm_detect_at_bottom_corners, LITEST_TOUCHPAD, LITEST_CLICKPAD); + litest_add("touchpad:palm", touchpad_palm_detect_at_top_corners, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); + litest_add("touchpad:palm", touchpad_palm_detect_palm_becomes_pointer, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:palm", touchpad_palm_detect_palm_stays_palm, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:palm", touchpad_palm_detect_no_palm_moving_into_edges, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:palm", touchpad_palm_detect_tap, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:palm", touchpad_no_palm_detect_at_edge_for_edge_scrolling, LITEST_TOUCHPAD, LITEST_CLICKPAD); + + litest_add("touchpad:left-handed", touchpad_left_handed, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); + litest_add("touchpad:left-handed", touchpad_left_handed_clickpad, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + litest_add("touchpad:left-handed", touchpad_left_handed_clickfinger, LITEST_APPLE_CLICKPAD, LITEST_ANY); + litest_add("touchpad:left-handed", touchpad_left_handed_tapping, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:left-handed", touchpad_left_handed_tapping_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:left-handed", touchpad_left_handed_delayed, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); + litest_add("touchpad:left-handed", touchpad_left_handed_clickpad_delayed, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); + + /* Semi-MT hover tests aren't generic, they only work on this device and + * ignore the semi-mt capability (it doesn't matter for the tests */ + litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_noevent, LITEST_SYNAPTICS_HOVER_SEMI_MT); + litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_down, LITEST_SYNAPTICS_HOVER_SEMI_MT); + litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_down_up, LITEST_SYNAPTICS_HOVER_SEMI_MT); + litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_down_hover_down, LITEST_SYNAPTICS_HOVER_SEMI_MT); + litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_2fg_noevent, LITEST_SYNAPTICS_HOVER_SEMI_MT); + litest_add_for_device("touchpad:semi-mt-hover", touchpad_semi_mt_hover_2fg_1fg_down, LITEST_SYNAPTICS_HOVER_SEMI_MT); + + litest_add("touchpad:hover", touchpad_hover_noevent, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); + litest_add("touchpad:hover", touchpad_hover_down, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); + litest_add("touchpad:hover", touchpad_hover_down_up, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); + litest_add("touchpad:hover", touchpad_hover_down_hover_down, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); + litest_add("touchpad:hover", touchpad_hover_2fg_noevent, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); + litest_add("touchpad:hover", touchpad_hover_2fg_1fg_down, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); + + litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_buttons, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); + litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_mb_scroll, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); + litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_mb_click, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); + litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_buttons_softbuttons, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); + litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_buttons_2fg_scroll, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); + litest_add_for_device("touchpad:trackpoint", touchpad_trackpoint_no_trackpoint, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); + + litest_add_ranged("touchpad:state", touchpad_initial_state, LITEST_TOUCHPAD, LITEST_ANY, &axis_range); + + litest_add("touchpad:dwt", touchpad_dwt, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_enable_touch, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_touch_hold, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_key_hold, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_type, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_type_short_timeout, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_tap, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_tap_drag, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_click, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_edge_scroll, LITEST_TOUCHPAD, LITEST_CLICKPAD); + litest_add("touchpad:dwt", touchpad_dwt_edge_scroll_interrupt, LITEST_TOUCHPAD, LITEST_CLICKPAD); + litest_add("touchpad:dwt", touchpad_dwt_config_default_on, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_config_default_off, LITEST_ANY, LITEST_TOUCHPAD); + litest_add("touchpad:dwt", touchpad_dwt_disabled, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_disable_during_touch, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_disable_before_touch, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_enable_during_touch, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_enable_before_touch, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_enable_during_tap, LITEST_TOUCHPAD, LITEST_ANY); + + litest_add("touchpad:thumb", touchpad_thumb_begin_no_motion, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:thumb", touchpad_thumb_update_no_motion, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:thumb", touchpad_thumb_moving, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:thumb", touchpad_thumb_clickfinger, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:thumb", touchpad_thumb_btnarea, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:thumb", touchpad_thumb_edgescroll, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:thumb", touchpad_thumb_tap_begin, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:thumb", touchpad_thumb_tap_touch, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:thumb", touchpad_thumb_tap_hold, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:thumb", touchpad_thumb_tap_hold_2ndfg, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:thumb", touchpad_thumb_tap_hold_2ndfg_tap, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH); + + litest_add_for_device("touchpad:bugs", touchpad_tool_tripletap_touch_count, LITEST_SYNAPTICS_TOPBUTTONPAD); + + litest_add("touchpad:time", touchpad_time_usec, LITEST_TOUCHPAD, LITEST_ANY); +} diff -Nru libinput-1.10.3/test/touchpad-tap.c libinput-0.21.0/test/touchpad-tap.c --- libinput-1.10.3/test/touchpad-tap.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/touchpad-tap.c 2015-08-03 04:35:00.000000000 +0000 @@ -0,0 +1,1795 @@ +/* + * Copyright © 2014-2015 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include + +#include +#include +#include +#include +#include + +#include "libinput-util.h" +#include "litest.h" + +START_TEST(touchpad_1fg_tap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_timeout_tap(); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + libinput_dispatch(li); + event = libinput_get_event(li); + ck_assert(event == NULL); +} +END_TEST + +START_TEST(touchpad_1fg_doubletap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + uint32_t oldtime, curtime; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + litest_timeout_tap(); + + libinput_dispatch(li); + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + oldtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_le(oldtime, curtime); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_lt(oldtime, curtime); + oldtime = curtime; + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_le(oldtime, curtime); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_multitap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + uint32_t oldtime = 0, + curtime; + int range = _i, /* looped test */ + ntaps; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + libinput_dispatch(li); + msleep(10); + } + + litest_timeout_tap(); + libinput_dispatch(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_gt(curtime, oldtime); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_ge(curtime, oldtime); + oldtime = curtime; + } + litest_timeout_tap(); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_multitap_n_drag_move) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + uint32_t oldtime = 0, + curtime; + int range = _i, /* looped test */ + ntaps; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + libinput_dispatch(li); + msleep(10); + } + + libinput_dispatch(li); + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4); + libinput_dispatch(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_gt(curtime, oldtime); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_ge(curtime, oldtime); + oldtime = curtime; + } + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_gt(curtime, oldtime); + + litest_assert_only_typed_events(li, + LIBINPUT_EVENT_POINTER_MOTION); + + litest_touch_up(dev, 0); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_multitap_n_drag_2fg) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + uint32_t oldtime = 0, + curtime; + int range = _i, + ntaps; + + if (litest_is_synaptics_semi_mt(dev)) + return; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + libinput_dispatch(li); + msleep(10); + } + + libinput_dispatch(li); + litest_touch_down(dev, 0, 50, 50); + msleep(10); + litest_touch_down(dev, 1, 70, 50); + libinput_dispatch(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_gt(curtime, oldtime); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_ge(curtime, oldtime); + oldtime = curtime; + } + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_gt(curtime, oldtime); + + litest_touch_move_to(dev, 1, 70, 50, 90, 50, 10, 4); + + litest_assert_only_typed_events(li, + LIBINPUT_EVENT_POINTER_MOTION); + + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + litest_timeout_tap(); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_multitap_n_drag_click) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + uint32_t oldtime = 0, + curtime; + int range = _i, /* looped test */ + ntaps; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + libinput_dispatch(li); + msleep(10); + } + + litest_touch_down(dev, 0, 50, 50); + libinput_dispatch(li); + litest_button_click(dev, BTN_LEFT, true); + litest_button_click(dev, BTN_LEFT, false); + libinput_dispatch(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_gt(curtime, oldtime); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_ge(curtime, oldtime); + oldtime = curtime; + } + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_touch_up(dev, 0); + litest_timeout_tap(); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_multitap_n_drag_timeout) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + uint32_t oldtime = 0, + curtime; + int range = _i, /* looped test */ + ntaps; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + libinput_dispatch(li); + msleep(10); + } + + libinput_dispatch(li); + litest_touch_down(dev, 0, 50, 50); + libinput_dispatch(li); + + litest_timeout_tap(); + libinput_dispatch(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_gt(curtime, oldtime); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_ge(curtime, oldtime); + oldtime = curtime; + } + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_gt(curtime, oldtime); + + litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4); + + litest_assert_only_typed_events(li, + LIBINPUT_EVENT_POINTER_MOTION); + + litest_touch_up(dev, 0); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_multitap_n_drag_tap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + uint32_t oldtime = 0, + curtime; + int range = _i, /* looped test */ + ntaps; + + litest_enable_tap(dev->libinput_device); + litest_enable_drag_lock(dev->libinput_device); + + litest_drain_events(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + libinput_dispatch(li); + msleep(10); + } + + libinput_dispatch(li); + litest_touch_down(dev, 0, 50, 50); + libinput_dispatch(li); + + litest_timeout_tap(); + libinput_dispatch(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_gt(curtime, oldtime); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_ge(curtime, oldtime); + oldtime = curtime; + } + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_gt(curtime, oldtime); + + litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4); + + litest_assert_only_typed_events(li, + LIBINPUT_EVENT_POINTER_MOTION); + + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 70, 50); + litest_touch_up(dev, 0); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_multitap_n_drag_tap_click) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + uint32_t oldtime = 0, + curtime; + int range = _i, /* looped test */ + ntaps; + + litest_enable_tap(dev->libinput_device); + litest_enable_drag_lock(dev->libinput_device); + + litest_drain_events(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + libinput_dispatch(li); + msleep(10); + } + + libinput_dispatch(li); + litest_touch_down(dev, 0, 50, 50); + libinput_dispatch(li); + + litest_timeout_tap(); + libinput_dispatch(li); + + for (ntaps = 0; ntaps <= range; ntaps++) { + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_gt(curtime, oldtime); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_ge(curtime, oldtime); + oldtime = curtime; + } + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + curtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + ck_assert_int_gt(curtime, oldtime); + + litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10, 4); + + litest_assert_only_typed_events(li, + LIBINPUT_EVENT_POINTER_MOTION); + + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 70, 50); + litest_button_click(dev, BTN_LEFT, true); + litest_button_click(dev, BTN_LEFT, false); + libinput_dispatch(li); + + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + /* the physical click */ + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_tap_n_drag) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev __attribute__((unused)); + + litest_enable_tap(dev->libinput_device); + litest_disable_drag_lock(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + libinput_dispatch(li); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_touch_up(dev, 0); + + /* don't use helper functions here, we expect the event be available + * immediately, not after a timeout that the helper functions may + * trigger. + */ + libinput_dispatch(li); + event = libinput_get_event(li); + ck_assert_notnull(event); + ptrev = litest_is_button_event(event, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + libinput_event_destroy(event); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_tap_n_drag_draglock) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + litest_enable_drag_lock(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + libinput_dispatch(li); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + /* lift finger, set down again, should continue dragging */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40); + litest_touch_up(dev, 0); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_timeout_tap(); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_tap_n_drag_draglock_tap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + litest_enable_drag_lock(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + libinput_dispatch(li); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + /* lift finger, set down again, should continue dragging */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_tap_n_drag_draglock_tap_click) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + litest_enable_drag_lock(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 80, 80, 5, 40); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + libinput_dispatch(li); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 50, 50); + litest_button_click(dev, BTN_LEFT, true); + litest_button_click(dev, BTN_LEFT, false); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + /* the physical click */ + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, + BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_tap_n_drag_draglock_timeout) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + litest_enable_drag_lock(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 50, 50); + libinput_dispatch(li); + litest_timeout_tap(); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_assert_empty_queue(li); + litest_touch_up(dev, 0); + libinput_dispatch(li); + + litest_timeout_tapndrag(); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_2fg_tap_n_drag) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + litest_disable_drag_lock(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 30, 70); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 30, 70); + litest_touch_down(dev, 1, 80, 70); + litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_2fg_tap_n_drag_3fg_btntool) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) > 2) + return; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 30, 70); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 30, 70); + litest_touch_down(dev, 1, 80, 90); + litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + /* Putting down a third finger should end the drag */ + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + /* Releasing the fingers should not cause any events */ + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_2fg_tap_n_drag_3fg) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) <= 2) + return; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 30, 70); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 30, 70); + litest_touch_down(dev, 1, 80, 90); + litest_touch_move_to(dev, 0, 30, 70, 30, 30, 5, 40); + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + /* Putting down a third finger should end the drag */ + litest_touch_down(dev, 2, 50, 50); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + /* Releasing the fingers should not cause any events */ + litest_touch_up(dev, 2); + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_2fg_tap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(dev->libinput); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 70); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_timeout_tap(); + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_2fg_tap_inverted) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(dev->libinput); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 70); + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_timeout_tap(); + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_2fg_tap_quickrelease) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(dev->libinput); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 70); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOUCH, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_timeout_tap(); + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_tap_click) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(dev->libinput); + + /* Finger down, finger up -> tap button press + * Physical button click -> no button press/release + * Tap timeout -> tap button release */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + libinput_dispatch(li); + litest_timeout_tap(); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_2fg_tap_click) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(dev->libinput); + + /* two fingers down, left button click, fingers up + -> one left button, one right button event pair */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 50); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_2fg_tap_click) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(dev->libinput); + + /* two fingers down, button click, fingers up + -> only one button left event pair */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 50); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_2fg_tap_click_apple) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(dev->libinput); + + /* two fingers down, button click, fingers up + -> only one button right event pair + (apple have clickfinger enabled by default) */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 50); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_RIGHT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_no_2fg_tap_after_move) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + litest_drain_events(dev->libinput); + + /* one finger down, move past threshold, + second finger down, first finger up + -> no event + */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 90, 90, 10, 0); + litest_drain_events(dev->libinput); + + litest_touch_down(dev, 1, 70, 50); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_no_2fg_tap_after_timeout) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + litest_drain_events(dev->libinput); + + /* one finger down, wait past tap timeout, + second finger down, first finger up + -> no event + */ + litest_touch_down(dev, 0, 50, 50); + libinput_dispatch(dev->libinput); + litest_timeout_tap(); + libinput_dispatch(dev->libinput); + litest_drain_events(dev->libinput); + + litest_touch_down(dev, 1, 70, 50); + litest_touch_up(dev, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_no_first_fg_tap_after_move) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(dev->libinput); + + /* one finger down, second finger down, + second finger moves beyond threshold, + first finger up + -> no event + */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 50); + libinput_dispatch(dev->libinput); + litest_touch_move_to(dev, 1, 70, 50, 90, 90, 10, 0); + libinput_dispatch(dev->libinput); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + libinput_dispatch(dev->libinput); + + while ((event = libinput_get_event(li))) { + ck_assert_int_ne(libinput_event_get_type(event), + LIBINPUT_EVENT_POINTER_BUTTON); + libinput_event_destroy(event); + } +} +END_TEST + +START_TEST(touchpad_1fg_double_tap_click) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(dev->libinput); + + /* one finger down, up, down, button click, finger up + -> two button left event pairs */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 50, 50); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_1fg_tap_n_drag_click) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(dev->libinput); + + /* one finger down, up, down, move, button click, finger up + -> two button left event pairs, motion allowed */ + litest_touch_down(dev, 0, 50, 50); + litest_touch_up(dev, 0); + litest_touch_down(dev, 0, 50, 50); + litest_touch_move_to(dev, 0, 50, 50, 80, 50, 10, 0); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); + + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_3fg_tap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + int i; + + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) <= 2) + return; + + litest_enable_tap(dev->libinput_device); + + for (i = 0; i < 3; i++) { + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 50); + litest_touch_down(dev, 2, 80, 50); + + litest_touch_up(dev, (i + 2) % 3); + litest_touch_up(dev, (i + 1) % 3); + litest_touch_up(dev, (i + 0) % 3); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_timeout_tap(); + litest_assert_button_event(li, BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + + libinput_dispatch(li); + event = libinput_get_event(li); + ck_assert(event == NULL); + } +} +END_TEST + +START_TEST(touchpad_3fg_tap_quickrelease) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) <= 2) + return; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 50); + litest_touch_down(dev, 2, 80, 50); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 2); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOUCH, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_timeout_tap(); + litest_assert_button_event(li, BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + + libinput_dispatch(li); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_3fg_tap_btntool) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) > 2) + return; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 50); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 1); + litest_touch_up(dev, 0); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_timeout_tap(); + litest_assert_button_event(li, BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + + libinput_dispatch(li); + event = libinput_get_event(li); + ck_assert(event == NULL); +} +END_TEST + +START_TEST(touchpad_3fg_tap_btntool_inverted) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) > 2) + return; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 50); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); + litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + litest_touch_up(dev, 1); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_timeout_tap(); + litest_assert_button_event(li, BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + + libinput_dispatch(li); + event = libinput_get_event(li); + ck_assert(event == NULL); +} +END_TEST + +START_TEST(touchpad_4fg_tap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + int i; + + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) <= 3) + return; + + litest_enable_tap(dev->libinput_device); + + for (i = 0; i < 4; i++) { + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 50); + litest_touch_down(dev, 2, 80, 50); + litest_touch_down(dev, 3, 90, 50); + + litest_touch_up(dev, (i + 3) % 4); + litest_touch_up(dev, (i + 2) % 4); + litest_touch_up(dev, (i + 1) % 4); + litest_touch_up(dev, (i + 0) % 4); + + libinput_dispatch(li); + litest_assert_empty_queue(li); + litest_timeout_tap(); + litest_assert_empty_queue(li); + event = libinput_get_event(li); + ck_assert(event == NULL); + } +} +END_TEST + +START_TEST(touchpad_4fg_tap_quickrelease) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) <= 3) + return; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 50, 50); + litest_touch_down(dev, 1, 70, 50); + litest_touch_down(dev, 2, 80, 50); + litest_touch_down(dev, 3, 90, 50); + + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 2); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 3); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 0); + litest_event(dev, EV_KEY, BTN_TOUCH, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + litest_assert_empty_queue(li); + litest_timeout_tap(); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_5fg_tap) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + int i; + + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) <= 4) + return; + + litest_enable_tap(dev->libinput_device); + + for (i = 0; i < 5; i++) { + litest_drain_events(li); + + litest_touch_down(dev, 0, 20, 50); + litest_touch_down(dev, 1, 30, 50); + litest_touch_down(dev, 2, 40, 50); + litest_touch_down(dev, 3, 50, 50); + litest_touch_down(dev, 4, 60, 50); + + litest_touch_up(dev, (i + 4) % 5); + litest_touch_up(dev, (i + 3) % 5); + litest_touch_up(dev, (i + 2) % 5); + litest_touch_up(dev, (i + 1) % 5); + litest_touch_up(dev, (i + 0) % 5); + + libinput_dispatch(li); + litest_assert_empty_queue(li); + litest_timeout_tap(); + litest_assert_empty_queue(li); + event = libinput_get_event(li); + ck_assert(event == NULL); + } +} +END_TEST + +START_TEST(touchpad_5fg_tap_quickrelease) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + if (libevdev_get_abs_maximum(dev->evdev, + ABS_MT_SLOT) <= 4) + return; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(li); + + litest_touch_down(dev, 0, 20, 50); + litest_touch_down(dev, 1, 30, 50); + litest_touch_down(dev, 2, 40, 50); + litest_touch_down(dev, 3, 70, 50); + litest_touch_down(dev, 4, 90, 50); + + litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 2); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 3); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_ABS, ABS_MT_SLOT, 4); + litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); + litest_event(dev, EV_KEY, BTN_TOOL_QUINTTAP, 0); + litest_event(dev, EV_KEY, BTN_TOUCH, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + + libinput_dispatch(li); + litest_assert_empty_queue(li); + litest_timeout_tap(); + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(clickpad_1fg_tap_click) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_enable_tap(dev->libinput_device); + + litest_drain_events(dev->libinput); + + /* finger down, button click, finger up + -> only one button left event pair */ + litest_touch_down(dev, 0, 50, 50); + litest_event(dev, EV_KEY, BTN_LEFT, 1); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_event(dev, EV_KEY, BTN_LEFT, 0); + litest_event(dev, EV_SYN, SYN_REPORT, 0); + litest_touch_up(dev, 0); + libinput_dispatch(li); + litest_timeout_tap(); + + libinput_dispatch(li); + + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_PRESSED); + litest_assert_button_event(li, BTN_LEFT, + LIBINPUT_BUTTON_STATE_RELEASED); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(touchpad_tap_is_available) +{ + struct litest_device *dev = litest_current_device(); + + ck_assert_int_ge(libinput_device_config_tap_get_finger_count(dev->libinput_device), 1); +} +END_TEST + +START_TEST(touchpad_tap_is_not_available) +{ + struct litest_device *dev = litest_current_device(); + + ck_assert_int_eq(libinput_device_config_tap_get_finger_count(dev->libinput_device), 0); + ck_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device), + LIBINPUT_CONFIG_TAP_DISABLED); + ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_ENABLED), + LIBINPUT_CONFIG_STATUS_UNSUPPORTED); + ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, + LIBINPUT_CONFIG_TAP_DISABLED), + LIBINPUT_CONFIG_STATUS_SUCCESS); +} +END_TEST + +START_TEST(touchpad_tap_default_disabled) +{ + struct litest_device *dev = litest_current_device(); + + /* this test is only run on specific devices */ + + ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device), + LIBINPUT_CONFIG_TAP_DISABLED); +} +END_TEST + +START_TEST(touchpad_tap_default_enabled) +{ + struct litest_device *dev = litest_current_device(); + + /* this test is only run on specific devices */ + + ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device), + LIBINPUT_CONFIG_TAP_ENABLED); +} +END_TEST + +START_TEST(touchpad_tap_invalid) +{ + struct litest_device *dev = litest_current_device(); + + ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, 2), + LIBINPUT_CONFIG_STATUS_INVALID); + ck_assert_int_eq(libinput_device_config_tap_set_enabled(dev->libinput_device, -1), + LIBINPUT_CONFIG_STATUS_INVALID); +} +END_TEST + +START_TEST(touchpad_drag_lock_default_disabled) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_status status; + + ck_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device), + LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); + ck_assert_int_eq(libinput_device_config_tap_get_default_drag_lock_enabled(device), + LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); + + status = libinput_device_config_tap_set_drag_lock_enabled(device, + LIBINPUT_CONFIG_DRAG_LOCK_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + status = libinput_device_config_tap_set_drag_lock_enabled(device, + LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + status = libinput_device_config_tap_set_drag_lock_enabled(device, + LIBINPUT_CONFIG_DRAG_LOCK_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + status = libinput_device_config_tap_set_drag_lock_enabled(device, + 3); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); +} +END_TEST + +START_TEST(touchpad_drag_lock_default_unavailable) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + enum libinput_config_status status; + + ck_assert_int_eq(libinput_device_config_tap_get_drag_lock_enabled(device), + LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); + ck_assert_int_eq(libinput_device_config_tap_get_default_drag_lock_enabled(device), + LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); + + status = libinput_device_config_tap_set_drag_lock_enabled(device, + LIBINPUT_CONFIG_DRAG_LOCK_ENABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); + + status = libinput_device_config_tap_set_drag_lock_enabled(device, + LIBINPUT_CONFIG_DRAG_LOCK_DISABLED); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); + + status = libinput_device_config_tap_set_drag_lock_enabled(device, + 3); + ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); +} +END_TEST + +void +litest_setup_tests(void) +{ + struct range multitap_range = {3, 8}; + + litest_add("touchpad:tap", touchpad_1fg_tap, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:tap", touchpad_1fg_doubletap, LITEST_TOUCHPAD, LITEST_ANY); + litest_add_ranged("touchpad:tap", touchpad_1fg_multitap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); + litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_timeout, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); + litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_tap, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); + litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_move, LITEST_TOUCHPAD, LITEST_ANY, &multitap_range); + litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &multitap_range); + litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY, &multitap_range); + litest_add("touchpad:tap", touchpad_1fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_draglock, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_draglock_tap, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_draglock_timeout, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:tap", touchpad_2fg_tap_n_drag, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_2fg_tap_n_drag_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD); + litest_add("touchpad:tap", touchpad_2fg_tap_n_drag_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_2fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); + litest_add("touchpad:tap", touchpad_2fg_tap_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_2fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); + litest_add("touchpad:tap", touchpad_1fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); + litest_add("touchpad:tap", touchpad_2fg_tap_click, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_SINGLE_TOUCH|LITEST_CLICKPAD); + + litest_add("touchpad:tap", touchpad_2fg_tap_click_apple, LITEST_APPLE_CLICKPAD, LITEST_ANY); + litest_add("touchpad:tap", touchpad_no_2fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); + litest_add("touchpad:tap", touchpad_no_2fg_tap_after_timeout, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); + litest_add("touchpad:tap", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_no_first_fg_tap_after_move, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_3fg_tap_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_3fg_tap_btntool_inverted, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_3fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_3fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); + litest_add("touchpad:tap", touchpad_4fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); + litest_add("touchpad:tap", touchpad_4fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); + litest_add("touchpad:tap", touchpad_5fg_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); + litest_add("touchpad:tap", touchpad_5fg_tap_quickrelease, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); + + /* Real buttons don't interfere with tapping, so don't run those for + pads with buttons */ + litest_add("touchpad:tap", touchpad_1fg_double_tap_click, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY); + litest_add_ranged("touchpad:tap", touchpad_1fg_multitap_n_drag_tap_click, LITEST_CLICKPAD, LITEST_ANY, &multitap_range); + litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_draglock_tap_click, LITEST_CLICKPAD, LITEST_ANY); + + litest_add("touchpad:tap", touchpad_tap_default_disabled, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_ANY); + litest_add("touchpad:tap", touchpad_tap_default_enabled, LITEST_TOUCHPAD, LITEST_BUTTON); + litest_add("touchpad:tap", touchpad_tap_invalid, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:tap", touchpad_tap_is_available, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:tap", touchpad_tap_is_not_available, LITEST_ANY, LITEST_TOUCHPAD); + + litest_add("touchpad:tap", clickpad_1fg_tap_click, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:tap", clickpad_2fg_tap_click, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH|LITEST_APPLE_CLICKPAD); + + litest_add("touchpad:tap", touchpad_drag_lock_default_disabled, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:tap", touchpad_drag_lock_default_unavailable, LITEST_ANY, LITEST_TOUCHPAD); + +} diff -Nru libinput-1.10.3/test/trackpoint.c libinput-0.21.0/test/trackpoint.c --- libinput-1.10.3/test/trackpoint.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/trackpoint.c 2015-07-15 04:18:08.000000000 +0000 @@ -0,0 +1,160 @@ +/* + * Copyright © 2014 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include + +#include +#include +#include +#include +#include + +#include "libinput-util.h" +#include "litest.h" + +START_TEST(trackpoint_middlebutton) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + uint64_t ptime, rtime; + + litest_drain_events(li); + + /* A quick middle button click should get reported normally */ + litest_button_click(dev, BTN_MIDDLE, 1); + msleep(2); + litest_button_click(dev, BTN_MIDDLE, 0); + + litest_wait_for_event(li); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_PRESSED); + ptime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + + event = libinput_get_event(li); + ptrev = litest_is_button_event(event, + BTN_MIDDLE, + LIBINPUT_BUTTON_STATE_RELEASED); + rtime = libinput_event_pointer_get_time(ptrev); + libinput_event_destroy(event); + + ck_assert_int_lt(ptime, rtime); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(trackpoint_scroll) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + + litest_drain_events(li); + + litest_button_scroll(dev, BTN_MIDDLE, 1, 6); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, 6); + litest_button_scroll(dev, BTN_MIDDLE, 1, -7); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, -7); + litest_button_scroll(dev, BTN_MIDDLE, 8, 1); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, 8); + litest_button_scroll(dev, BTN_MIDDLE, -9, 1); + litest_assert_scroll(li, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -9); + + /* scroll smaller than the threshold should not generate events */ + litest_button_scroll(dev, BTN_MIDDLE, 1, 1); + /* long middle press without movement should not generate events */ + litest_button_scroll(dev, BTN_MIDDLE, 0, 0); + + litest_assert_empty_queue(li); +} +END_TEST + +START_TEST(trackpoint_middlebutton_noscroll) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + + /* Disable middle button scrolling */ + libinput_device_config_scroll_set_method(dev->libinput_device, + LIBINPUT_CONFIG_SCROLL_NO_SCROLL); + + litest_drain_events(li); + + /* A long middle button click + motion should get reported normally now */ + litest_button_scroll(dev, BTN_MIDDLE, 0, 10); + + litest_assert_button_event(li, BTN_MIDDLE, 1); + + event = libinput_get_event(li); + ck_assert(event != NULL); + ck_assert_int_eq(libinput_event_get_type(event), LIBINPUT_EVENT_POINTER_MOTION); + libinput_event_destroy(event); + + litest_assert_button_event(li, BTN_MIDDLE, 0); + + litest_assert_empty_queue(li); + + /* Restore default scroll behavior */ + libinput_device_config_scroll_set_method(dev->libinput_device, + libinput_device_config_scroll_get_default_method( + dev->libinput_device)); +} +END_TEST + +START_TEST(trackpoint_scroll_source) +{ + struct litest_device *dev = litest_current_device(); + struct libinput *li = dev->libinput; + struct libinput_event *event; + struct libinput_event_pointer *ptrev; + + litest_drain_events(li); + + litest_button_scroll(dev, BTN_MIDDLE, 0, 6); + litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS, -1); + + while ((event = libinput_get_event(li))) { + ptrev = libinput_event_get_pointer_event(event); + + ck_assert_int_eq(libinput_event_pointer_get_axis_source(ptrev), + LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS); + + libinput_event_destroy(event); + } +} +END_TEST + +void +litest_setup_tests(void) +{ + litest_add("trackpoint:middlebutton", trackpoint_middlebutton, LITEST_POINTINGSTICK, LITEST_ANY); + litest_add("trackpoint:middlebutton", trackpoint_middlebutton_noscroll, LITEST_POINTINGSTICK, LITEST_ANY); + litest_add("trackpoint:scroll", trackpoint_scroll, LITEST_POINTINGSTICK, LITEST_ANY); + litest_add("trackpoint:scroll", trackpoint_scroll_source, LITEST_POINTINGSTICK, LITEST_ANY); +} diff -Nru libinput-1.10.3/test/udev.c libinput-0.21.0/test/udev.c --- libinput-1.10.3/test/udev.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test/udev.c 2015-07-28 22:12:38.000000000 +0000 @@ -0,0 +1,526 @@ +/* + * Copyright © 2013 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "litest.h" + +static int open_restricted(const char *path, int flags, void *data) +{ + int fd; + fd = open(path, flags); + return fd < 0 ? -errno : fd; +} +static void close_restricted(int fd, void *data) +{ + close(fd); +} + +const struct libinput_interface simple_interface = { + .open_restricted = open_restricted, + .close_restricted = close_restricted, +}; + +START_TEST(udev_create_NULL) +{ + struct libinput *li; + const struct libinput_interface interface; + struct udev *udev; + + udev = udev_new(); + + li = libinput_udev_create_context(NULL, NULL, NULL); + ck_assert(li == NULL); + + li = libinput_udev_create_context(&interface, NULL, NULL); + ck_assert(li == NULL); + + li = libinput_udev_create_context(NULL, NULL, udev); + ck_assert(li == NULL); + + li = libinput_udev_create_context(&interface, NULL, udev); + ck_assert(li != NULL); + ck_assert_int_eq(libinput_udev_assign_seat(li, NULL), -1); + + libinput_unref(li); + udev_unref(udev); +} +END_TEST + +START_TEST(udev_create_seat0) +{ + struct libinput *li; + struct libinput_event *event; + struct udev *udev; + int fd; + + udev = udev_new(); + ck_assert(udev != NULL); + + li = libinput_udev_create_context(&simple_interface, NULL, udev); + ck_assert(li != NULL); + ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); + + fd = libinput_get_fd(li); + ck_assert_int_ge(fd, 0); + + /* expect at least one event */ + libinput_dispatch(li); + event = libinput_get_event(li); + ck_assert(event != NULL); + + libinput_event_destroy(event); + libinput_unref(li); + udev_unref(udev); +} +END_TEST + +START_TEST(udev_create_empty_seat) +{ + struct libinput *li; + struct libinput_event *event; + struct udev *udev; + int fd; + + udev = udev_new(); + ck_assert(udev != NULL); + + /* expect a libinput reference, but no events */ + li = libinput_udev_create_context(&simple_interface, NULL, udev); + ck_assert(li != NULL); + ck_assert_int_eq(libinput_udev_assign_seat(li, "seatdoesntexist"), 0); + + fd = libinput_get_fd(li); + ck_assert_int_ge(fd, 0); + + libinput_dispatch(li); + event = libinput_get_event(li); + ck_assert(event == NULL); + + libinput_event_destroy(event); + libinput_unref(li); + udev_unref(udev); +} +END_TEST + +START_TEST(udev_set_user_data) +{ + struct libinput *li; + struct udev *udev; + int data1, data2; + + udev = udev_new(); + ck_assert(udev != NULL); + + li = libinput_udev_create_context(&simple_interface, &data1, udev); + ck_assert(li != NULL); + ck_assert(libinput_get_user_data(li) == &data1); + libinput_set_user_data(li, &data2); + ck_assert(libinput_get_user_data(li) == &data2); + + libinput_unref(li); + udev_unref(udev); +} +END_TEST + +/** + * This test only works if there's at least one device in the system that is + * assigned the default seat. Should cover the 99% case. + */ +START_TEST(udev_added_seat_default) +{ + struct libinput *li; + struct libinput_event *event; + struct udev *udev; + struct libinput_device *device; + struct libinput_seat *seat; + const char *seat_name; + enum libinput_event_type type; + int default_seat_found = 0; + + udev = udev_new(); + ck_assert(udev != NULL); + + li = libinput_udev_create_context(&simple_interface, NULL, udev); + ck_assert(li != NULL); + ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); + libinput_dispatch(li); + + while (!default_seat_found && (event = libinput_get_event(li))) { + type = libinput_event_get_type(event); + if (type != LIBINPUT_EVENT_DEVICE_ADDED) { + libinput_event_destroy(event); + continue; + } + + device = libinput_event_get_device(event); + seat = libinput_device_get_seat(device); + ck_assert(seat != NULL); + + seat_name = libinput_seat_get_logical_name(seat); + default_seat_found = streq(seat_name, "default"); + libinput_event_destroy(event); + } + + ck_assert(default_seat_found); + + libinput_unref(li); + udev_unref(udev); +} +END_TEST + +/** + * This test only works if there's at least one device in the system that is + * assigned the default seat. Should cover the 99% case. + */ +START_TEST(udev_change_seat) +{ + struct libinput *li; + struct udev *udev; + struct libinput_event *event; + struct libinput_device *device; + struct libinput_seat *seat1, *seat2; + const char *seat1_name; + const char *seat2_name = "new seat"; + int rc; + + udev = udev_new(); + ck_assert(udev != NULL); + + li = libinput_udev_create_context(&simple_interface, NULL, udev); + ck_assert(li != NULL); + ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); + libinput_dispatch(li); + + event = libinput_get_event(li); + ck_assert(event != NULL); + + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_DEVICE_ADDED); + + device = libinput_event_get_device(event); + libinput_device_ref(device); + + seat1 = libinput_device_get_seat(device); + libinput_seat_ref(seat1); + + seat1_name = libinput_seat_get_logical_name(seat1); + libinput_event_destroy(event); + + litest_drain_events(li); + + rc = libinput_device_set_seat_logical_name(device, + seat2_name); + ck_assert_int_eq(rc, 0); + + libinput_dispatch(li); + + event = libinput_get_event(li); + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_DEVICE_REMOVED); + + ck_assert(libinput_event_get_device(event) == device); + libinput_event_destroy(event); + + event = libinput_get_event(li); + ck_assert_int_eq(libinput_event_get_type(event), + LIBINPUT_EVENT_DEVICE_ADDED); + ck_assert(libinput_event_get_device(event) != device); + libinput_device_unref(device); + + device = libinput_event_get_device(event); + seat2 = libinput_device_get_seat(device); + + ck_assert_str_ne(libinput_seat_get_logical_name(seat2), + seat1_name); + ck_assert_str_eq(libinput_seat_get_logical_name(seat2), + seat2_name); + libinput_event_destroy(event); + + libinput_seat_unref(seat1); + + libinput_unref(li); + udev_unref(udev); +} +END_TEST + +START_TEST(udev_double_suspend) +{ + struct libinput *li; + struct libinput_event *event; + struct udev *udev; + int fd; + + udev = udev_new(); + ck_assert(udev != NULL); + + li = libinput_udev_create_context(&simple_interface, NULL, udev); + ck_assert(li != NULL); + ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); + + fd = libinput_get_fd(li); + ck_assert_int_ge(fd, 0); + + /* expect at least one event */ + ck_assert_int_ge(libinput_dispatch(li), 0); + event = libinput_get_event(li); + ck_assert(event != NULL); + + libinput_suspend(li); + libinput_suspend(li); + libinput_resume(li); + + libinput_event_destroy(event); + libinput_unref(li); + udev_unref(udev); +} +END_TEST + +START_TEST(udev_double_resume) +{ + struct libinput *li; + struct libinput_event *event; + struct udev *udev; + int fd; + + udev = udev_new(); + ck_assert(udev != NULL); + + li = libinput_udev_create_context(&simple_interface, NULL, udev); + ck_assert(li != NULL); + ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); + + fd = libinput_get_fd(li); + ck_assert_int_ge(fd, 0); + + /* expect at least one event */ + ck_assert_int_ge(libinput_dispatch(li), 0); + event = libinput_get_event(li); + ck_assert(event != NULL); + + libinput_suspend(li); + libinput_resume(li); + libinput_resume(li); + + libinput_event_destroy(event); + libinput_unref(li); + udev_unref(udev); +} +END_TEST + +static void +process_events_count_devices(struct libinput *li, int *device_count) +{ + struct libinput_event *event; + + while ((event = libinput_get_event(li))) { + switch (libinput_event_get_type(event)) { + case LIBINPUT_EVENT_DEVICE_ADDED: + (*device_count)++; + break; + case LIBINPUT_EVENT_DEVICE_REMOVED: + (*device_count)--; + break; + default: + break; + } + libinput_event_destroy(event); + } +} + +START_TEST(udev_suspend_resume) +{ + struct libinput *li; + struct udev *udev; + int fd; + int num_devices = 0; + + udev = udev_new(); + ck_assert(udev != NULL); + + li = libinput_udev_create_context(&simple_interface, NULL, udev); + ck_assert(li != NULL); + ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); + + fd = libinput_get_fd(li); + ck_assert_int_ge(fd, 0); + + /* Check that at least one device was discovered after creation. */ + ck_assert_int_ge(libinput_dispatch(li), 0); + process_events_count_devices(li, &num_devices); + ck_assert_int_gt(num_devices, 0); + + /* Check that after a suspend, no devices are left. */ + libinput_suspend(li); + ck_assert_int_ge(libinput_dispatch(li), 0); + process_events_count_devices(li, &num_devices); + ck_assert_int_eq(num_devices, 0); + + /* Check that after a resume, at least one device is discovered. */ + libinput_resume(li); + ck_assert_int_ge(libinput_dispatch(li), 0); + process_events_count_devices(li, &num_devices); + ck_assert_int_gt(num_devices, 0); + + libinput_unref(li); + udev_unref(udev); +} +END_TEST + +START_TEST(udev_device_sysname) +{ + struct libinput *li; + struct libinput_event *ev; + struct libinput_device *device; + const char *sysname; + struct udev *udev; + + udev = udev_new(); + ck_assert(udev != NULL); + + li = libinput_udev_create_context(&simple_interface, NULL, udev); + ck_assert(li != NULL); + ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); + + libinput_dispatch(li); + + while ((ev = libinput_get_event(li))) { + if (libinput_event_get_type(ev) != + LIBINPUT_EVENT_DEVICE_ADDED) { + libinput_event_destroy(ev); + continue; + } + + device = libinput_event_get_device(ev); + sysname = libinput_device_get_sysname(device); + ck_assert(sysname != NULL && strlen(sysname) > 1); + ck_assert(strchr(sysname, '/') == NULL); + ck_assert_int_eq(strncmp(sysname, "event", 5), 0); + libinput_event_destroy(ev); + } + + libinput_unref(li); + udev_unref(udev); +} +END_TEST + +START_TEST(udev_seat_recycle) +{ + struct udev *udev; + struct libinput *li; + struct libinput_event *ev; + struct libinput_device *device; + struct libinput_seat *saved_seat = NULL; + struct libinput_seat *seat; + int data = 0; + int found = 0; + void *user_data; + + udev = udev_new(); + ck_assert(udev != NULL); + + li = libinput_udev_create_context(&simple_interface, NULL, udev); + ck_assert(li != NULL); + ck_assert_int_eq(libinput_udev_assign_seat(li, "seat0"), 0); + + libinput_dispatch(li); + while ((ev = libinput_get_event(li))) { + switch (libinput_event_get_type(ev)) { + case LIBINPUT_EVENT_DEVICE_ADDED: + if (saved_seat) + break; + + device = libinput_event_get_device(ev); + ck_assert(device != NULL); + saved_seat = libinput_device_get_seat(device); + libinput_seat_set_user_data(saved_seat, &data); + libinput_seat_ref(saved_seat); + break; + default: + break; + } + + libinput_event_destroy(ev); + } + + ck_assert(saved_seat != NULL); + + libinput_suspend(li); + + litest_drain_events(li); + + libinput_resume(li); + + libinput_dispatch(li); + while ((ev = libinput_get_event(li))) { + switch (libinput_event_get_type(ev)) { + case LIBINPUT_EVENT_DEVICE_ADDED: + device = libinput_event_get_device(ev); + ck_assert(device != NULL); + + seat = libinput_device_get_seat(device); + user_data = libinput_seat_get_user_data(seat); + if (user_data == &data) { + found = 1; + ck_assert(seat == saved_seat); + } + break; + default: + break; + } + + libinput_event_destroy(ev); + } + + ck_assert(found == 1); + + libinput_unref(li); + udev_unref(udev); +} +END_TEST + +void +litest_setup_tests(void) +{ + litest_add_no_device("udev:create", udev_create_NULL); + litest_add_no_device("udev:create", udev_create_seat0); + litest_add_no_device("udev:create", udev_create_empty_seat); + litest_add_no_device("udev:create", udev_set_user_data); + + litest_add_no_device("udev:seat", udev_added_seat_default); + litest_add_no_device("udev:seat", udev_change_seat); + + litest_add_for_device("udev:suspend", udev_double_suspend, LITEST_SYNAPTICS_CLICKPAD); + litest_add_for_device("udev:suspend", udev_double_resume, LITEST_SYNAPTICS_CLICKPAD); + litest_add_for_device("udev:suspend", udev_suspend_resume, LITEST_SYNAPTICS_CLICKPAD); + litest_add_for_device("udev:device events", udev_device_sysname, LITEST_SYNAPTICS_CLICKPAD); + litest_add_for_device("udev:seat", udev_seat_recycle, LITEST_SYNAPTICS_CLICKPAD); +} diff -Nru libinput-1.10.3/test/valgrind.suppressions libinput-0.21.0/test/valgrind.suppressions --- libinput-1.10.3/test/valgrind.suppressions 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/test/valgrind.suppressions 2015-07-24 03:24:43.000000000 +0000 @@ -14,24 +14,6 @@ fun:mtdev_put_event } { - - Memcheck:Leak - ... - fun:g_type_register_static -} -{ - - Memcheck:Leak - ... - fun:g_type_register_fundamental -} -{ - - Memcheck:Leak - ... - fun:g_malloc0 -} -{ libunwind:msync_uninitialized_bytes Memcheck:Param msync(start) @@ -39,16 +21,3 @@ ... fun:litest_backtrace } -{ - python:PyUnicode_New - Memcheck:Leak - ... - obj:/usr/lib*/libpython3*.so* -} -{ - libevdev:grab - Memcheck:Param - ioctl(generic) - fun:ioctl - fun:libevdev_grab -} diff -Nru libinput-1.10.3/test-driver libinput-0.21.0/test-driver --- libinput-1.10.3/test-driver 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/test-driver 2015-08-04 00:31:40.000000000 +0000 @@ -0,0 +1,148 @@ +#! /bin/sh +# test-driver - basic testsuite driver script. + +scriptversion=2013-07-13.22; # UTC + +# Copyright (C) 2011-2014 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +# Make unconditional expansion of undefined variables an error. This +# helps a lot in preventing typo-related bugs. +set -u + +usage_error () +{ + echo "$0: $*" >&2 + print_usage >&2 + exit 2 +} + +print_usage () +{ + cat <$log_file 2>&1 +estatus=$? + +if test $enable_hard_errors = no && test $estatus -eq 99; then + tweaked_estatus=1 +else + tweaked_estatus=$estatus +fi + +case $tweaked_estatus:$expect_failure in + 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; + 0:*) col=$grn res=PASS recheck=no gcopy=no;; + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; + 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; + *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; + *:*) col=$red res=FAIL recheck=yes gcopy=yes;; +esac + +# Report the test outcome and exit status in the logs, so that one can +# know whether the test passed or failed simply by looking at the '.log' +# file, without the need of also peaking into the corresponding '.trs' +# file (automake bug#11814). +echo "$res $test_name (exit status: $estatus)" >>$log_file + +# Report outcome to console. +echo "${col}${res}${std}: $test_name" + +# Register the test result, and other relevant metadata. +echo ":test-result: $res" > $trs_file +echo ":global-test-result: $res" >> $trs_file +echo ":recheck: $recheck" >> $trs_file +echo ":copy-in-global-log: $gcopy" >> $trs_file + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -Nru libinput-1.10.3/tools/event-debug.c libinput-0.21.0/tools/event-debug.c --- libinput-1.10.3/tools/event-debug.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/tools/event-debug.c 2015-07-31 01:50:42.000000000 +0000 @@ -0,0 +1,491 @@ +/* + * Copyright © 2014 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "linux/input.h" +#include + +#include +#include + +#include "shared.h" + +uint32_t start_time; +static const uint32_t screen_width = 100; +static const uint32_t screen_height = 100; +struct tools_context context; +static unsigned int stop = 0; + +static void +print_event_header(struct libinput_event *ev) +{ + struct libinput_device *dev = libinput_event_get_device(ev); + const char *type = NULL; + + switch(libinput_event_get_type(ev)) { + case LIBINPUT_EVENT_NONE: + abort(); + case LIBINPUT_EVENT_DEVICE_ADDED: + type = "DEVICE_ADDED"; + break; + case LIBINPUT_EVENT_DEVICE_REMOVED: + type = "DEVICE_REMOVED"; + break; + case LIBINPUT_EVENT_KEYBOARD_KEY: + type = "KEYBOARD_KEY"; + break; + case LIBINPUT_EVENT_POINTER_MOTION: + type = "POINTER_MOTION"; + break; + case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: + type = "POINTER_MOTION_ABSOLUTE"; + break; + case LIBINPUT_EVENT_POINTER_BUTTON: + type = "POINTER_BUTTON"; + break; + case LIBINPUT_EVENT_POINTER_AXIS: + type = "POINTER_AXIS"; + break; + case LIBINPUT_EVENT_TOUCH_DOWN: + type = "TOUCH_DOWN"; + break; + case LIBINPUT_EVENT_TOUCH_MOTION: + type = "TOUCH_MOTION"; + break; + case LIBINPUT_EVENT_TOUCH_UP: + type = "TOUCH_UP"; + break; + case LIBINPUT_EVENT_TOUCH_CANCEL: + type = "TOUCH_CANCEL"; + break; + case LIBINPUT_EVENT_TOUCH_FRAME: + type = "TOUCH_FRAME"; + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN: + type = "GESTURE_SWIPE_BEGIN"; + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: + type = "GESTURE_SWIPE_UPDATE"; + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_END: + type = "GESTURE_SWIPE_END"; + break; + case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN: + type = "GESTURE_PINCH_BEGIN"; + break; + case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE: + type = "GESTURE_PINCH_UPDATE"; + break; + case LIBINPUT_EVENT_GESTURE_PINCH_END: + type = "GESTURE_PINCH_END"; + break; + } + + printf("%-7s %s ", libinput_device_get_sysname(dev), type); +} + +static void +print_event_time(uint32_t time) +{ + printf("%+6.2fs ", (time - start_time) / 1000.0); +} + +static void +print_device_notify(struct libinput_event *ev) +{ + struct libinput_device *dev = libinput_event_get_device(ev); + struct libinput_seat *seat = libinput_device_get_seat(dev); + struct libinput_device_group *group; + double w, h; + uint32_t scroll_methods, click_methods; + static int next_group_id = 0; + intptr_t group_id; + + group = libinput_device_get_device_group(dev); + group_id = (intptr_t)libinput_device_group_get_user_data(group); + if (!group_id) { + group_id = ++next_group_id; + libinput_device_group_set_user_data(group, (void*)group_id); + } + + printf("%-33s %5s %7s group%d", + libinput_device_get_name(dev), + libinput_seat_get_physical_name(seat), + libinput_seat_get_logical_name(seat), + (int)group_id); + + printf(" cap:"); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_KEYBOARD)) + printf("k"); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_POINTER)) + printf("p"); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_TOUCH)) + printf("t"); + if (libinput_device_has_capability(dev, + LIBINPUT_DEVICE_CAP_GESTURE)) + printf("g"); + + if (libinput_device_get_size(dev, &w, &h) == 0) + printf("\tsize %.2f/%.2fmm", w, h); + + if (libinput_device_config_tap_get_finger_count(dev)) { + printf(" tap"); + if (libinput_device_config_tap_get_drag_lock_enabled(dev)) + printf("(dl on)"); + else + printf("(dl off)"); + } + if (libinput_device_config_left_handed_is_available(dev)) + printf(" left"); + if (libinput_device_config_scroll_has_natural_scroll(dev)) + printf(" scroll-nat"); + if (libinput_device_config_calibration_has_matrix(dev)) + printf(" calib"); + + scroll_methods = libinput_device_config_scroll_get_methods(dev); + if (scroll_methods != LIBINPUT_CONFIG_SCROLL_NO_SCROLL) { + printf(" scroll"); + if (scroll_methods & LIBINPUT_CONFIG_SCROLL_2FG) + printf("-2fg"); + if (scroll_methods & LIBINPUT_CONFIG_SCROLL_EDGE) + printf("-edge"); + if (scroll_methods & LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) + printf("-button"); + } + + click_methods = libinput_device_config_click_get_methods(dev); + if (click_methods != LIBINPUT_CONFIG_CLICK_METHOD_NONE) { + printf(" click"); + if (click_methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS) + printf("-buttonareas"); + if (click_methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER) + printf("-clickfinger"); + } + + if (libinput_device_config_dwt_is_available(dev)) { + if (libinput_device_config_dwt_get_enabled(dev) == + LIBINPUT_CONFIG_DWT_ENABLED) + printf(" dwt-on"); + else + printf(" dwt-off)"); + } + + printf("\n"); + +} + +static void +print_key_event(struct libinput_event *ev) +{ + struct libinput_event_keyboard *k = libinput_event_get_keyboard_event(ev); + enum libinput_key_state state; + uint32_t key; + const char *keyname; + + print_event_time(libinput_event_keyboard_get_time(k)); + state = libinput_event_keyboard_get_key_state(k); + + key = libinput_event_keyboard_get_key(k); + keyname = libevdev_event_code_get_name(EV_KEY, key); + printf("%s (%d) %s\n", + keyname ? keyname : "???", + key, + state == LIBINPUT_KEY_STATE_PRESSED ? "pressed" : "released"); +} + +static void +print_motion_event(struct libinput_event *ev) +{ + struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); + double x = libinput_event_pointer_get_dx(p); + double y = libinput_event_pointer_get_dy(p); + + print_event_time(libinput_event_pointer_get_time(p)); + + printf("%6.2f/%6.2f\n", x, y); +} + +static void +print_absmotion_event(struct libinput_event *ev) +{ + struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); + double x = libinput_event_pointer_get_absolute_x_transformed( + p, screen_width); + double y = libinput_event_pointer_get_absolute_y_transformed( + p, screen_height); + + print_event_time(libinput_event_pointer_get_time(p)); + printf("%6.2f/%6.2f\n", x, y); +} + +static void +print_button_event(struct libinput_event *ev) +{ + struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); + enum libinput_button_state state; + + print_event_time(libinput_event_pointer_get_time(p)); + + state = libinput_event_pointer_get_button_state(p); + printf("%3d %s, seat count: %u\n", + libinput_event_pointer_get_button(p), + state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released", + libinput_event_pointer_get_seat_button_count(p)); +} + +static void +print_axis_event(struct libinput_event *ev) +{ + struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); + double v = 0, h = 0; + + if (libinput_event_pointer_has_axis(p, + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) + v = libinput_event_pointer_get_axis_value(p, + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); + if (libinput_event_pointer_has_axis(p, + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) + h = libinput_event_pointer_get_axis_value(p, + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL); + print_event_time(libinput_event_pointer_get_time(p)); + printf("vert %.2f horiz %.2f\n", v, h); +} + +static void +print_touch_event_without_coords(struct libinput_event *ev) +{ + struct libinput_event_touch *t = libinput_event_get_touch_event(ev); + + print_event_time(libinput_event_touch_get_time(t)); + printf("\n"); +} + +static void +print_touch_event_with_coords(struct libinput_event *ev) +{ + struct libinput_event_touch *t = libinput_event_get_touch_event(ev); + double x = libinput_event_touch_get_x_transformed(t, screen_width); + double y = libinput_event_touch_get_y_transformed(t, screen_height); + double xmm = libinput_event_touch_get_x(t); + double ymm = libinput_event_touch_get_y(t); + + print_event_time(libinput_event_touch_get_time(t)); + + printf("%d (%d) %5.2f/%5.2f (%5.2f/%5.2fmm)\n", + libinput_event_touch_get_slot(t), + libinput_event_touch_get_seat_slot(t), + x, y, + xmm, ymm); +} + +static void +print_gesture_event_without_coords(struct libinput_event *ev) +{ + struct libinput_event_gesture *t = libinput_event_get_gesture_event(ev); + int finger_count = libinput_event_gesture_get_finger_count(t); + int cancelled = 0; + enum libinput_event_type type; + + type = libinput_event_get_type(ev); + + if (type == LIBINPUT_EVENT_GESTURE_SWIPE_END || + type == LIBINPUT_EVENT_GESTURE_PINCH_END) + cancelled = libinput_event_gesture_get_cancelled(t); + + print_event_time(libinput_event_gesture_get_time(t)); + printf("%d%s\n", finger_count, cancelled ? " cancelled" : ""); +} + +static void +print_gesture_event_with_coords(struct libinput_event *ev) +{ + struct libinput_event_gesture *t = libinput_event_get_gesture_event(ev); + double dx = libinput_event_gesture_get_dx(t); + double dy = libinput_event_gesture_get_dy(t); + double dx_unaccel = libinput_event_gesture_get_dx_unaccelerated(t); + double dy_unaccel = libinput_event_gesture_get_dy_unaccelerated(t); + + print_event_time(libinput_event_gesture_get_time(t)); + + printf("%d %5.2f/%5.2f (%5.2f/%5.2f unaccelerated)", + libinput_event_gesture_get_finger_count(t), + dx, dy, dx_unaccel, dy_unaccel); + + if (libinput_event_get_type(ev) == + LIBINPUT_EVENT_GESTURE_PINCH_UPDATE) { + double scale = libinput_event_gesture_get_scale(t); + double angle = libinput_event_gesture_get_angle_delta(t); + + printf(" %5.2f @ %5.2f\n", scale, angle); + } else { + printf("\n"); + } +} + +static int +handle_and_print_events(struct libinput *li) +{ + int rc = -1; + struct libinput_event *ev; + + libinput_dispatch(li); + while ((ev = libinput_get_event(li))) { + print_event_header(ev); + + switch (libinput_event_get_type(ev)) { + case LIBINPUT_EVENT_NONE: + abort(); + case LIBINPUT_EVENT_DEVICE_ADDED: + case LIBINPUT_EVENT_DEVICE_REMOVED: + print_device_notify(ev); + tools_device_apply_config(libinput_event_get_device(ev), + &context.options); + break; + case LIBINPUT_EVENT_KEYBOARD_KEY: + print_key_event(ev); + break; + case LIBINPUT_EVENT_POINTER_MOTION: + print_motion_event(ev); + break; + case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: + print_absmotion_event(ev); + break; + case LIBINPUT_EVENT_POINTER_BUTTON: + print_button_event(ev); + break; + case LIBINPUT_EVENT_POINTER_AXIS: + print_axis_event(ev); + break; + case LIBINPUT_EVENT_TOUCH_DOWN: + print_touch_event_with_coords(ev); + break; + case LIBINPUT_EVENT_TOUCH_MOTION: + print_touch_event_with_coords(ev); + break; + case LIBINPUT_EVENT_TOUCH_UP: + print_touch_event_without_coords(ev); + break; + case LIBINPUT_EVENT_TOUCH_CANCEL: + print_touch_event_without_coords(ev); + break; + case LIBINPUT_EVENT_TOUCH_FRAME: + print_touch_event_without_coords(ev); + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN: + print_gesture_event_without_coords(ev); + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: + print_gesture_event_with_coords(ev); + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_END: + print_gesture_event_without_coords(ev); + break; + case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN: + print_gesture_event_without_coords(ev); + break; + case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE: + print_gesture_event_with_coords(ev); + break; + case LIBINPUT_EVENT_GESTURE_PINCH_END: + print_gesture_event_without_coords(ev); + break; + } + + libinput_event_destroy(ev); + libinput_dispatch(li); + rc = 0; + } + return rc; +} + +static void +sighandler(int signal, siginfo_t *siginfo, void *userdata) +{ + stop = 1; +} + +static void +mainloop(struct libinput *li) +{ + struct pollfd fds; + struct sigaction act; + + fds.fd = libinput_get_fd(li); + fds.events = POLLIN; + fds.revents = 0; + + memset(&act, 0, sizeof(act)); + act.sa_sigaction = sighandler; + act.sa_flags = SA_SIGINFO; + + if (sigaction(SIGINT, &act, NULL) == -1) { + fprintf(stderr, "Failed to set up signal handling (%s)\n", + strerror(errno)); + return; + } + + /* Handle already-pending device added events */ + if (handle_and_print_events(li)) + fprintf(stderr, "Expected device added events on startup but got none. " + "Maybe you don't have the right permissions?\n"); + + while (!stop && poll(&fds, 1, -1) > -1) + handle_and_print_events(li); +} + +int +main(int argc, char **argv) +{ + struct libinput *li; + struct timespec tp; + + tools_init_context(&context); + + if (tools_parse_args(argc, argv, &context)) + return 1; + + li = tools_open_backend(&context); + if (!li) + return 1; + + clock_gettime(CLOCK_MONOTONIC, &tp); + start_time = tp.tv_sec * 1000 + tp.tv_nsec / 1000000; + + mainloop(li); + + libinput_unref(li); + + return 0; +} diff -Nru libinput-1.10.3/tools/event-gui.c libinput-0.21.0/tools/event-gui.c --- libinput-1.10.3/tools/event-gui.c 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/tools/event-gui.c 2015-07-31 01:50:42.000000000 +0000 @@ -0,0 +1,662 @@ +/* + * Copyright © 2014 Red Hat, Inc. + * + * 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 (including the next + * paragraph) 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 OR COPYRIGHT HOLDERS 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. + */ +#define _GNU_SOURCE +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "shared.h" + +#define clip(val_, min_, max_) min((max_), max((min_), (val_))) + +struct tools_context context; + +struct touch { + int active; + int x, y; +}; + +struct window { + GtkWidget *win; + GtkWidget *area; + int width, height; /* of window */ + + /* sprite position */ + double x, y; + + /* abs position */ + int absx, absy; + + /* scroll bar positions */ + double vx, vy; + double hx, hy; + + /* touch positions */ + struct touch touches[32]; + + /* l/m/r mouse buttons */ + int l, m, r; + + /* touchpad swipe */ + struct { + int nfingers; + double x, y; + } swipe; + + struct { + int nfingers; + double scale; + double angle; + double x, y; + } pinch; + + struct libinput_device *devices[50]; +}; + +static int +error(const char *fmt, ...) +{ + va_list args; + fprintf(stderr, "error: "); + + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); + + return EXIT_FAILURE; +} + +static void +msg(const char *fmt, ...) +{ + va_list args; + printf("info: "); + + va_start(args, fmt); + vprintf(fmt, args); + va_end(args); +} + +static gboolean +draw(GtkWidget *widget, cairo_t *cr, gpointer data) +{ + struct window *w = data; + struct touch *t; + int i, offset; + + cairo_set_source_rgb(cr, 1, 1, 1); + cairo_rectangle(cr, 0, 0, w->width, w->height); + cairo_fill(cr); + + /* swipe */ + cairo_save(cr); + cairo_translate(cr, w->swipe.x, w->swipe.y); + for (i = 0; i < w->swipe.nfingers; i++) { + cairo_set_source_rgb(cr, .8, .8, .4); + cairo_arc(cr, (i - 2) * 40, 0, 20, 0, 2 * M_PI); + cairo_fill(cr); + } + + for (i = 0; i < 4; i++) { /* 4 fg max */ + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_arc(cr, (i - 2) * 40, 0, 20, 0, 2 * M_PI); + cairo_stroke(cr); + } + cairo_restore(cr); + + /* pinch */ + cairo_save(cr); + offset = w->pinch.scale * 100; + cairo_translate(cr, w->pinch.x, w->pinch.y); + cairo_rotate(cr, w->pinch.angle * M_PI/180.0); + if (w->pinch.nfingers > 0) { + cairo_set_source_rgb(cr, .4, .4, .8); + cairo_arc(cr, offset, -offset, 20, 0, 2 * M_PI); + cairo_arc(cr, -offset, offset, 20, 0, 2 * M_PI); + cairo_fill(cr); + } + + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_arc(cr, offset, -offset, 20, 0, 2 * M_PI); + cairo_stroke(cr); + cairo_arc(cr, -offset, offset, 20, 0, 2 * M_PI); + cairo_stroke(cr); + + cairo_restore(cr); + + /* draw pointer sprite */ + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_save(cr); + cairo_move_to(cr, w->x, w->y); + cairo_rel_line_to(cr, 10, 15); + cairo_rel_line_to(cr, -10, 0); + cairo_rel_line_to(cr, 0, -15); + cairo_fill(cr); + cairo_restore(cr); + + /* draw scroll bars */ + cairo_set_source_rgb(cr, .4, .8, 0); + + cairo_save(cr); + cairo_rectangle(cr, w->vx - 10, w->vy - 20, 20, 40); + cairo_rectangle(cr, w->hx - 20, w->hy - 10, 40, 20); + cairo_fill(cr); + cairo_restore(cr); + + /* touch points */ + cairo_set_source_rgb(cr, .8, .2, .2); + + ARRAY_FOR_EACH(w->touches, t) { + cairo_save(cr); + cairo_arc(cr, t->x, t->y, 10, 0, 2 * M_PI); + cairo_fill(cr); + cairo_restore(cr); + } + + /* abs position */ + cairo_set_source_rgb(cr, .2, .4, .8); + + cairo_save(cr); + cairo_arc(cr, w->absx, w->absy, 10, 0, 2 * M_PI); + cairo_fill(cr); + cairo_restore(cr); + + /* lmr buttons */ + cairo_save(cr); + if (w->l || w->m || w->r) { + cairo_set_source_rgb(cr, .2, .8, .8); + if (w->l) + cairo_rectangle(cr, w->width/2 - 100, w->height - 200, 70, 30); + if (w->m) + cairo_rectangle(cr, w->width/2 - 20, w->height - 200, 40, 30); + if (w->r) + cairo_rectangle(cr, w->width/2 + 30, w->height - 200, 70, 30); + cairo_fill(cr); + } + + cairo_set_source_rgb(cr, 0, 0, 0); + cairo_rectangle(cr, w->width/2 - 100, w->height - 200, 70, 30); + cairo_rectangle(cr, w->width/2 - 20, w->height - 200, 40, 30); + cairo_rectangle(cr, w->width/2 + 30, w->height - 200, 70, 30); + cairo_stroke(cr); + cairo_restore(cr); + + return TRUE; +} + +static void +map_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data) +{ + struct window *w = data; + GdkDisplay *display; + GdkWindow *window; + + gtk_window_get_size(GTK_WINDOW(widget), &w->width, &w->height); + + w->x = w->width/2; + w->y = w->height/2; + + w->vx = w->width/2; + w->vy = w->height/2; + w->hx = w->width/2; + w->hy = w->height/2; + + w->swipe.x = w->width/2; + w->swipe.y = w->height/2; + + w->pinch.scale = 1.0; + w->pinch.x = w->width/2; + w->pinch.y = w->height/2; + + g_signal_connect(G_OBJECT(w->area), "draw", G_CALLBACK(draw), w); + + window = gdk_event_get_window(event); + display = gdk_window_get_display(window); + + gdk_window_set_cursor(gtk_widget_get_window(w->win), + gdk_cursor_new_for_display(display, + GDK_BLANK_CURSOR)); +} + +static void +window_init(struct window *w) +{ + memset(w, 0, sizeof(*w)); + + w->win = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_widget_set_events(w->win, 0); + gtk_window_set_title(GTK_WINDOW(w->win), "libinput debugging tool"); + gtk_window_set_default_size(GTK_WINDOW(w->win), 1024, 768); + gtk_window_maximize(GTK_WINDOW(w->win)); + gtk_window_set_resizable(GTK_WINDOW(w->win), TRUE); + gtk_widget_realize(w->win); + g_signal_connect(G_OBJECT(w->win), "map-event", G_CALLBACK(map_event_cb), w); + g_signal_connect(G_OBJECT(w->win), "delete-event", G_CALLBACK(gtk_main_quit), NULL); + + w->area = gtk_drawing_area_new(); + gtk_widget_set_events(w->area, 0); + gtk_container_add(GTK_CONTAINER(w->win), w->area); + gtk_widget_show_all(w->win); +} + +static void +window_cleanup(struct window *w) +{ + struct libinput_device **dev; + ARRAY_FOR_EACH(w->devices, dev) { + if (*dev) + libinput_device_unref(*dev); + } +} + +static void +change_ptraccel(struct window *w, double amount) +{ + struct libinput_device **dev; + + ARRAY_FOR_EACH(w->devices, dev) { + double speed; + enum libinput_config_status status; + + if (*dev == NULL) + continue; + + if (!libinput_device_config_accel_is_available(*dev)) + continue; + + speed = libinput_device_config_accel_get_speed(*dev); + speed = clip(speed + amount, -1, 1); + + status = libinput_device_config_accel_set_speed(*dev, speed); + + if (status != LIBINPUT_CONFIG_STATUS_SUCCESS) { + msg("%s: failed to change accel to %.2f (%s)\n", + libinput_device_get_name(*dev), + speed, + libinput_config_status_to_str(status)); + } else { + printf("%s: speed is %.2f\n", + libinput_device_get_name(*dev), + speed); + } + + } +} + +static void +handle_event_device_notify(struct libinput_event *ev) +{ + struct tools_context *context; + struct libinput_device *dev = libinput_event_get_device(ev); + struct libinput *li; + struct window *w; + const char *type; + int i; + + if (libinput_event_get_type(ev) == LIBINPUT_EVENT_DEVICE_ADDED) + type = "added"; + else + type = "removed"; + + msg("%s %-30s %s\n", + libinput_device_get_sysname(dev), + libinput_device_get_name(dev), + type); + + li = libinput_event_get_context(ev); + context = libinput_get_user_data(li); + w = context->user_data; + + tools_device_apply_config(libinput_event_get_device(ev), + &context->options); + + if (libinput_event_get_type(ev) == LIBINPUT_EVENT_DEVICE_ADDED) { + for (i = 0; i < ARRAY_LENGTH(w->devices); i++) { + if (w->devices[i] == NULL) { + w->devices[i] = libinput_device_ref(dev); + break; + } + } + } else { + for (i = 0; i < ARRAY_LENGTH(w->devices); i++) { + if (w->devices[i] == dev) { + libinput_device_unref(w->devices[i]); + w->devices[i] = NULL; + break; + } + } + } +} + +static void +handle_event_motion(struct libinput_event *ev, struct window *w) +{ + struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); + double dx = libinput_event_pointer_get_dx(p), + dy = libinput_event_pointer_get_dy(p); + + w->x += dx; + w->y += dy; + w->x = clip(w->x, 0.0, w->width); + w->y = clip(w->y, 0.0, w->height); +} + +static void +handle_event_absmotion(struct libinput_event *ev, struct window *w) +{ + struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); + double x = libinput_event_pointer_get_absolute_x_transformed(p, w->width), + y = libinput_event_pointer_get_absolute_y_transformed(p, w->height); + + w->absx = x; + w->absy = y; +} + +static void +handle_event_touch(struct libinput_event *ev, struct window *w) +{ + struct libinput_event_touch *t = libinput_event_get_touch_event(ev); + int slot = libinput_event_touch_get_seat_slot(t); + struct touch *touch; + double x, y; + + if (slot == -1 || slot >= (int) ARRAY_LENGTH(w->touches)) + return; + + touch = &w->touches[slot]; + + if (libinput_event_get_type(ev) == LIBINPUT_EVENT_TOUCH_UP) { + touch->active = 0; + return; + } + + x = libinput_event_touch_get_x_transformed(t, w->width), + y = libinput_event_touch_get_y_transformed(t, w->height); + + touch->active = 1; + touch->x = (int)x; + touch->y = (int)y; +} + +static void +handle_event_axis(struct libinput_event *ev, struct window *w) +{ + struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); + double value; + + if (libinput_event_pointer_has_axis(p, + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) { + value = libinput_event_pointer_get_axis_value(p, + LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); + w->vy += value; + w->vy = clip(w->vy, 0, w->height); + } + + if (libinput_event_pointer_has_axis(p, + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) { + value = libinput_event_pointer_get_axis_value(p, + LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL); + w->hx += value; + w->hx = clip(w->hx, 0, w->width); + } +} + +static int +handle_event_keyboard(struct libinput_event *ev, struct window *w) +{ + struct libinput_event_keyboard *k = libinput_event_get_keyboard_event(ev); + unsigned int key = libinput_event_keyboard_get_key(k); + + if (libinput_event_keyboard_get_key_state(k) == + LIBINPUT_KEY_STATE_RELEASED) + return 0; + + switch(key) { + case KEY_ESC: + return 1; + case KEY_UP: + change_ptraccel(w, 0.1); + break; + case KEY_DOWN: + change_ptraccel(w, -0.1); + break; + default: + break; + } + + return 0; +} + +static void +handle_event_button(struct libinput_event *ev, struct window *w) +{ + struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); + unsigned int button = libinput_event_pointer_get_button(p); + int is_press; + + is_press = libinput_event_pointer_get_button_state(p) == LIBINPUT_BUTTON_STATE_PRESSED; + + switch (button) { + case BTN_LEFT: + w->l = is_press; + break; + case BTN_RIGHT: + w->r = is_press; + break; + case BTN_MIDDLE: + w->m = is_press; + break; + } + +} + +static void +handle_event_swipe(struct libinput_event *ev, struct window *w) +{ + struct libinput_event_gesture *g = libinput_event_get_gesture_event(ev); + int nfingers; + double dx, dy; + + nfingers = libinput_event_gesture_get_finger_count(g); + + switch (libinput_event_get_type(ev)) { + case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN: + w->swipe.nfingers = nfingers; + w->swipe.x = w->width/2; + w->swipe.y = w->height/2; + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: + dx = libinput_event_gesture_get_dx(g); + dy = libinput_event_gesture_get_dy(g); + w->swipe.x += dx; + w->swipe.y += dy; + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_END: + w->swipe.nfingers = 0; + w->swipe.x = w->width/2; + w->swipe.y = w->height/2; + break; + default: + abort(); + } +} + +static void +handle_event_pinch(struct libinput_event *ev, struct window *w) +{ + struct libinput_event_gesture *g = libinput_event_get_gesture_event(ev); + int nfingers; + double dx, dy; + + nfingers = libinput_event_gesture_get_finger_count(g); + + switch (libinput_event_get_type(ev)) { + case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN: + w->pinch.nfingers = nfingers; + w->pinch.x = w->width/2; + w->pinch.y = w->height/2; + break; + case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE: + dx = libinput_event_gesture_get_dx(g); + dy = libinput_event_gesture_get_dy(g); + w->pinch.x += dx; + w->pinch.y += dy; + w->pinch.scale = libinput_event_gesture_get_scale(g); + w->pinch.angle += libinput_event_gesture_get_angle_delta(g); + break; + case LIBINPUT_EVENT_GESTURE_PINCH_END: + w->pinch.nfingers = 0; + w->pinch.x = w->width/2; + w->pinch.y = w->height/2; + w->pinch.angle = 0.0; + w->pinch.scale = 1.0; + break; + default: + abort(); + } +} + +static gboolean +handle_event_libinput(GIOChannel *source, GIOCondition condition, gpointer data) +{ + struct libinput *li = data; + struct tools_context *context = libinput_get_user_data(li); + struct window *w = context->user_data; + struct libinput_event *ev; + + libinput_dispatch(li); + + while ((ev = libinput_get_event(li))) { + switch (libinput_event_get_type(ev)) { + case LIBINPUT_EVENT_NONE: + abort(); + case LIBINPUT_EVENT_DEVICE_ADDED: + case LIBINPUT_EVENT_DEVICE_REMOVED: + handle_event_device_notify(ev); + break; + case LIBINPUT_EVENT_POINTER_MOTION: + handle_event_motion(ev, w); + break; + case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: + handle_event_absmotion(ev, w); + break; + case LIBINPUT_EVENT_TOUCH_DOWN: + case LIBINPUT_EVENT_TOUCH_MOTION: + case LIBINPUT_EVENT_TOUCH_UP: + handle_event_touch(ev, w); + break; + case LIBINPUT_EVENT_POINTER_AXIS: + handle_event_axis(ev, w); + break; + case LIBINPUT_EVENT_TOUCH_CANCEL: + case LIBINPUT_EVENT_TOUCH_FRAME: + break; + case LIBINPUT_EVENT_POINTER_BUTTON: + handle_event_button(ev, w); + break; + case LIBINPUT_EVENT_KEYBOARD_KEY: + if (handle_event_keyboard(ev, w)) { + libinput_event_destroy(ev); + gtk_main_quit(); + return FALSE; + } + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN: + case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: + case LIBINPUT_EVENT_GESTURE_SWIPE_END: + handle_event_swipe(ev, w); + break; + case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN: + case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE: + case LIBINPUT_EVENT_GESTURE_PINCH_END: + handle_event_pinch(ev, w); + break; + } + + libinput_event_destroy(ev); + libinput_dispatch(li); + } + gtk_widget_queue_draw(w->area); + + return TRUE; +} + +static void +sockets_init(struct libinput *li) +{ + GIOChannel *c = g_io_channel_unix_new(libinput_get_fd(li)); + + g_io_channel_set_encoding(c, NULL, NULL); + g_io_add_watch(c, G_IO_IN, handle_event_libinput, li); +} + +int +main(int argc, char *argv[]) +{ + struct window w; + struct libinput *li; + struct udev *udev; + + gtk_init(&argc, &argv); + + tools_init_context(&context); + + if (tools_parse_args(argc, argv, &context) != 0) + return 1; + + udev = udev_new(); + if (!udev) + error("Failed to initialize udev\n"); + + context.user_data = &w; + li = tools_open_backend(&context); + if (!li) + return 1; + + window_init(&w); + sockets_init(li); + handle_event_libinput(NULL, 0, li); + + gtk_main(); + + window_cleanup(&w); + libinput_unref(li); + udev_unref(udev); + + return 0; +} diff -Nru libinput-1.10.3/tools/install-compat-scripts.sh libinput-0.21.0/tools/install-compat-scripts.sh --- libinput-1.10.3/tools/install-compat-scripts.sh 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/install-compat-scripts.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -#!/bin/sh - -bindir="${DESTDIR}${1}" - -# Do not create bindir, because if it is not there now, we have a problem -cp "${MESON_SOURCE_ROOT}/tools/libinput-list-devices.compat" "${bindir}/libinput-list-devices" -cp "${MESON_SOURCE_ROOT}/tools/libinput-debug-events.compat" "${bindir}/libinput-debug-events" diff -Nru libinput-1.10.3/tools/libinput-debug-events.c libinput-0.21.0/tools/libinput-debug-events.c --- libinput-1.10.3/tools/libinput-debug-events.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-debug-events.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,999 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "linux/input.h" -#include - -#include -#include - -#include "shared.h" - -static uint32_t start_time; -static const uint32_t screen_width = 100; -static const uint32_t screen_height = 100; -static struct tools_options options; -static bool show_keycodes; -static unsigned int stop = 0; -static bool be_quiet = false; - -#define printq(...) ({ if (!be_quiet) printf(__VA_ARGS__); }) - -static void -print_event_header(struct libinput_event *ev) -{ - /* use for pointer value only, do not dereference */ - static void *last_device = NULL; - struct libinput_device *dev = libinput_event_get_device(ev); - const char *type = NULL; - char prefix; - - switch(libinput_event_get_type(ev)) { - case LIBINPUT_EVENT_NONE: - abort(); - case LIBINPUT_EVENT_DEVICE_ADDED: - type = "DEVICE_ADDED"; - break; - case LIBINPUT_EVENT_DEVICE_REMOVED: - type = "DEVICE_REMOVED"; - break; - case LIBINPUT_EVENT_KEYBOARD_KEY: - type = "KEYBOARD_KEY"; - break; - case LIBINPUT_EVENT_POINTER_MOTION: - type = "POINTER_MOTION"; - break; - case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: - type = "POINTER_MOTION_ABSOLUTE"; - break; - case LIBINPUT_EVENT_POINTER_BUTTON: - type = "POINTER_BUTTON"; - break; - case LIBINPUT_EVENT_POINTER_AXIS: - type = "POINTER_AXIS"; - break; - case LIBINPUT_EVENT_TOUCH_DOWN: - type = "TOUCH_DOWN"; - break; - case LIBINPUT_EVENT_TOUCH_MOTION: - type = "TOUCH_MOTION"; - break; - case LIBINPUT_EVENT_TOUCH_UP: - type = "TOUCH_UP"; - break; - case LIBINPUT_EVENT_TOUCH_CANCEL: - type = "TOUCH_CANCEL"; - break; - case LIBINPUT_EVENT_TOUCH_FRAME: - type = "TOUCH_FRAME"; - break; - case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN: - type = "GESTURE_SWIPE_BEGIN"; - break; - case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: - type = "GESTURE_SWIPE_UPDATE"; - break; - case LIBINPUT_EVENT_GESTURE_SWIPE_END: - type = "GESTURE_SWIPE_END"; - break; - case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN: - type = "GESTURE_PINCH_BEGIN"; - break; - case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE: - type = "GESTURE_PINCH_UPDATE"; - break; - case LIBINPUT_EVENT_GESTURE_PINCH_END: - type = "GESTURE_PINCH_END"; - break; - case LIBINPUT_EVENT_TABLET_TOOL_AXIS: - type = "TABLET_TOOL_AXIS"; - break; - case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: - type = "TABLET_TOOL_PROXIMITY"; - break; - case LIBINPUT_EVENT_TABLET_TOOL_TIP: - type = "TABLET_TOOL_TIP"; - break; - case LIBINPUT_EVENT_TABLET_TOOL_BUTTON: - type = "TABLET_TOOL_BUTTON"; - break; - case LIBINPUT_EVENT_TABLET_PAD_BUTTON: - type = "TABLET_PAD_BUTTON"; - break; - case LIBINPUT_EVENT_TABLET_PAD_RING: - type = "TABLET_PAD_RING"; - break; - case LIBINPUT_EVENT_TABLET_PAD_STRIP: - type = "TABLET_PAD_STRIP"; - break; - case LIBINPUT_EVENT_SWITCH_TOGGLE: - type = "SWITCH_TOGGLE"; - break; - } - - prefix = (last_device != dev) ? '-' : ' '; - - printq("%c%-7s %-16s ", - prefix, - libinput_device_get_sysname(dev), - type); - - last_device = dev; -} - -static void -print_event_time(uint32_t time) -{ - printq("%+6.2fs ", (time - start_time) / 1000.0); -} - -static inline void -print_device_options(struct libinput_device *dev) -{ - uint32_t scroll_methods, click_methods; - - if (libinput_device_config_tap_get_finger_count(dev)) { - printq(" tap"); - if (libinput_device_config_tap_get_drag_lock_enabled(dev)) - printq("(dl on)"); - else - printq("(dl off)"); - } - if (libinput_device_config_left_handed_is_available(dev)) - printq(" left"); - if (libinput_device_config_scroll_has_natural_scroll(dev)) - printq(" scroll-nat"); - if (libinput_device_config_calibration_has_matrix(dev)) - printq(" calib"); - - scroll_methods = libinput_device_config_scroll_get_methods(dev); - if (scroll_methods != LIBINPUT_CONFIG_SCROLL_NO_SCROLL) { - printq(" scroll"); - if (scroll_methods & LIBINPUT_CONFIG_SCROLL_2FG) - printq("-2fg"); - if (scroll_methods & LIBINPUT_CONFIG_SCROLL_EDGE) - printq("-edge"); - if (scroll_methods & LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) - printq("-button"); - } - - click_methods = libinput_device_config_click_get_methods(dev); - if (click_methods != LIBINPUT_CONFIG_CLICK_METHOD_NONE) { - printq(" click"); - if (click_methods & LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS) - printq("-buttonareas"); - if (click_methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER) - printq("-clickfinger"); - } - - if (libinput_device_config_dwt_is_available(dev)) { - if (libinput_device_config_dwt_get_enabled(dev) == - LIBINPUT_CONFIG_DWT_ENABLED) - printq(" dwt-on"); - else - printq(" dwt-off)"); - } - - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_TABLET_PAD)) { - int nbuttons, nstrips, nrings, ngroups; - - nbuttons = libinput_device_tablet_pad_get_num_buttons(dev); - nstrips = libinput_device_tablet_pad_get_num_strips(dev); - nrings = libinput_device_tablet_pad_get_num_rings(dev); - ngroups = libinput_device_tablet_pad_get_num_mode_groups(dev); - - printq(" buttons:%d strips:%d rings:%d mode groups:%d", - nbuttons, - nstrips, - nrings, - ngroups); - } -} - -static void -print_device_notify(struct libinput_event *ev) -{ - struct libinput_device *dev = libinput_event_get_device(ev); - struct libinput_seat *seat = libinput_device_get_seat(dev); - struct libinput_device_group *group; - double w, h; - static int next_group_id = 0; - intptr_t group_id; - - group = libinput_device_get_device_group(dev); - group_id = (intptr_t)libinput_device_group_get_user_data(group); - if (!group_id) { - group_id = ++next_group_id; - libinput_device_group_set_user_data(group, (void*)group_id); - } - - printq("%-33s %5s %7s group%-2d", - libinput_device_get_name(dev), - libinput_seat_get_physical_name(seat), - libinput_seat_get_logical_name(seat), - (int)group_id); - - printq(" cap:"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_KEYBOARD)) - printq("k"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_POINTER)) - printq("p"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_TOUCH)) - printq("t"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_GESTURE)) - printq("g"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_TABLET_TOOL)) - printq("T"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_TABLET_PAD)) - printq("P"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_SWITCH)) - printq("S"); - - if (libinput_device_get_size(dev, &w, &h) == 0) - printq(" size %.0fx%.0fmm", w, h); - - if (libinput_event_get_type(ev) == LIBINPUT_EVENT_DEVICE_ADDED) - print_device_options(dev); - - printq("\n"); - -} - -static void -print_key_event(struct libinput *li, struct libinput_event *ev) -{ - struct libinput_event_keyboard *k = libinput_event_get_keyboard_event(ev); - enum libinput_key_state state; - uint32_t key; - const char *keyname; - - print_event_time(libinput_event_keyboard_get_time(k)); - state = libinput_event_keyboard_get_key_state(k); - - key = libinput_event_keyboard_get_key(k); - if (!show_keycodes && (key >= KEY_ESC && key < KEY_ZENKAKUHANKAKU)) { - keyname = "***"; - key = -1; - } else { - keyname = libevdev_event_code_get_name(EV_KEY, key); - keyname = keyname ? keyname : "???"; - } - printq("%s (%d) %s\n", - keyname, - key, - state == LIBINPUT_KEY_STATE_PRESSED ? "pressed" : "released"); -} - -static void -print_motion_event(struct libinput_event *ev) -{ - struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); - double x = libinput_event_pointer_get_dx(p); - double y = libinput_event_pointer_get_dy(p); - - print_event_time(libinput_event_pointer_get_time(p)); - - printq("%6.2f/%6.2f\n", x, y); -} - -static void -print_absmotion_event(struct libinput_event *ev) -{ - struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); - double x = libinput_event_pointer_get_absolute_x_transformed( - p, screen_width); - double y = libinput_event_pointer_get_absolute_y_transformed( - p, screen_height); - - print_event_time(libinput_event_pointer_get_time(p)); - printq("%6.2f/%6.2f\n", x, y); -} - -static void -print_pointer_button_event(struct libinput_event *ev) -{ - struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); - enum libinput_button_state state; - const char *buttonname; - int button; - - print_event_time(libinput_event_pointer_get_time(p)); - - button = libinput_event_pointer_get_button(p); - buttonname = libevdev_event_code_get_name(EV_KEY, button); - - state = libinput_event_pointer_get_button_state(p); - printq("%s (%d) %s, seat count: %u\n", - buttonname ? buttonname : "???", - button, - state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released", - libinput_event_pointer_get_seat_button_count(p)); -} - -static void -print_tablet_tip_event(struct libinput_event *ev) -{ - struct libinput_event_tablet_tool *p = libinput_event_get_tablet_tool_event(ev); - enum libinput_tablet_tool_tip_state state; - - print_event_time(libinput_event_tablet_tool_get_time(p)); - - state = libinput_event_tablet_tool_get_tip_state(p); - printq("%s\n", state == LIBINPUT_TABLET_TOOL_TIP_DOWN ? "down" : "up"); -} - -static void -print_tablet_button_event(struct libinput_event *ev) -{ - struct libinput_event_tablet_tool *p = libinput_event_get_tablet_tool_event(ev); - enum libinput_button_state state; - const char *buttonname; - int button; - - print_event_time(libinput_event_tablet_tool_get_time(p)); - - button = libinput_event_tablet_tool_get_button(p); - buttonname = libevdev_event_code_get_name(EV_KEY, button); - - state = libinput_event_tablet_tool_get_button_state(p); - printq("%3d (%s) %s, seat count: %u\n", - button, - buttonname ? buttonname : "???", - state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released", - libinput_event_tablet_tool_get_seat_button_count(p)); -} - -static void -print_pointer_axis_event(struct libinput_event *ev) -{ - struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); - double v = 0, h = 0; - const char *have_vert = "", - *have_horiz = ""; - const char *source = "invalid"; - - switch (libinput_event_pointer_get_axis_source(p)) { - case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL: - source = "wheel"; - break; - case LIBINPUT_POINTER_AXIS_SOURCE_FINGER: - source = "finger"; - break; - case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS: - source = "continuous"; - break; - case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT: - source = "tilt"; - break; - } - - if (libinput_event_pointer_has_axis(p, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) { - v = libinput_event_pointer_get_axis_value(p, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); - have_vert = "*"; - } - if (libinput_event_pointer_has_axis(p, - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) { - h = libinput_event_pointer_get_axis_value(p, - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL); - have_horiz = "*"; - } - print_event_time(libinput_event_pointer_get_time(p)); - printq("vert %.2f%s horiz %.2f%s (%s)\n", - v, have_vert, h, have_horiz, source); -} - -static void -print_tablet_axes(struct libinput_event_tablet_tool *t) -{ - struct libinput_tablet_tool *tool = libinput_event_tablet_tool_get_tool(t); - double x, y; - double dist, pressure; - double rotation, slider, wheel; - double delta; - -#define changed_sym(ev, ax) \ - (libinput_event_tablet_tool_##ax##_has_changed(ev) ? "*" : "") - - x = libinput_event_tablet_tool_get_x(t); - y = libinput_event_tablet_tool_get_y(t); - printq("\t%.2f%s/%.2f%s", - x, changed_sym(t, x), - y, changed_sym(t, y)); - - if (libinput_tablet_tool_has_tilt(tool)) { - x = libinput_event_tablet_tool_get_tilt_x(t); - y = libinput_event_tablet_tool_get_tilt_y(t); - printq("\ttilt: %.2f%s/%.2f%s", - x, changed_sym(t, tilt_x), - y, changed_sym(t, tilt_y)); - } - - if (libinput_tablet_tool_has_distance(tool) || - libinput_tablet_tool_has_pressure(tool)) { - dist = libinput_event_tablet_tool_get_distance(t); - pressure = libinput_event_tablet_tool_get_pressure(t); - if (dist) - printq("\tdistance: %.2f%s", - dist, changed_sym(t, distance)); - else - printq("\tpressure: %.2f%s", - pressure, changed_sym(t, pressure)); - } - - if (libinput_tablet_tool_has_rotation(tool)) { - rotation = libinput_event_tablet_tool_get_rotation(t); - printq("\trotation: %.2f%s", - rotation, changed_sym(t, rotation)); - } - - if (libinput_tablet_tool_has_slider(tool)) { - slider = libinput_event_tablet_tool_get_slider_position(t); - printq("\tslider: %.2f%s", - slider, changed_sym(t, slider)); - } - - if (libinput_tablet_tool_has_wheel(tool)) { - wheel = libinput_event_tablet_tool_get_wheel_delta(t); - delta = libinput_event_tablet_tool_get_wheel_delta_discrete(t); - printq("\twheel: %.2f%s (%d)", - wheel, changed_sym(t, wheel), - (int)delta); - } -} - -static void -print_tablet_axis_event(struct libinput_event *ev) -{ - struct libinput_event_tablet_tool *t = libinput_event_get_tablet_tool_event(ev); - - print_event_time(libinput_event_tablet_tool_get_time(t)); - print_tablet_axes(t); - printq("\n"); -} - -static void -print_touch_event_without_coords(struct libinput_event *ev) -{ - struct libinput_event_touch *t = libinput_event_get_touch_event(ev); - - print_event_time(libinput_event_touch_get_time(t)); - printq("\n"); -} - -static void -print_proximity_event(struct libinput_event *ev) -{ - struct libinput_event_tablet_tool *t = libinput_event_get_tablet_tool_event(ev); - struct libinput_tablet_tool *tool = libinput_event_tablet_tool_get_tool(t); - enum libinput_tablet_tool_proximity_state state; - const char *tool_str, - *state_str; - - switch (libinput_tablet_tool_get_type(tool)) { - case LIBINPUT_TABLET_TOOL_TYPE_PEN: - tool_str = "pen"; - break; - case LIBINPUT_TABLET_TOOL_TYPE_ERASER: - tool_str = "eraser"; - break; - case LIBINPUT_TABLET_TOOL_TYPE_BRUSH: - tool_str = "brush"; - break; - case LIBINPUT_TABLET_TOOL_TYPE_PENCIL: - tool_str = "pencil"; - break; - case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH: - tool_str = "airbrush"; - break; - case LIBINPUT_TABLET_TOOL_TYPE_MOUSE: - tool_str = "mouse"; - break; - case LIBINPUT_TABLET_TOOL_TYPE_LENS: - tool_str = "lens"; - break; - default: - abort(); - } - - state = libinput_event_tablet_tool_get_proximity_state(t); - - print_event_time(libinput_event_tablet_tool_get_time(t)); - - if (state == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN) { - print_tablet_axes(t); - state_str = "proximity-in"; - } else if (state == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT) { - print_tablet_axes(t); - state_str = "proximity-out"; - } else { - abort(); - } - - printq("\t%s (%#" PRIx64 ", id %#" PRIx64 ") %s", - tool_str, - libinput_tablet_tool_get_serial(tool), - libinput_tablet_tool_get_tool_id(tool), - state_str); - - if (state == LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN) { - printq("\taxes:"); - if (libinput_tablet_tool_has_distance(tool)) - printq("d"); - if (libinput_tablet_tool_has_pressure(tool)) - printq("p"); - if (libinput_tablet_tool_has_tilt(tool)) - printq("t"); - if (libinput_tablet_tool_has_rotation(tool)) - printq("r"); - if (libinput_tablet_tool_has_slider(tool)) - printq("s"); - if (libinput_tablet_tool_has_wheel(tool)) - printq("w"); - - printq("\tbtn:"); - if (libinput_tablet_tool_has_button(tool, BTN_TOUCH)) - printq("T"); - if (libinput_tablet_tool_has_button(tool, BTN_STYLUS)) - printq("S"); - if (libinput_tablet_tool_has_button(tool, BTN_STYLUS2)) - printq("S2"); - if (libinput_tablet_tool_has_button(tool, BTN_LEFT)) - printq("L"); - if (libinput_tablet_tool_has_button(tool, BTN_MIDDLE)) - printq("M"); - if (libinput_tablet_tool_has_button(tool, BTN_RIGHT)) - printq("R"); - if (libinput_tablet_tool_has_button(tool, BTN_SIDE)) - printq("Sd"); - if (libinput_tablet_tool_has_button(tool, BTN_EXTRA)) - printq("Ex"); - } - - printq("\n"); -} - -static void -print_touch_event_with_coords(struct libinput_event *ev) -{ - struct libinput_event_touch *t = libinput_event_get_touch_event(ev); - double x = libinput_event_touch_get_x_transformed(t, screen_width); - double y = libinput_event_touch_get_y_transformed(t, screen_height); - double xmm = libinput_event_touch_get_x(t); - double ymm = libinput_event_touch_get_y(t); - - print_event_time(libinput_event_touch_get_time(t)); - - printq("%d (%d) %5.2f/%5.2f (%5.2f/%5.2fmm)\n", - libinput_event_touch_get_slot(t), - libinput_event_touch_get_seat_slot(t), - x, y, - xmm, ymm); -} - -static void -print_gesture_event_without_coords(struct libinput_event *ev) -{ - struct libinput_event_gesture *t = libinput_event_get_gesture_event(ev); - int finger_count = libinput_event_gesture_get_finger_count(t); - int cancelled = 0; - enum libinput_event_type type; - - type = libinput_event_get_type(ev); - - if (type == LIBINPUT_EVENT_GESTURE_SWIPE_END || - type == LIBINPUT_EVENT_GESTURE_PINCH_END) - cancelled = libinput_event_gesture_get_cancelled(t); - - print_event_time(libinput_event_gesture_get_time(t)); - printq("%d%s\n", finger_count, cancelled ? " cancelled" : ""); -} - -static void -print_gesture_event_with_coords(struct libinput_event *ev) -{ - struct libinput_event_gesture *t = libinput_event_get_gesture_event(ev); - double dx = libinput_event_gesture_get_dx(t); - double dy = libinput_event_gesture_get_dy(t); - double dx_unaccel = libinput_event_gesture_get_dx_unaccelerated(t); - double dy_unaccel = libinput_event_gesture_get_dy_unaccelerated(t); - - print_event_time(libinput_event_gesture_get_time(t)); - - printq("%d %5.2f/%5.2f (%5.2f/%5.2f unaccelerated)", - libinput_event_gesture_get_finger_count(t), - dx, dy, dx_unaccel, dy_unaccel); - - if (libinput_event_get_type(ev) == - LIBINPUT_EVENT_GESTURE_PINCH_UPDATE) { - double scale = libinput_event_gesture_get_scale(t); - double angle = libinput_event_gesture_get_angle_delta(t); - - printq(" %5.2f @ %5.2f\n", scale, angle); - } else { - printq("\n"); - } -} - -static void -print_tablet_pad_button_event(struct libinput_event *ev) -{ - struct libinput_event_tablet_pad *p = libinput_event_get_tablet_pad_event(ev); - struct libinput_tablet_pad_mode_group *group; - enum libinput_button_state state; - unsigned int button, mode; - - print_event_time(libinput_event_tablet_pad_get_time(p)); - - button = libinput_event_tablet_pad_get_button_number(p), - state = libinput_event_tablet_pad_get_button_state(p); - mode = libinput_event_tablet_pad_get_mode(p); - printq("%3d %s (mode %d)", - button, - state == LIBINPUT_BUTTON_STATE_PRESSED ? "pressed" : "released", - mode); - - group = libinput_event_tablet_pad_get_mode_group(p); - if (libinput_tablet_pad_mode_group_button_is_toggle(group, button)) - printq(" "); - - printq("\n"); -} - -static void -print_tablet_pad_ring_event(struct libinput_event *ev) -{ - struct libinput_event_tablet_pad *p = libinput_event_get_tablet_pad_event(ev); - const char *source = ""; - unsigned int mode; - - print_event_time(libinput_event_tablet_pad_get_time(p)); - - switch (libinput_event_tablet_pad_get_ring_source(p)) { - case LIBINPUT_TABLET_PAD_RING_SOURCE_FINGER: - source = "finger"; - break; - case LIBINPUT_TABLET_PAD_RING_SOURCE_UNKNOWN: - source = "unknown"; - break; - } - - mode = libinput_event_tablet_pad_get_mode(p); - printq("ring %d position %.2f (source %s) (mode %d)\n", - libinput_event_tablet_pad_get_ring_number(p), - libinput_event_tablet_pad_get_ring_position(p), - source, - mode); -} - -static void -print_tablet_pad_strip_event(struct libinput_event *ev) -{ - struct libinput_event_tablet_pad *p = libinput_event_get_tablet_pad_event(ev); - const char *source = ""; - unsigned int mode; - - print_event_time(libinput_event_tablet_pad_get_time(p)); - - switch (libinput_event_tablet_pad_get_strip_source(p)) { - case LIBINPUT_TABLET_PAD_STRIP_SOURCE_FINGER: - source = "finger"; - break; - case LIBINPUT_TABLET_PAD_STRIP_SOURCE_UNKNOWN: - source = "unknown"; - break; - } - - mode = libinput_event_tablet_pad_get_mode(p); - printq("strip %d position %.2f (source %s) (mode %d)\n", - libinput_event_tablet_pad_get_strip_number(p), - libinput_event_tablet_pad_get_strip_position(p), - source, - mode); -} - -static void -print_switch_event(struct libinput_event *ev) -{ - struct libinput_event_switch *sw = libinput_event_get_switch_event(ev); - enum libinput_switch_state state; - const char *which; - - print_event_time(libinput_event_switch_get_time(sw)); - - switch (libinput_event_switch_get_switch(sw)) { - case LIBINPUT_SWITCH_LID: - which = "lid"; - break; - case LIBINPUT_SWITCH_TABLET_MODE: - which = "tablet-mode"; - break; - default: - abort(); - } - - state = libinput_event_switch_get_switch_state(sw); - - printq("switch %s state %d\n", which, state); -} - -static int -handle_and_print_events(struct libinput *li) -{ - int rc = -1; - struct libinput_event *ev; - - libinput_dispatch(li); - while ((ev = libinput_get_event(li))) { - print_event_header(ev); - - switch (libinput_event_get_type(ev)) { - case LIBINPUT_EVENT_NONE: - abort(); - case LIBINPUT_EVENT_DEVICE_ADDED: - case LIBINPUT_EVENT_DEVICE_REMOVED: - print_device_notify(ev); - tools_device_apply_config(libinput_event_get_device(ev), - &options); - break; - case LIBINPUT_EVENT_KEYBOARD_KEY: - print_key_event(li, ev); - break; - case LIBINPUT_EVENT_POINTER_MOTION: - print_motion_event(ev); - break; - case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: - print_absmotion_event(ev); - break; - case LIBINPUT_EVENT_POINTER_BUTTON: - print_pointer_button_event(ev); - break; - case LIBINPUT_EVENT_POINTER_AXIS: - print_pointer_axis_event(ev); - break; - case LIBINPUT_EVENT_TOUCH_DOWN: - print_touch_event_with_coords(ev); - break; - case LIBINPUT_EVENT_TOUCH_MOTION: - print_touch_event_with_coords(ev); - break; - case LIBINPUT_EVENT_TOUCH_UP: - print_touch_event_without_coords(ev); - break; - case LIBINPUT_EVENT_TOUCH_CANCEL: - print_touch_event_without_coords(ev); - break; - case LIBINPUT_EVENT_TOUCH_FRAME: - print_touch_event_without_coords(ev); - break; - case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN: - print_gesture_event_without_coords(ev); - break; - case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: - print_gesture_event_with_coords(ev); - break; - case LIBINPUT_EVENT_GESTURE_SWIPE_END: - print_gesture_event_without_coords(ev); - break; - case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN: - print_gesture_event_without_coords(ev); - break; - case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE: - print_gesture_event_with_coords(ev); - break; - case LIBINPUT_EVENT_GESTURE_PINCH_END: - print_gesture_event_without_coords(ev); - break; - case LIBINPUT_EVENT_TABLET_TOOL_AXIS: - print_tablet_axis_event(ev); - break; - case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: - print_proximity_event(ev); - break; - case LIBINPUT_EVENT_TABLET_TOOL_TIP: - print_tablet_tip_event(ev); - break; - case LIBINPUT_EVENT_TABLET_TOOL_BUTTON: - print_tablet_button_event(ev); - break; - case LIBINPUT_EVENT_TABLET_PAD_BUTTON: - print_tablet_pad_button_event(ev); - break; - case LIBINPUT_EVENT_TABLET_PAD_RING: - print_tablet_pad_ring_event(ev); - break; - case LIBINPUT_EVENT_TABLET_PAD_STRIP: - print_tablet_pad_strip_event(ev); - break; - case LIBINPUT_EVENT_SWITCH_TOGGLE: - print_switch_event(ev); - break; - } - - libinput_event_destroy(ev); - libinput_dispatch(li); - rc = 0; - } - return rc; -} - -static void -sighandler(int signal, siginfo_t *siginfo, void *userdata) -{ - stop = 1; -} - -static void -mainloop(struct libinput *li) -{ - struct pollfd fds; - struct sigaction act; - - fds.fd = libinput_get_fd(li); - fds.events = POLLIN; - fds.revents = 0; - - memset(&act, 0, sizeof(act)); - act.sa_sigaction = sighandler; - act.sa_flags = SA_SIGINFO; - - if (sigaction(SIGINT, &act, NULL) == -1) { - fprintf(stderr, "Failed to set up signal handling (%s)\n", - strerror(errno)); - return; - } - - /* Handle already-pending device added events */ - if (handle_and_print_events(li)) - fprintf(stderr, "Expected device added events on startup but got none. " - "Maybe you don't have the right permissions?\n"); - - while (!stop && poll(&fds, 1, -1) > -1) - handle_and_print_events(li); - - printf("\n"); -} - -static void -usage(void) { - printf("Usage: libinput debug-events [options] [--udev |--device /dev/input/event0]\n"); -} - -int -main(int argc, char **argv) -{ - struct libinput *li; - struct timespec tp; - enum tools_backend backend = BACKEND_UDEV; - const char *seat_or_device = "seat0"; - bool grab = false; - bool verbose = false; - - clock_gettime(CLOCK_MONOTONIC, &tp); - start_time = tp.tv_sec * 1000 + tp.tv_nsec / 1000000; - - tools_init_options(&options); - - while (1) { - int c; - int option_index = 0; - enum { - OPT_DEVICE = 1, - OPT_UDEV, - OPT_GRAB, - OPT_VERBOSE, - OPT_SHOW_KEYCODES, - OPT_QUIET, - }; - static struct option opts[] = { - CONFIGURATION_OPTIONS, - { "help", no_argument, 0, 'h' }, - { "show-keycodes", no_argument, 0, OPT_SHOW_KEYCODES }, - { "device", required_argument, 0, OPT_DEVICE }, - { "udev", required_argument, 0, OPT_UDEV }, - { "grab", no_argument, 0, OPT_GRAB }, - { "verbose", no_argument, 0, OPT_VERBOSE }, - { "quiet", no_argument, 0, OPT_QUIET }, - { 0, 0, 0, 0} - }; - - c = getopt_long(argc, argv, "h", opts, &option_index); - if (c == -1) - break; - - switch(c) { - case '?': - exit(1); - break; - case 'h': - usage(); - exit(0); - break; - case OPT_SHOW_KEYCODES: - show_keycodes = true; - break; - case OPT_QUIET: - be_quiet = true; - break; - case OPT_DEVICE: - backend = BACKEND_DEVICE; - seat_or_device = optarg; - break; - case OPT_UDEV: - backend = BACKEND_UDEV; - seat_or_device = optarg; - break; - case OPT_GRAB: - grab = true; - break; - case OPT_VERBOSE: - verbose = true; - break; - default: - if (tools_parse_option(c, optarg, &options) != 0) { - usage(); - return 1; - } - break; - } - - } - - if (optind < argc) { - usage(); - return 1; - } - - li = tools_open_backend(backend, seat_or_device, verbose, grab); - if (!li) - return 1; - - mainloop(li); - - libinput_unref(li); - - return 0; -} diff -Nru libinput-1.10.3/tools/libinput-debug-events.compat libinput-0.21.0/tools/libinput-debug-events.compat --- libinput-1.10.3/tools/libinput-debug-events.compat 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-debug-events.compat 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -#!/bin/sh - -echo "WARNING: This compatibility wrapper will be removed in the future. Please run 'libinput debug-events' instead" 1>&2 -exec libinput debug-events $@ diff -Nru libinput-1.10.3/tools/libinput-debug-events.man libinput-0.21.0/tools/libinput-debug-events.man --- libinput-1.10.3/tools/libinput-debug-events.man 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-debug-events.man 2015-07-15 04:18:08.000000000 +0000 @@ -1,12 +1,12 @@ -.TH libinput-debug-events "1" "" "libinput @LIBINPUT_VERSION@" "libinput Manual" +.TH LIBINPUT-DEBUG-EVENTS "1" .SH NAME -libinput\-debug\-events \- debug helper for libinput +libinput-debug-events \- debug helper for libinput .SH SYNOPSIS -.B libinput debug\-events [\-\-help] [\-\-show\-keycodes] [\-\-udev \fI\fB|\-\-device \fI/dev/input/event0\fB] \fI[configuration options]\fB +.B libinput-debug-events [--help] .SH DESCRIPTION .PP The -.B "libinput debug\-events" +.I libinput-debug-events tool creates a libinput context and prints all events from these devices. .PP This is a debugging tool only, its output may change at any time. Do not @@ -16,80 +16,16 @@ /dev/input/eventX nodes. .SH OPTIONS .TP 8 -.B \-\-device \fI/dev/input/event0\fR -Use the given device with the path backend -.TP 8 -.B \-\-grab -Exclusively grab all opened devices. This will prevent events from being -delivered to the host system. -.TP 8 -.B \-\-help +.B --help Print help -.TP 8 -.B \-\-quiet -Only print libinput messages, don't print anything from this tool. This is -useful in combination with --verbose for internal state debugging. -.TP 8 -.B \-\-show\-keycodes -Key events shown by this tool are partially obfuscated to avoid passwords -and other sensitive information showing up in the output. Use the -.B \-\-show\-keycodes -argument to make all keycodes visible. -.TP 8 -.B \-\-udev \fI\fR -Use the udev backend to listen for device notifications on the given seat. -The default behavior is equivalent to \-\-udev "seat0". -.TP 8 -.B \-\-verbose -Use verbose output -.SS libinput configuration options -.TP 8 -.B \-\-disable-sendevents="pattern" -Set the send-events option to disabled for the devices matching patterns. -.TP 8 -.B \-\-enable\-tap|\-\-disable\-tap -Enable or disable tap-to-click -.TP 8 -.B \-\-enable-drag|\-\-disable\-drag -Enable or disable tap-and-drag -.TP 8 -.B \-\-enable\-drag-lock|\-\-disable\-drag\-lock -Enable or disable tap-and-drag -.TP 8 -.B \-\-enable\-natural\-scrolling|\-\-disable\-natural\-scrolling -Enable or disable natural scrolling -.TP 8 -.B \-\-enable\-left\-handed|\-\-disable\-left\-handed -Enable or disable left handed button configuration -.TP 8 -.B \-\-enable\-middlebutton|\-\-disable\-middlebutton -Enable or disable middle button emulation -.TP 8 -.B \-\-enable\-dwt|\-\-disable\-dwt -Enable or disable disable-while-typing -.TP 8 -.B \-\-set\-click\-method=[none|clickfinger|buttons] -Set the desired click method -.TP 8 -.B \-\-set\-scroll\-method=[none|twofinger|edge|button] -Set the desired scroll method -.TP 8 -.B \-\-set\-scroll\-button=BTN_MIDDLE -Set the button to the given button code -.TP 8 -.B \-\-set\-profile=[adaptive|flat] -Set pointer acceleration profile -.TP 8 -.B \-\-set\-speed= -Set pointer acceleration speed. The allowed range is [-1, 1]. -.TP 8 -.B \-\-set\-tap\-map=[lrm|lmr] -Set button mapping for tapping +.PP +For all other options, see the output from --help. Options may be added or +removed at any time. .SH NOTES .PP Events shown by this tool may not correspond to the events seen by a different user of libinput. This tool initializes a separate context. -.SH LIBINPUT -Part of the -.B libinput(1) -suite +.PP +Events shown by this tool include key codes in plain text. Anything you type +while this tool is running will show up in the output, including your +passwords. diff -Nru libinput-1.10.3/tools/libinput-debug-gui.c libinput-0.21.0/tools/libinput-debug-gui.c --- libinput-1.10.3/tools/libinput-debug-gui.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-debug-gui.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,963 +0,0 @@ -/* - * Copyright © 2014 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include "shared.h" - -#define clip(val_, min_, max_) min((max_), max((min_), (val_))) - -struct touch { - int active; - int x, y; -}; - -struct point { - double x, y; -}; - -struct window { - struct tools_options options; - - GtkWidget *win; - GtkWidget *area; - int width, height; /* of window */ - - /* sprite position */ - double x, y; - - /* abs position */ - int absx, absy; - - /* scroll bar positions */ - double vx, vy; - double hx, hy; - - /* touch positions */ - struct touch touches[32]; - - /* l/m/r mouse buttons */ - int l, m, r; - - /* touchpad swipe */ - struct { - int nfingers; - double x, y; - } swipe; - - struct { - int nfingers; - double scale; - double angle; - double x, y; - } pinch; - - struct { - double x, y; - double x_in, y_in; - double x_down, y_down; - double x_up, y_up; - double pressure; - double distance; - double tilt_x, tilt_y; - - /* these are for the delta coordinates, but they're not - * deltas, they are converted into abs positions */ - size_t ndeltas; - struct point deltas[64]; - } tool; - - struct libinput_device *devices[50]; -}; - -LIBINPUT_ATTRIBUTE_PRINTF(1, 2) -static inline void -msg(const char *fmt, ...) -{ - va_list args; - printf("info: "); - - va_start(args, fmt); - vprintf(fmt, args); - va_end(args); -} - -static inline void -draw_gestures(struct window *w, cairo_t *cr) -{ - int i; - int offset; - - /* swipe */ - cairo_save(cr); - cairo_translate(cr, w->swipe.x, w->swipe.y); - for (i = 0; i < w->swipe.nfingers; i++) { - cairo_set_source_rgb(cr, .8, .8, .4); - cairo_arc(cr, (i - 2) * 40, 0, 20, 0, 2 * M_PI); - cairo_fill(cr); - } - - for (i = 0; i < 4; i++) { /* 4 fg max */ - cairo_set_source_rgb(cr, 0, 0, 0); - cairo_arc(cr, (i - 2) * 40, 0, 20, 0, 2 * M_PI); - cairo_stroke(cr); - } - cairo_restore(cr); - - /* pinch */ - cairo_save(cr); - offset = w->pinch.scale * 100; - cairo_translate(cr, w->pinch.x, w->pinch.y); - cairo_rotate(cr, w->pinch.angle * M_PI/180.0); - if (w->pinch.nfingers > 0) { - cairo_set_source_rgb(cr, .4, .4, .8); - cairo_arc(cr, offset, -offset, 20, 0, 2 * M_PI); - cairo_arc(cr, -offset, offset, 20, 0, 2 * M_PI); - cairo_fill(cr); - } - - cairo_set_source_rgb(cr, 0, 0, 0); - cairo_arc(cr, offset, -offset, 20, 0, 2 * M_PI); - cairo_stroke(cr); - cairo_arc(cr, -offset, offset, 20, 0, 2 * M_PI); - cairo_stroke(cr); - - cairo_restore(cr); - -} - -static inline void -draw_scrollbars(struct window *w, cairo_t *cr) -{ - cairo_set_source_rgb(cr, .4, .8, 0); - - cairo_save(cr); - cairo_rectangle(cr, w->vx - 10, w->vy - 20, 20, 40); - cairo_rectangle(cr, w->hx - 20, w->hy - 10, 40, 20); - cairo_fill(cr); - cairo_restore(cr); -} - -static inline void -draw_touchpoints(struct window *w, cairo_t *cr) -{ - struct touch *t; - - cairo_set_source_rgb(cr, .8, .2, .2); - - ARRAY_FOR_EACH(w->touches, t) { - cairo_save(cr); - cairo_arc(cr, t->x, t->y, 10, 0, 2 * M_PI); - cairo_fill(cr); - cairo_restore(cr); - } -} - -static inline void -draw_abs_pointer(struct window *w, cairo_t *cr) -{ - cairo_set_source_rgb(cr, .2, .4, .8); - - cairo_save(cr); - cairo_arc(cr, w->absx, w->absy, 10, 0, 2 * M_PI); - cairo_fill(cr); - cairo_restore(cr); -} - -static inline void -draw_buttons(struct window *w, cairo_t *cr) -{ - cairo_save(cr); - if (w->l || w->m || w->r) { - cairo_set_source_rgb(cr, .2, .8, .8); - if (w->l) - cairo_rectangle(cr, w->width/2 - 100, w->height - 200, 70, 30); - if (w->m) - cairo_rectangle(cr, w->width/2 - 20, w->height - 200, 40, 30); - if (w->r) - cairo_rectangle(cr, w->width/2 + 30, w->height - 200, 70, 30); - cairo_fill(cr); - } - - cairo_set_source_rgb(cr, 0, 0, 0); - cairo_rectangle(cr, w->width/2 - 100, w->height - 200, 70, 30); - cairo_rectangle(cr, w->width/2 - 20, w->height - 200, 40, 30); - cairo_rectangle(cr, w->width/2 + 30, w->height - 200, 70, 30); - cairo_stroke(cr); - cairo_restore(cr); -} - -static inline void -draw_tablet(struct window *w, cairo_t *cr) -{ - double x, y; - int first, last; - size_t mask; - int i; - - /* tablet tool, square for prox-in location */ - cairo_save(cr); - cairo_set_source_rgb(cr, .8, .8, .8); - if (w->tool.x_in && w->tool.y_in) { - cairo_rectangle(cr, w->tool.x_in - 15, w->tool.y_in - 15, 30, 30); - cairo_stroke(cr); - cairo_restore(cr); - cairo_save(cr); - } - - if (w->tool.x_down && w->tool.y_down) { - cairo_rectangle(cr, w->tool.x_down - 10, w->tool.y_down - 10, 20, 20); - cairo_stroke(cr); - cairo_restore(cr); - cairo_save(cr); - } - - if (w->tool.x_up && w->tool.y_up) { - cairo_rectangle(cr, w->tool.x_up - 10, w->tool.y_up - 10, 20, 20); - cairo_stroke(cr); - cairo_restore(cr); - cairo_save(cr); - } - - if (w->tool.pressure) - cairo_set_source_rgb(cr, .8, .8, .2); - - cairo_translate(cr, w->tool.x, w->tool.y); - cairo_scale(cr, 1.0 + w->tool.tilt_x/30.0, 1.0 + w->tool.tilt_y/30.0); - cairo_arc(cr, 0, 0, - 1 + 10 * max(w->tool.pressure, w->tool.distance), - 0, 2 * M_PI); - cairo_fill(cr); - cairo_restore(cr); - - /* tablet deltas */ - mask = ARRAY_LENGTH(w->tool.deltas); - first = max(w->tool.ndeltas + 1, mask) - mask; - last = w->tool.ndeltas; - - cairo_save(cr); - cairo_set_source_rgb(cr, .8, .8, .2); - - x = w->tool.deltas[first % mask].x; - y = w->tool.deltas[first % mask].y; - cairo_move_to(cr, x, y); - - for (i = first + 1; i < last; i++) { - x = w->tool.deltas[i % mask].x; - y = w->tool.deltas[i % mask].y; - cairo_line_to(cr, x, y); - } - - cairo_stroke(cr); - -} - -static inline void -draw_pointer(struct window *w, cairo_t *cr) -{ - /* draw pointer sprite */ - cairo_set_source_rgb(cr, 0, 0, 0); - cairo_save(cr); - cairo_move_to(cr, w->x, w->y); - cairo_rel_line_to(cr, 10, 15); - cairo_rel_line_to(cr, -10, 0); - cairo_rel_line_to(cr, 0, -15); - cairo_fill(cr); - cairo_restore(cr); -} - -static inline void -draw_background(struct window *w, cairo_t *cr) -{ - int x1, x2, y1, y2, x3, y3, x4, y4; - int cols; - - /* 10px and 5px grids */ - cairo_save(cr); - cairo_set_source_rgb(cr, 0.8, 0.8, 0.8); - x1 = w->width/2 - 200; - y1 = w->height/2 - 200; - x2 = w->width/2 + 200; - y2 = w->height/2 - 200; - for (cols = 1; cols < 10; cols++) { - cairo_move_to(cr, x1 + 10 * cols, y1); - cairo_rel_line_to(cr, 0, 100); - cairo_move_to(cr, x1, y1 + 10 * cols); - cairo_rel_line_to(cr, 100, 0); - - cairo_move_to(cr, x2 + 5 * cols, y2); - cairo_rel_line_to(cr, 0, 50); - cairo_move_to(cr, x2, y2 + 5 * cols); - cairo_rel_line_to(cr, 50, 0); - } - - /* 3px horiz/vert bar codes */ - x3 = w->width/2 - 200; - y3 = w->height/2 + 200; - x4 = w->width/2 + 200; - y4 = w->height/2 + 100; - for (cols = 0; cols < 50; cols++) { - cairo_move_to(cr, x3 + 3 * cols, y3); - cairo_rel_line_to(cr, 0, 20); - - cairo_move_to(cr, x4, y4 + 3 * cols); - cairo_rel_line_to(cr, 20, 0); - } - cairo_stroke(cr); -} - -static gboolean -draw(GtkWidget *widget, cairo_t *cr, gpointer data) -{ - struct window *w = data; - - cairo_set_source_rgb(cr, 1, 1, 1); - cairo_rectangle(cr, 0, 0, w->width, w->height); - cairo_fill(cr); - - draw_background(w, cr); - - draw_gestures(w, cr); - draw_scrollbars(w, cr); - draw_touchpoints(w, cr); - draw_abs_pointer(w, cr); - draw_buttons(w, cr); - draw_tablet(w, cr); - draw_pointer(w, cr); - - return TRUE; -} - -static void -map_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data) -{ - struct window *w = data; - GdkDisplay *display; - GdkSeat *seat; - GdkWindow *window; - - gtk_window_get_size(GTK_WINDOW(widget), &w->width, &w->height); - - w->x = w->width/2; - w->y = w->height/2; - - w->vx = w->width/2; - w->vy = w->height/2; - w->hx = w->width/2; - w->hy = w->height/2; - - w->swipe.x = w->width/2; - w->swipe.y = w->height/2; - - w->pinch.scale = 1.0; - w->pinch.x = w->width/2; - w->pinch.y = w->height/2; - - g_signal_connect(G_OBJECT(w->area), "draw", G_CALLBACK(draw), w); - - window = gdk_event_get_window(event); - display = gdk_window_get_display(window); - - gdk_window_set_cursor(gtk_widget_get_window(w->win), - gdk_cursor_new_for_display(display, - GDK_BLANK_CURSOR)); - - seat = gdk_display_get_default_seat(display); - gdk_seat_grab(seat, - window, - GDK_SEAT_CAPABILITY_ALL_POINTING, - FALSE, /* owner-events */ - NULL, /* cursor */ - NULL, /* triggering event */ - NULL, /* prepare_func */ - NULL /* prepare_func_data */ - ); -} - -static void -window_init(struct window *w) -{ - memset(w, 0, sizeof(*w)); - - w->win = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_set_events(w->win, 0); - gtk_window_set_title(GTK_WINDOW(w->win), "libinput debugging tool"); - gtk_window_set_default_size(GTK_WINDOW(w->win), 1024, 768); - gtk_window_maximize(GTK_WINDOW(w->win)); - gtk_window_set_resizable(GTK_WINDOW(w->win), TRUE); - gtk_widget_realize(w->win); - g_signal_connect(G_OBJECT(w->win), "map-event", G_CALLBACK(map_event_cb), w); - g_signal_connect(G_OBJECT(w->win), "delete-event", G_CALLBACK(gtk_main_quit), NULL); - - w->area = gtk_drawing_area_new(); - gtk_widget_set_events(w->area, 0); - gtk_container_add(GTK_CONTAINER(w->win), w->area); - gtk_widget_show_all(w->win); -} - -static void -window_cleanup(struct window *w) -{ - struct libinput_device **dev; - ARRAY_FOR_EACH(w->devices, dev) { - if (*dev) - libinput_device_unref(*dev); - } -} - -static void -change_ptraccel(struct window *w, double amount) -{ - struct libinput_device **dev; - - ARRAY_FOR_EACH(w->devices, dev) { - double speed; - enum libinput_config_status status; - - if (*dev == NULL) - continue; - - if (!libinput_device_config_accel_is_available(*dev)) - continue; - - speed = libinput_device_config_accel_get_speed(*dev); - speed = clip(speed + amount, -1, 1); - - status = libinput_device_config_accel_set_speed(*dev, speed); - - if (status != LIBINPUT_CONFIG_STATUS_SUCCESS) { - msg("%s: failed to change accel to %.2f (%s)\n", - libinput_device_get_name(*dev), - speed, - libinput_config_status_to_str(status)); - } else { - printf("%s: speed is %.2f\n", - libinput_device_get_name(*dev), - speed); - } - - } -} - -static void -handle_event_device_notify(struct libinput_event *ev) -{ - struct libinput_device *dev = libinput_event_get_device(ev); - struct libinput *li; - struct window *w; - const char *type; - size_t i; - - if (libinput_event_get_type(ev) == LIBINPUT_EVENT_DEVICE_ADDED) - type = "added"; - else - type = "removed"; - - msg("%s %-30s %s\n", - libinput_device_get_sysname(dev), - libinput_device_get_name(dev), - type); - - li = libinput_event_get_context(ev); - w = libinput_get_user_data(li); - - tools_device_apply_config(libinput_event_get_device(ev), - &w->options); - - if (libinput_event_get_type(ev) == LIBINPUT_EVENT_DEVICE_ADDED) { - for (i = 0; i < ARRAY_LENGTH(w->devices); i++) { - if (w->devices[i] == NULL) { - w->devices[i] = libinput_device_ref(dev); - break; - } - } - } else { - for (i = 0; i < ARRAY_LENGTH(w->devices); i++) { - if (w->devices[i] == dev) { - libinput_device_unref(w->devices[i]); - w->devices[i] = NULL; - break; - } - } - } -} - -static void -handle_event_motion(struct libinput_event *ev, struct window *w) -{ - struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); - double dx = libinput_event_pointer_get_dx(p), - dy = libinput_event_pointer_get_dy(p); - - w->x += dx; - w->y += dy; - w->x = clip(w->x, 0.0, w->width); - w->y = clip(w->y, 0.0, w->height); -} - -static void -handle_event_absmotion(struct libinput_event *ev, struct window *w) -{ - struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); - double x = libinput_event_pointer_get_absolute_x_transformed(p, w->width), - y = libinput_event_pointer_get_absolute_y_transformed(p, w->height); - - w->absx = x; - w->absy = y; -} - -static void -handle_event_touch(struct libinput_event *ev, struct window *w) -{ - struct libinput_event_touch *t = libinput_event_get_touch_event(ev); - int slot = libinput_event_touch_get_seat_slot(t); - struct touch *touch; - double x, y; - - if (slot == -1 || slot >= (int) ARRAY_LENGTH(w->touches)) - return; - - touch = &w->touches[slot]; - - if (libinput_event_get_type(ev) == LIBINPUT_EVENT_TOUCH_UP) { - touch->active = 0; - return; - } - - x = libinput_event_touch_get_x_transformed(t, w->width), - y = libinput_event_touch_get_y_transformed(t, w->height); - - touch->active = 1; - touch->x = (int)x; - touch->y = (int)y; -} - -static void -handle_event_axis(struct libinput_event *ev, struct window *w) -{ - struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); - double value; - - if (libinput_event_pointer_has_axis(p, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL)) { - value = libinput_event_pointer_get_axis_value(p, - LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); - w->vy += value; - w->vy = clip(w->vy, 0, w->height); - } - - if (libinput_event_pointer_has_axis(p, - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)) { - value = libinput_event_pointer_get_axis_value(p, - LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL); - w->hx += value; - w->hx = clip(w->hx, 0, w->width); - } -} - -static int -handle_event_keyboard(struct libinput_event *ev, struct window *w) -{ - struct libinput_event_keyboard *k = libinput_event_get_keyboard_event(ev); - unsigned int key = libinput_event_keyboard_get_key(k); - - if (libinput_event_keyboard_get_key_state(k) == - LIBINPUT_KEY_STATE_RELEASED) - return 0; - - switch(key) { - case KEY_ESC: - return 1; - case KEY_UP: - change_ptraccel(w, 0.1); - break; - case KEY_DOWN: - change_ptraccel(w, -0.1); - break; - default: - break; - } - - return 0; -} - -static void -handle_event_button(struct libinput_event *ev, struct window *w) -{ - struct libinput_event_pointer *p = libinput_event_get_pointer_event(ev); - unsigned int button = libinput_event_pointer_get_button(p); - int is_press; - - is_press = libinput_event_pointer_get_button_state(p) == LIBINPUT_BUTTON_STATE_PRESSED; - - switch (button) { - case BTN_LEFT: - w->l = is_press; - break; - case BTN_RIGHT: - w->r = is_press; - break; - case BTN_MIDDLE: - w->m = is_press; - break; - } - -} - -static void -handle_event_swipe(struct libinput_event *ev, struct window *w) -{ - struct libinput_event_gesture *g = libinput_event_get_gesture_event(ev); - int nfingers; - double dx, dy; - - nfingers = libinput_event_gesture_get_finger_count(g); - - switch (libinput_event_get_type(ev)) { - case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN: - w->swipe.nfingers = nfingers; - w->swipe.x = w->width/2; - w->swipe.y = w->height/2; - break; - case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: - dx = libinput_event_gesture_get_dx(g); - dy = libinput_event_gesture_get_dy(g); - w->swipe.x += dx; - w->swipe.y += dy; - break; - case LIBINPUT_EVENT_GESTURE_SWIPE_END: - w->swipe.nfingers = 0; - w->swipe.x = w->width/2; - w->swipe.y = w->height/2; - break; - default: - abort(); - } -} - -static void -handle_event_pinch(struct libinput_event *ev, struct window *w) -{ - struct libinput_event_gesture *g = libinput_event_get_gesture_event(ev); - int nfingers; - double dx, dy; - - nfingers = libinput_event_gesture_get_finger_count(g); - - switch (libinput_event_get_type(ev)) { - case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN: - w->pinch.nfingers = nfingers; - w->pinch.x = w->width/2; - w->pinch.y = w->height/2; - break; - case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE: - dx = libinput_event_gesture_get_dx(g); - dy = libinput_event_gesture_get_dy(g); - w->pinch.x += dx; - w->pinch.y += dy; - w->pinch.scale = libinput_event_gesture_get_scale(g); - w->pinch.angle += libinput_event_gesture_get_angle_delta(g); - break; - case LIBINPUT_EVENT_GESTURE_PINCH_END: - w->pinch.nfingers = 0; - w->pinch.x = w->width/2; - w->pinch.y = w->height/2; - w->pinch.angle = 0.0; - w->pinch.scale = 1.0; - break; - default: - abort(); - } -} - -static void -handle_event_tablet(struct libinput_event *ev, struct window *w) -{ - struct libinput_event_tablet_tool *t = libinput_event_get_tablet_tool_event(ev); - double x, y; - struct point point; - int idx; - const int mask = ARRAY_LENGTH(w->tool.deltas); - - x = libinput_event_tablet_tool_get_x_transformed(t, w->width); - y = libinput_event_tablet_tool_get_y_transformed(t, w->height); - - switch (libinput_event_get_type(ev)) { - case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: - if (libinput_event_tablet_tool_get_proximity_state(t) == - LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT) { - w->tool.x_in = 0; - w->tool.y_in = 0; - w->tool.x_down = 0; - w->tool.y_down = 0; - w->tool.x_up = 0; - w->tool.y_up = 0; - } else { - w->tool.x_in = x; - w->tool.y_in = y; - w->tool.ndeltas = 0; - w->tool.deltas[0].x = w->width/2; - w->tool.deltas[0].y = w->height/2; - } - break; - case LIBINPUT_EVENT_TABLET_TOOL_TIP: - w->tool.pressure = libinput_event_tablet_tool_get_pressure(t); - w->tool.distance = libinput_event_tablet_tool_get_distance(t); - w->tool.tilt_x = libinput_event_tablet_tool_get_tilt_x(t); - w->tool.tilt_y = libinput_event_tablet_tool_get_tilt_y(t); - if (libinput_event_tablet_tool_get_tip_state(t) == - LIBINPUT_TABLET_TOOL_TIP_DOWN) { - w->tool.x_down = x; - w->tool.y_down = y; - } else { - w->tool.x_up = x; - w->tool.y_up = y; - } - /* fallthrough */ - case LIBINPUT_EVENT_TABLET_TOOL_AXIS: - w->tool.x = x; - w->tool.y = y; - w->tool.pressure = libinput_event_tablet_tool_get_pressure(t); - w->tool.distance = libinput_event_tablet_tool_get_distance(t); - w->tool.tilt_x = libinput_event_tablet_tool_get_tilt_x(t); - w->tool.tilt_y = libinput_event_tablet_tool_get_tilt_y(t); - - /* Add the delta to the last position and store them as abs - * coordinates */ - idx = w->tool.ndeltas % mask; - point = w->tool.deltas[idx]; - - idx = (w->tool.ndeltas + 1) % mask; - point.x += libinput_event_tablet_tool_get_dx(t); - point.y += libinput_event_tablet_tool_get_dy(t); - w->tool.deltas[idx] = point; - w->tool.ndeltas++; - break; - case LIBINPUT_EVENT_TABLET_TOOL_BUTTON: - break; - default: - abort(); - } -} - -static gboolean -handle_event_libinput(GIOChannel *source, GIOCondition condition, gpointer data) -{ - struct libinput *li = data; - struct window *w = libinput_get_user_data(li); - struct libinput_event *ev; - - libinput_dispatch(li); - - while ((ev = libinput_get_event(li))) { - switch (libinput_event_get_type(ev)) { - case LIBINPUT_EVENT_NONE: - abort(); - case LIBINPUT_EVENT_DEVICE_ADDED: - case LIBINPUT_EVENT_DEVICE_REMOVED: - handle_event_device_notify(ev); - break; - case LIBINPUT_EVENT_POINTER_MOTION: - handle_event_motion(ev, w); - break; - case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: - handle_event_absmotion(ev, w); - break; - case LIBINPUT_EVENT_TOUCH_DOWN: - case LIBINPUT_EVENT_TOUCH_MOTION: - case LIBINPUT_EVENT_TOUCH_UP: - handle_event_touch(ev, w); - break; - case LIBINPUT_EVENT_POINTER_AXIS: - handle_event_axis(ev, w); - break; - case LIBINPUT_EVENT_TOUCH_CANCEL: - case LIBINPUT_EVENT_TOUCH_FRAME: - break; - case LIBINPUT_EVENT_POINTER_BUTTON: - handle_event_button(ev, w); - break; - case LIBINPUT_EVENT_KEYBOARD_KEY: - if (handle_event_keyboard(ev, w)) { - libinput_event_destroy(ev); - gtk_main_quit(); - return FALSE; - } - break; - case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN: - case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: - case LIBINPUT_EVENT_GESTURE_SWIPE_END: - handle_event_swipe(ev, w); - break; - case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN: - case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE: - case LIBINPUT_EVENT_GESTURE_PINCH_END: - handle_event_pinch(ev, w); - break; - case LIBINPUT_EVENT_TABLET_TOOL_AXIS: - case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY: - case LIBINPUT_EVENT_TABLET_TOOL_TIP: - case LIBINPUT_EVENT_TABLET_TOOL_BUTTON: - handle_event_tablet(ev, w); - break; - case LIBINPUT_EVENT_TABLET_PAD_BUTTON: - case LIBINPUT_EVENT_TABLET_PAD_RING: - case LIBINPUT_EVENT_TABLET_PAD_STRIP: - break; - case LIBINPUT_EVENT_SWITCH_TOGGLE: - break; - } - - libinput_event_destroy(ev); - libinput_dispatch(li); - } - gtk_widget_queue_draw(w->area); - - return TRUE; -} - -static void -sockets_init(struct libinput *li) -{ - GIOChannel *c = g_io_channel_unix_new(libinput_get_fd(li)); - - g_io_channel_set_encoding(c, NULL, NULL); - g_io_add_watch(c, G_IO_IN, handle_event_libinput, li); -} - -static void -usage(void) { - printf("Usage: libinput debug-gui [options] [--udev |--device /dev/input/event0]\n"); -} - -int -main(int argc, char **argv) -{ - struct window w; - struct tools_options options; - struct libinput *li; - enum tools_backend backend = BACKEND_UDEV; - const char *seat_or_device = "seat0"; - bool grab = false; - bool verbose = false; - - gtk_init(&argc, &argv); - - tools_init_options(&options); - - while (1) { - int c; - int option_index = 0; - enum { - OPT_DEVICE = 1, - OPT_UDEV, - OPT_GRAB, - OPT_VERBOSE, - }; - static struct option opts[] = { - CONFIGURATION_OPTIONS, - { "help", no_argument, 0, 'h' }, - { "device", required_argument, 0, OPT_DEVICE }, - { "udev", required_argument, 0, OPT_UDEV }, - { "grab", no_argument, 0, OPT_GRAB }, - { "verbose", no_argument, 0, OPT_VERBOSE }, - { 0, 0, 0, 0} - }; - - c = getopt_long(argc, argv, "h", opts, &option_index); - if (c == -1) - break; - - switch(c) { - case '?': - exit(1); - break; - case 'h': - usage(); - exit(0); - break; - case OPT_DEVICE: - backend = BACKEND_DEVICE; - seat_or_device = optarg; - break; - case OPT_UDEV: - backend = BACKEND_UDEV; - seat_or_device = optarg; - break; - case OPT_GRAB: - grab = true; - break; - case OPT_VERBOSE: - verbose = true; - break; - default: - if (tools_parse_option(c, optarg, &options) != 0) { - usage(); - return 1; - } - break; - } - - } - - if (optind < argc) { - usage(); - return 1; - } - - li = tools_open_backend(backend, seat_or_device, verbose, grab); - if (!li) - return 1; - - libinput_set_user_data(li, &w); - - window_init(&w); - w.options = options; - sockets_init(li); - handle_event_libinput(NULL, 0, li); - - gtk_main(); - - window_cleanup(&w); - libinput_unref(li); - - return 0; -} diff -Nru libinput-1.10.3/tools/libinput-debug-gui.man libinput-0.21.0/tools/libinput-debug-gui.man --- libinput-1.10.3/tools/libinput-debug-gui.man 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-debug-gui.man 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -.TH libinput-debug-gui "1" "" "libinput @LIBINPUT_VERSION@" "libinput Manual" -.SH NAME -libinput\-debug\-gui \- visual debug helper for libinput -.SH SYNOPSIS -.B libinput debug\-gui [\-\-help] [\-\-udev \fI\fB|\-\-device \fI/dev/input/event0\fB] \fI[configuration options]\fB -.SH DESCRIPTION -.PP -The -.B "libinput debug\-gui" -tool creates a libinput context and a full-screen GTK window to visualize -events processed by libinput. This tool exclusively grabs pointing devices -and stops them from interacting with the rest of the GUI. -.PP -.B Hit Esc to exit this tool. -.PP -This is a debugging tool only, its output or behavior may change at any -time. Do not rely on the output or the behavior. -.PP -This tool usually needs to be run as root to have access to the -/dev/input/eventX nodes. -.SH OPTIONS -.TP 8 -.B \-\-device \fI/dev/input/event0\fR -Use the given device with the path backend. -.TP 8 -.B \-\-grab -Exclusively grab all opened devices. This will prevent events from being -delivered to the host system. -.TP 8 -.B \-\-help -Print help -.TP 8 -.B \-\-udev \fI\fR -Use the udev backend to listen for device notifications on the given seat. -The default behavior is equivalent to \-\-udev "seat0". -.TP 8 -.B \-\-verbose -Use verbose output -.PP -For libinput configuration options, see libinput-debug-events(1) -.SH NOTES -.PP -Events shown by this tool may not correspond to the events seen by a -different user of libinput. This tool initializes a separate context. -.SH LIBINPUT -Part of the -.B libinput(1) -suite diff -Nru libinput-1.10.3/tools/libinput-list-devices.c libinput-0.21.0/tools/libinput-list-devices.c --- libinput-1.10.3/tools/libinput-list-devices.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-list-devices.c 2015-07-31 01:50:42.000000000 +0000 @@ -21,8 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ -#include "config.h" - +#define _GNU_SOURCE #include #include #include @@ -49,18 +48,6 @@ } static const char * -drag_default(struct libinput_device *device) -{ - if (!libinput_device_config_tap_get_finger_count(device)) - return "n/a"; - - if (libinput_device_config_tap_get_default_drag_enabled(device)) - return "enabled"; - else - return "disabled"; -} - -static const char * draglock_default(struct libinput_device *device) { if (!libinput_device_config_tap_get_finger_count(device)) @@ -185,35 +172,6 @@ return str; } -static char* -accel_profiles(struct libinput_device *device) -{ - uint32_t profiles; - char *str; - enum libinput_config_accel_profile profile; - - if (!libinput_device_config_accel_is_available(device)) { - xasprintf(&str, "n/a"); - return str; - } - - profiles = libinput_device_config_accel_get_profiles(device); - if (profiles == LIBINPUT_CONFIG_ACCEL_PROFILE_NONE) { - xasprintf(&str, "none"); - return str; - } - - profile = libinput_device_config_accel_get_default_profile(device); - xasprintf(&str, - "%s%s %s%s", - (profile == LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT) ? "*" : "", - (profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT) ? "flat" : "", - (profile == LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE) ? "*" : "", - (profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE) ? "adaptive" : ""); - - return str; -} - static const char * dwt_default(struct libinput_device *device) { @@ -226,44 +184,6 @@ return "disabled"; } -static char * -rotation_default(struct libinput_device *device) -{ - char *str; - double angle; - - if (!libinput_device_config_rotation_is_available(device)) { - xasprintf(&str, "n/a"); - return str; - } - - angle = libinput_device_config_rotation_get_angle(device); - xasprintf(&str, "%.1f", angle); - return str; -} - -static void -print_pad_info(struct libinput_device *device) -{ - int nbuttons, nrings, nstrips, ngroups, nmodes; - struct libinput_tablet_pad_mode_group *group; - - nbuttons = libinput_device_tablet_pad_get_num_buttons(device); - nrings = libinput_device_tablet_pad_get_num_rings(device); - nstrips = libinput_device_tablet_pad_get_num_strips(device); - ngroups = libinput_device_tablet_pad_get_num_mode_groups(device); - - group = libinput_device_tablet_pad_get_mode_group(device, 0); - nmodes = libinput_tablet_pad_mode_group_get_num_modes(group); - - printf("Pad:\n"); - printf(" Rings: %d\n", nrings); - printf(" Strips: %d\n", nstrips); - printf(" Buttons: %d\n", nbuttons); - printf(" Mode groups: %d (%d modes)\n", ngroups, nmodes); - -} - static void print_device_notify(struct libinput_event *ev) { @@ -297,7 +217,7 @@ libinput_seat_get_logical_name(seat)); if (libinput_device_get_size(dev, &w, &h) == 0) - printf("Size: %.fx%.fmm\n", w, h); + printf("Size: %.2fx%.2fmm\n", w, h); printf("Capabilities: "); if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_KEYBOARD)) @@ -307,23 +227,10 @@ printf("pointer "); if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_TOUCH)) - printf("touch "); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_TABLET_TOOL)) - printf("tablet "); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_TABLET_PAD)) - printf("tablet-pad"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_GESTURE)) - printf("gesture"); - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_SWITCH)) - printf("switch"); + printf("touch"); printf("\n"); printf("Tap-to-click: %s\n", tap_default(dev)); - printf("Tap-and-drag: %s\n", drag_default(dev)); printf("Tap drag lock: %s\n", draglock_default(dev)); printf("Left-handed: %s\n", left_handed_default(dev)); printf("Nat.scrolling: %s\n", nat_scroll_default(dev)); @@ -342,39 +249,33 @@ printf("Disable-w-typing: %s\n", dwt_default(dev)); - str = accel_profiles(dev); - printf("Accel profiles: %s\n", str); - free(str); - - str = rotation_default(dev); - printf("Rotation: %s\n", str); - free(str); - - if (libinput_device_has_capability(dev, - LIBINPUT_DEVICE_CAP_TABLET_PAD)) - print_pad_info(dev); - printf("\n"); } static inline void usage(void) { - printf("Usage: libinput list-devices [--help|--version]\n"); - printf("\n" - "--help ...... show this help and exit\n" - "--version ... show version information and exit\n" - "\n"); + printf("Usage: %s [--help|--version]\n" + "\n" + "This tool creates a libinput context on the default seat \"seat0\"\n" + "and lists all devices recognized by libinput and the configuration options.\n" + "Where multiple options are possible, the default is prefixed with \"*\".\n" + "\n" + "Options:\n" + "--help ...... show this help\n" + "--version ... show version information\n" + "\n" + "This tool requires access to the /dev/input/eventX nodes.\n", + program_invocation_short_name); } int main(int argc, char **argv) { struct libinput *li; + struct tools_context context; struct libinput_event *ev; - /* This is kept for backwards-compatibility with the old - libinput-list-devices */ if (argc > 1) { if (streq(argv[1], "--help")) { usage(); @@ -388,7 +289,9 @@ } } - li = tools_open_backend(BACKEND_UDEV, "seat0", false, false); + tools_init_context(&context); + + li = tools_open_backend(&context); if (!li) return 1; @@ -404,5 +307,5 @@ libinput_unref(li); - return EXIT_SUCCESS; + return 0; } diff -Nru libinput-1.10.3/tools/libinput-list-devices.compat libinput-0.21.0/tools/libinput-list-devices.compat --- libinput-1.10.3/tools/libinput-list-devices.compat 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-list-devices.compat 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -#!/bin/sh - -echo "WARNING: This compatibility wrapper will be removed in the future. Please run 'libinput list-devices' instead" 1>&2 -exec libinput list-devices $@ diff -Nru libinput-1.10.3/tools/libinput-list-devices.man libinput-0.21.0/tools/libinput-list-devices.man --- libinput-1.10.3/tools/libinput-list-devices.man 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-list-devices.man 2015-07-15 04:18:08.000000000 +0000 @@ -1,25 +1,25 @@ -.TH libinput-list-devices "1" "" "libinput @LIBINPUT_VERSION@" "libinput Manual" +.TH LIBINPUT-LIST-DEVICES "1" .SH NAME -libinput\-list\-devices \- list local devices as recognized by libinput +libinput-list-devices \- list local devices as recognized by libinput .SH SYNOPSIS -.B libinput list\-devices [\-\-help] +.B libinput-list-devices [--help] .SH DESCRIPTION .PP The -.B "libinput list\-devices" +.I libinput-list-devices tool creates a libinput context on the default seat "seat0" and lists all -devices recognized by libinput. Each device shows available configurations +devices regonized by libinput. Each device shows available configurations the respective default configuration setting. .PP -For configuration options that allow multiple different settings -(e.g. scrolling), all available settings are listed. The default setting is +For configuration options that allow multiple different settings (e.g. +scrolling), all available settings are listed. The default setting is prefixed by an asterisk (*). .PP This tool usually needs to be run as root to have access to the /dev/input/eventX nodes. .SH OPTIONS .TP 8 -.B \-\-help +.B --help Print help .SH NOTES .PP @@ -32,10 +32,6 @@ .PP An xorg.conf(5) configuration entry or Wayland compositor setting may have changed configurations on a device. The -.B "libinput list\-devices" +.I libinput-list-devices tool only shows the device's default configuration, not the current configuration. -.SH LIBINPUT -Part of the -.B libinput(1) -suite diff -Nru libinput-1.10.3/tools/libinput.man libinput-0.21.0/tools/libinput.man --- libinput-1.10.3/tools/libinput.man 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput.man 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -.TH libinput "1" "" "libinput @LIBINPUT_VERSION@" "libinput Manual" -.SH NAME -libinput \- tool to interface with libinput -.SH SYNOPSIS -.B libinput [\-\-help|\-\-version] \fI\fR \fI[]\fR -.SH DESCRIPTION -.PP -libinput is a library to handle input devices and provides device -detection and input device event processing for most Wayland -compositors and the X.Org xf86-input-libinput driver. -.PP -The -.B "libinput" -tools are a set of tools to debug, interface with and analyze data for -libinput. These tools create libinput contexts separate from that of -the compositor/X server and cannot change settings in a running session. -See section -.B COMMANDS -for a list of available commands. -.PP -libinput's API documentation and details on features and various high-level -concepts are available online at -.I https://wayland.freedesktop.org/libinput/doc/latest/ -.PP -The man page for the X.Org xf86-input-libinput driver is -.B libinput(4). -.SH OPTIONS -.TP 8 -.B \-\-help -Print help and exit -.TP 8 -.B \-\-version -Print the version and exit -.SH COMMANDS -.TP 8 -.B libinput\-debug\-events(1) -Print all events as seen by libinput -.TP 8 -.B libinput\-debug\-gui(1) -Show a GUI to visualize libinput's events -.TP 8 -.B libinput\-list\-devices(1) -List all devices recognized by libinput -.TP 8 -.B libinput\-measure(1) -Measure various properties of devices -.TP 8 -.B libinput\-measure\-touch\-size(1) -Measure touch size and orientation -.TP 8 -.B libinput\-measure\-touchpad\-tap(1) -Measure tap-to-click time -.TP 8 -.B libinput\-measure\-touchpad\-pressure(1) -Measure touch pressure -.TP 8 -.B libinput\-measure\-trackpoint\-range(1) -Measure the delta range of a trackpoint -.SH LIBINPUT -Part of the -.B libinput(1) -suite -.PP -.SH SEE ALSO -libinput(4) -.PP -libinput's online documentation -.I https://wayland.freedesktop.org/libinput/doc/latest/ diff -Nru libinput-1.10.3/tools/libinput-measure.c libinput-0.21.0/tools/libinput-measure.c --- libinput-1.10.3/tools/libinput-measure.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-measure.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "shared.h" - -static inline void -usage(void) -{ - printf("Usage: libinput measure [--help] [/dev/input/event0]\n"); -} - -int -main(int argc, char **argv) -{ - int option_index = 0; - - while (1) { - int c; - static struct option opts[] = { - { "help", no_argument, 0, 'h' }, - { 0, 0, 0, 0} - }; - - c = getopt_long(argc, argv, "+h", opts, &option_index); - if (c == -1) - break; - - switch(c) { - case 'h': - usage(); - return EXIT_SUCCESS; - default: - usage(); - return EXIT_FAILURE; - } - } - - if (optind >= argc) { - usage(); - return EXIT_FAILURE; - } - - argc--; - argv++; - - return tools_exec_command("libinput-measure", argc, argv); -} diff -Nru libinput-1.10.3/tools/libinput-measure.man libinput-0.21.0/tools/libinput-measure.man --- libinput-1.10.3/tools/libinput-measure.man 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-measure.man 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -.TH libinput-measure "1" "" "libinput @LIBINPUT_VERSION@" "libinput Manual" -.SH NAME -libinput\-measure \- measure properties of devices -.SH SYNOPSIS -.B libinput measure [\-\-help] \fI []\fR -.SH DESCRIPTION -.PP -The -.B "libinput measure" -tool measures properties of one (or more) devices. Depending on what is to -be measured, this too may not create a libinput context. -.PP -This is a debugging tool only, its output may change at any time. Do not -rely on the output. -.PP -This tool usually needs to be run as root to have access to the -/dev/input/eventX nodes. -.SH OPTIONS -.TP 8 -.B \-\-help -Print help -.SH FEATURES -Features that can be measured include -.TP 8 -.B libinput\-measure\-touch\-size(1) -Measure touch size and orientation -.TP 8 -.B libinput\-measure\-touchpad\-tap\-time(1) -Measure tap-to-click time -.TP 8 -.B libinput\-measure\-touchpad\-pressure(1) -Measure touch pressure -.TP 8 -.B libinput\-measure\-trackpoint\-range(1) -Measure the delta range of a trackpoint. -.SH LIBINPUT -Part of the -.B libinput(1) -suite diff -Nru libinput-1.10.3/tools/libinput-measure-touchpad-pressure libinput-0.21.0/tools/libinput-measure-touchpad-pressure --- libinput-1.10.3/tools/libinput-measure-touchpad-pressure 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-measure-touchpad-pressure 1970-01-01 00:00:00.000000000 +0000 @@ -1,299 +0,0 @@ -#!/usr/bin/env python3 -# vim: set expandtab shiftwidth=4: -# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */ -# -# Copyright © 2017 Red Hat, Inc. -# -# 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 (including the next -# paragraph) 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 OR COPYRIGHT HOLDERS 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. -# - -import sys -import argparse -try: - import evdev - import evdev.ecodes - import pyudev -except ModuleNotFoundError as e: - print('Error: {}'.format(str(e)), file=sys.stderr) - print('One or more python modules are missing. Please install those ' - 'modules and re-run this tool.') - sys.exit(1) - - -class Range(object): - """Class to keep a min/max of a value around""" - def __init__(self): - self.min = float('inf') - self.max = float('-inf') - - def update(self, value): - self.min = min(self.min, value) - self.max = max(self.max, value) - - -class Touch(object): - """A single data point of a sequence (i.e. one event frame)""" - - def __init__(self, pressure=None): - self.pressure = pressure - - -class TouchSequence(object): - """A touch sequence from beginning to end""" - - def __init__(self, device, tracking_id): - self.device = device - self.tracking_id = tracking_id - self.points = [] - - self.is_active = True - - self.is_down = False - self.was_down = False - self.is_palm = False - self.was_palm = False - - self.prange = Range() - - def append(self, touch): - """Add a Touch to the sequence""" - self.points.append(touch) - self.prange.update(touch.pressure) - - if touch.pressure < self.device.up: - self.is_down = False - elif touch.pressure > self.device.down: - self.is_down = True - self.was_down = True - - self.is_palm = touch.pressure > self.device.palm - if self.is_palm: - self.was_palm = True - - def finalize(self): - """Mark the TouchSequence as complete (finger is up)""" - self.is_active = False - - def avg(self): - """Average pressure value of this sequence""" - return int(sum([p.pressure for p in self.points])/len(self.points)) - - def median(self): - """Median pressure value of this sequence""" - ps = sorted([p.pressure for p in self.points]) - idx = int(len(self.points)/2) - return ps[idx] - - def __str__(self): - return self._str_state() if self.is_active else self._str_summary() - - def _str_summary(self): - s = "Sequence {} pressure: "\ - "min: {:3d} max: {:3d} avg: {:3d} median: {:3d} tags:" \ - .format( - self.tracking_id, - self.prange.min, - self.prange.max, - self.avg(), - self.median() - ) - if self.was_down: - s += " down" - if self.was_palm: - s += " palm" - - return s - - def _str_state(self): - s = "Touchpad pressure: {:3d} min: {:3d} max: {:3d} tags: {} {}" \ - .format( - self.points[-1].pressure, - self.prange.min, - self.prange.max, - "down" if self.is_down else " ", - "palm" if self.is_palm else " " - ) - return s - - -class InvalidDeviceError(Exception): - pass - - -class Device(object): - def __init__(self, path): - if path is None: - self.path = self.find_touchpad_device() - else: - self.path = path - - self.device = evdev.InputDevice(self.path) - - print("Using {}: {}\n".format(self.device.name, self.path)) - - # capabilities rturns a dict with the EV_* codes as key, - # each of which is a list of tuples of (code, AbsInfo) - # - # Get the abs list first (or empty list if missing), - # then extract the pressure absinfo from that - all_caps = self.device.capabilities(absinfo=True) - caps = all_caps.get(evdev.ecodes.EV_ABS, []) - p = [cap[1] for cap in caps if cap[0] == evdev.ecodes.ABS_MT_PRESSURE] - if not p: - raise InvalidDeviceError("device does not have ABS_MT_PRESSURE") - - p = p[0] - prange = p.max - p.min - - # libinput defaults - self.up = int(p.min + 0.12 * prange) - self.down = int(p.min + 0.10 * prange) - self.palm = 130 # the libinput default - - self._init_thresholds_from_udev() - self.sequences = [] - - def find_touchpad_device(self): - context = pyudev.Context() - for device in context.list_devices(subsystem='input'): - if not device.get('ID_INPUT_TOUCHPAD', 0): - continue - - if not device.device_node or \ - not device.device_node.startswith('/dev/input/event'): - continue - - return device.device_node - print("Unable to find a touchpad device.", file=sys.stderr) - sys.exit(1) - - def _init_thresholds_from_udev(self): - context = pyudev.Context() - ud = pyudev.Devices.from_device_file(context, self.path) - v = ud.get('LIBINPUT_ATTR_PRESSURE_RANGE') - if v: - self.up, self.down = colon_tuple(v) - - v = ud.get('LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD') - if v: - self.palm = int(v) - - def start_new_sequence(self, tracking_id): - self.sequences.append(TouchSequence(self, tracking_id)) - - def current_sequence(self): - return self.sequences[-1] - - -def handle_key(device, event): - tapcodes = [ - evdev.ecodes.BTN_TOOL_DOUBLETAP, - evdev.ecodes.BTN_TOOL_TRIPLETAP, - evdev.ecodes.BTN_TOOL_QUADTAP, - evdev.ecodes.BTN_TOOL_QUINTTAP - ] - if event.code in tapcodes and event.value > 0: - print("\rThis tool cannot handle multiple fingers, " - "output will be invalid", file=sys.stderr) - - -def handle_abs(device, event): - if event.code == evdev.ecodes.ABS_MT_TRACKING_ID: - if event.value > -1: - device.start_new_sequence(event.value) - else: - s = device.current_sequence() - s.finalize() - print("\r{}".format(s)) - elif event.code == evdev.ecodes.ABS_MT_PRESSURE: - s = device.current_sequence() - s.append(Touch(pressure=event.value)) - print("\r{}".format(s), end="") - - -def handle_event(device, event): - if event.type == evdev.ecodes.EV_ABS: - handle_abs(device, event) - elif event.type == evdev.ecodes.EV_KEY: - handle_key(device, event) - - -def loop(device): - print("Ready for recording data.") - print("Pressure range used: {}:{}".format(device.down, device.up)) - print("Palm pressure range used: {}".format(device.palm)) - print("Place a single finger on the touchpad to measure pressure values.\n" - "Ctrl+C to exit\n") - - for event in device.device.read_loop(): - handle_event(device, event) - - -def colon_tuple(string): - try: - ts = string.split(':') - t = tuple([int(x) for x in ts]) - if len(t) == 2 and t[0] >= t[1]: - return t - except: - pass - - msg = "{} is not in format N:M (N >= M)".format(string) - raise argparse.ArgumentTypeError(msg) - - -def main(args): - parser = argparse.ArgumentParser( - description="Measure touchpad pressure values" - ) - parser.add_argument( - 'path', metavar='/dev/input/event0', nargs='?', type=str, - help='Path to device (optional)' - ) - parser.add_argument( - '--touch-thresholds', metavar='down:up', type=colon_tuple, - help='Thresholds when a touch is logically down or up' - ) - parser.add_argument( - '--palm-threshold', metavar='t', type=int, - help='Threshold when a touch is a palm' - ) - args = parser.parse_args() - - try: - device = Device(args.path) - - if args.touch_thresholds is not None: - device.down, device.up = args.touch_thresholds - - if args.palm_threshold is not None: - device.palm = args.palm_threshold - - loop(device) - except KeyboardInterrupt: - pass - except (PermissionError, OSError): - print("Error: failed to open device") - except InvalidDeviceError as e: - print("Error: {}".format(e)) - - -if __name__ == "__main__": - main(sys.argv) diff -Nru libinput-1.10.3/tools/libinput-measure-touchpad-pressure.man libinput-0.21.0/tools/libinput-measure-touchpad-pressure.man --- libinput-1.10.3/tools/libinput-measure-touchpad-pressure.man 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-measure-touchpad-pressure.man 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -.TH libinput-measure-touchpad-pressure "1" -.SH NAME -libinput\-measure\-touchpad\-pressure \- measure pressure properties of devices -.SH SYNOPSIS -.B libinput measure touchpad\-pressure [\-\-help] [options] -[\fI/dev/input/event0\fI] -.SH DESCRIPTION -.PP -The -.B "libinput measure touchpad\-pressure" -tool measures the pressure of touches on a touchpad. This is -an interactive tool. When executed, the tool will prompt the user to -interact with the touchpad. On termination, the tool prints a summary of the -pressure values seen. This data should be attached to any -pressure\-related bug report. -.PP -For a full description on how libinput's pressure-to-click behavior works, see -the online documentation here: -.I https://wayland.freedesktop.org/libinput/doc/latest/touchpad_pressure.html -and -.I https://wayland.freedesktop.org/libinput/doc/latest/palm_detection.html -.PP -This is a debugging tool only, its output may change at any time. Do not -rely on the output. -.PP -This tool usually needs to be run as root to have access to the -/dev/input/eventX nodes. -.SH OPTIONS -If a device node is given, this tool opens that device node. Otherwise, this -tool searches for the first node that looks like a touchpad and uses that -node. -.TP 8 -.B \-\-help -Print help -.TP 8 -.B \-\-touch\-thresholds=\fI"down:up"\fR -Set the logical touch pressure thresholds to -.I down -and -.I up, -respectively. When a touch exceeds the pressure in -.I down -it is considered logically down. If a touch is logically down and goes below -the pressure in -.I up, -it is considered logically up. The thresholds have to be in -device-specific pressure values and it is required that -.I down ->= -.I up. -.TP 8 -.B \-\-palm\-threshold=\fIN\fR -Assume a palm threshold of -.I N. -The threshold has to be in device-specific pressure values. -.PP -If the touch-thresholds or the palm-threshold are not provided, -this tool uses the thresholds provided by the udev hwdb (if any) or the -built-in defaults. -.SH LIBINPUT -Part of the -.B libinput(1) -suite diff -Nru libinput-1.10.3/tools/libinput-measure-touchpad-tap libinput-0.21.0/tools/libinput-measure-touchpad-tap --- libinput-1.10.3/tools/libinput-measure-touchpad-tap 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-measure-touchpad-tap 1970-01-01 00:00:00.000000000 +0000 @@ -1,264 +0,0 @@ -#!/usr/bin/env python3 -# vim: set expandtab shiftwidth=4: -# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */ -# -# Copyright © 2017 Red Hat, Inc. -# -# 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 (including the next -# paragraph) 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 OR COPYRIGHT HOLDERS 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. -# - -import sys -import argparse -try: - import evdev - import evdev.ecodes - import textwrap - import pyudev -except ModuleNotFoundError as e: - print('Error: {}'.format(e), file=sys.stderr) - print('One or more python modules are missing. Please install those ' - 'modules and re-run this tool.') - sys.exit(1) - -print_dest = sys.stdout - - -def error(msg, **kwargs): - print(msg, **kwargs, file=sys.stderr) - - -def msg(msg, **kwargs): - print(msg, **kwargs, file=print_dest, flush=True) - - -def tv2us(sec, usec): - return sec * 1000000 + usec - - -def us2ms(us): - return int(us/1000) - - -class Touch(object): - def __init__(self, down): - self._down = down - self._up = down - - @property - def up(self): - return us2ms(self._up) - - @up.setter - def up(self, up): - assert(up > self.down) - self._up = up - - @property - def down(self): - return us2ms(self._down) - - @property - def tdelta(self): - return self.up - self.down - - -class InvalidDeviceError(Exception): - pass - - -class Device(object): - def __init__(self, path): - if path is None: - self.path = self._find_touch_device() - else: - self.path = path - - self.device = evdev.InputDevice(self.path) - - print("Using {}: {}\n".format(self.device.name, self.path)) - - # capabilities returns a dict with the EV_* codes as key, - # each of which is a list of tuples of (code, AbsInfo) - # - # Get the abs list first (or empty list if missing), - # then extract the pressure absinfo from that - codes = self.device.capabilities(absinfo=True).get( - evdev.ecodes.EV_KEY, [] - ) - - if evdev.ecodes.BTN_TOUCH not in codes: - raise InvalidDeviceError("device does not have BTN_TOUCH") - - self.touches = [] - - def _find_touch_device(self): - context = pyudev.Context() - device_node = None - for device in context.list_devices(subsystem='input'): - if (not device.device_node or - not device.device_node.startswith('/dev/input/event')): - continue - - # pick the touchpad by default, fallback to the first - # touchscreen only when there is no touchpad - if device.get('ID_INPUT_TOUCHPAD', 0): - device_node = device.device_node - break - - if device.get('ID_INPUT_TOUCHSCREEN', 0) and device_node is None: - device_node = device.device_node - - if device_node is not None: - return device_node - - error("Unable to find a touch device.") - sys.exit(1) - - def handle_btn_touch(self, event): - if event.value != 0: - t = Touch(tv2us(event.sec, event.usec)) - self.touches.append(t) - else: - self.touches[-1].up = tv2us(event.sec, event.usec) - msg("\rTouch sequences detected: {}".format(len(self.touches)), - end='') - - def handle_key(self, event): - tapcodes = [evdev.ecodes.BTN_TOOL_DOUBLETAP, - evdev.ecodes.BTN_TOOL_TRIPLETAP, - evdev.ecodes.BTN_TOOL_QUADTAP, - evdev.ecodes.BTN_TOOL_QUINTTAP] - if event.code in tapcodes and event.value > 0: - error("\rThis tool cannot handle multiple fingers, " - "output will be invalid") - return - - if event.code == evdev.ecodes.BTN_TOUCH: - self.handle_btn_touch(event) - - def handle_syn(self, event): - if self.touch.dirty: - self.current_sequence().append(self.touch) - self.touch = Touch(major=self.touch.major, - minor=self.touch.minor, - orientation=self.touch.orientation) - - def handle_event(self, event): - if event.type == evdev.ecodes.EV_KEY: - self.handle_key(event) - - def read_events(self): - for event in self.device.read_loop(): - self.handle_event(event) - - def print_summary(self): - deltas = sorted(t.tdelta for t in self.touches) - - dmax = max(deltas) - dmin = min(deltas) - - l = len(deltas) - - davg = sum(deltas)/l - dmedian = deltas[int(l/2)] - d95pc = deltas[int(l * 0.95)] - d90pc = deltas[int(l * 0.90)] - - print("Time: ") - print(" Max delta: {}ms".format(int(dmax))) - print(" Min delta: {}ms".format(int(dmin))) - print(" Average delta: {}ms".format(int(davg))) - print(" Median delta: {}ms".format(int(dmedian))) - print(" 90th percentile: {}ms".format(int(d90pc))) - print(" 95th percentile: {}ms".format(int(d95pc))) - - def print_dat(self): - print("# libinput-measure-touchpad-tap") - print(textwrap.dedent('''\ - # File contents: - # This file contains multiple prints of the data in - # different sort order. Row number is index of touch - # point within each group. Comparing data across groups - # will result in invalid analysis. - # Columns (1-indexed): - # Group 1, sorted by time of occurence - # 1: touch down time in ms, offset by first event - # 2: touch up time in ms, offset by first event - # 3: time delta in ms); - # Group 2, sorted by touch down-up delta time (ascending) - # 4: touch down time in ms, offset by first event - # 5: touch up time in ms, offset by first event - # 6: time delta in ms - ''')) - - deltas = [t for t in self.touches] - deltas_sorted = sorted(deltas, key=lambda t: t.tdelta) - - offset = deltas[0].down - - for t1, t2 in zip(deltas, deltas_sorted): - print(t1.down - offset, t1.up - offset, t1.tdelta, - t2.down - offset, t2.up - offset, t2.tdelta) - - def print(self, format): - if not self.touches: - error("No tap data available") - return - - if format == 'summary': - self.print_summary() - elif format == 'dat': - self.print_dat() - - -def main(args): - parser = argparse.ArgumentParser( - description="Measure tap-to-click properties of devices" - ) - parser.add_argument('path', metavar='/dev/input/event0', - nargs='?', type=str, help='Path to device (optional)') - parser.add_argument('--format', metavar='format', - choices=['summary', 'dat'], - default='summary', - help='data format to print ("summary" or "dat")') - args = parser.parse_args() - - if not sys.stdout.isatty(): - global print_dest - print_dest = sys.stderr - - try: - device = Device(args.path) - error("Ready for recording data.\n" - "Tap the touchpad multiple times with a single finger only.\n" - "For useful data we recommend at least 20 taps.\n" - "Ctrl+C to exit") - device.read_events() - except KeyboardInterrupt: - msg('') - device.print(args.format) - except (PermissionError, OSError) as e: - error("Error: failed to open device. {}".format(e)) - except InvalidDeviceError as e: - error("Error: {}".format(e)) - - -if __name__ == "__main__": - main(sys.argv) diff -Nru libinput-1.10.3/tools/libinput-measure-touchpad-tap.man libinput-0.21.0/tools/libinput-measure-touchpad-tap.man --- libinput-1.10.3/tools/libinput-measure-touchpad-tap.man 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-measure-touchpad-tap.man 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -.TH libinput-measure-touchpad-tap "1" "" "libinput @LIBINPUT_VERSION@" "libinput Manual" -.SH NAME -libinput\-measure\-touchpad\-tap \- measure tap-to-click properties of devices -.SH SYNOPSIS -.B libinput measure touchpad\-tap [\-\-help] [\-\-format=\fI\fB] \fI[/dev/input/event0]\fR -.SH DESCRIPTION -.PP -The -.B "libinput measure touchpad\-tap" -tool measures properties of the tap\-to\-click behavior of the user. This is -an interactive tool. When executed, the tool will prompt the user to -interact with the touchpad. On termination, the tool prints a summary of the -tap interactions seen. This data should be attached to any tap\-related bug -report. -.PP -For a full description on how libinput's tap-to-click behavior works, see -the online documentation here: -.I https://wayland.freedesktop.org/libinput/doc/latest/tapping.html -.PP -This is a debugging tool only, its output may change at any time. Do not -rely on the output. -.PP -This tool usually needs to be run as root to have access to the -/dev/input/eventX nodes. -.SH OPTIONS -If a device node is given, this tool opens that device node. Otherwise, this -tool searches for the first node that looks like a touchpad and uses that -node. -.TP 8 -.B \-\-help -Print help -.TP 8 -.B \-\-format=summary|dat -Specify the data format to be printed. The default (or if -.B \-\-format -is omitted) is "summary". See section -.B DATA FORMATS - -.SH DATA FORMATS -This section describes the data formats printed with the -.B \-\-format -commandline argument. Note that any of the output may change at any time. -.RE -.PP -summary -.RS 4 -The -.I summary -format prints a summary of the data collected. This format is useful to -get a quick overview of a user's tapping behavior and why some taps may or -may not be detected. -.RE -.PP -dat -.RS 4 -The -.I dat -format prints the touch sequence data (raw and processed) in column-style -format, suitable for processing by other tools such as -.B gnuplot(1). -The data is aligned in one row per touch with each column containing a -separate data entry. -.B libinput\-measure\-touchpad\-tap -prints comments at the top of the file to describe each column. -.PP -.B WARNING: -The data contained in the output is grouped by different sort orders. For -example, the first few columns may list tap information in the 'natural' -sort order (i.e. as they occured), the data in the next few columns may list -tap information sorted by the delta time between touch down and touch up. -Comparing columns across these group boundaries will compare data of two -different touch points and result in invalid analysis. -.SH BUGS -This tool does not take finger pressure into account. The tap it detects may -be different to those detected by libinput if libinput's pressure thresholds -differ significantly to the kernel's pressure thresholds. -.SH LIBINPUT -Part of the -.B libinput(1) -suite diff -Nru libinput-1.10.3/tools/libinput-measure-touch-size libinput-0.21.0/tools/libinput-measure-touch-size --- libinput-1.10.3/tools/libinput-measure-touch-size 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-measure-touch-size 1970-01-01 00:00:00.000000000 +0000 @@ -1,345 +0,0 @@ -#!/usr/bin/env python3 -# vim: set expandtab shiftwidth=4: -# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */ -# -# Copyright © 2017 Red Hat, Inc. -# -# 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 (including the next -# paragraph) 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 OR COPYRIGHT HOLDERS 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. -# - -import sys -import argparse -try: - import evdev - import evdev.ecodes - import pyudev -except ModuleNotFoundError as e: - print('Error: {}'.format(str(e)), file=sys.stderr) - print('One or more python modules are missing. Please install those ' - 'modules and re-run this tool.') - sys.exit(1) - - -class Range(object): - """Class to keep a min/max of a value around""" - def __init__(self): - self.min = float('inf') - self.max = float('-inf') - - def update(self, value): - self.min = min(self.min, value) - self.max = max(self.max, value) - - -class Touch(object): - """A single data point of a sequence (i.e. one event frame)""" - - def __init__(self, major=None, minor=None, orientation=None): - self._major = major - self._minor = minor - self._orientation = orientation - self.dirty = False - - @property - def major(self): - return self._major - - @major.setter - def major(self, major): - self._major = major - self.dirty = True - - @property - def minor(self): - return self._minor - - @minor.setter - def minor(self, minor): - self._minor = minor - self.dirty = True - - @property - def orientation(self): - return self._orientation - - @orientation.setter - def orientation(self, orientation): - self._orientation = orientation - self.dirty = True - - def __str__(self): - s = "Touch: major {:3d}".format(self.major) - if self.minor is not None: - s += ", minor {:3d}".format(self.minor) - if self.orientation is not None: - s += ", orientation {:+3d}".format(self.orientation) - return s - - -class TouchSequence(object): - """A touch sequence from beginning to end""" - - def __init__(self, device, tracking_id): - self.device = device - self.tracking_id = tracking_id - self.points = [] - - self.is_active = True - - self.is_down = False - self.was_down = False - self.is_palm = False - self.was_palm = False - - self.major_range = Range() - self.minor_range = Range() - - def append(self, touch): - """Add a Touch to the sequence""" - self.points.append(touch) - self.major_range.update(touch.major) - self.minor_range.update(touch.minor) - - if touch.major < self.device.up or \ - touch.minor < self.device.up: - self.is_down = False - elif touch.major > self.device.down or \ - touch.minor > self.device.down: - self.is_down = True - self.was_down = True - - self.is_palm = touch.major > self.device.palm - if self.is_palm: - self.was_palm = True - - def finalize(self): - """Mark the TouchSequence as complete (finger is up)""" - self.is_active = False - - def avg(self): - """Average pressure value of this sequence""" - return int(sum([p.pressure for p in self.points])/len(self.points)) - - def median(self): - """Median pressure value of this sequence""" - ps = sorted([p.pressure for p in self.points]) - idx = int(len(self.points)/2) - return ps[idx] - - def __str__(self): - return self._str_state() if self.is_active else self._str_summary() - - def _str_summary(self): - if not self.points: - return "Sequence: no major/minor values recorded" - - s = "Sequence: major: [{:3d}..{:3d}] ".format( - self.major_range.min, self.major_range.max - ) - if self.device.has_minor: - s += "minor: [{:3d}..{:3d}] ".format( - self.minor_range.min, self.minor_range.max - ) - if self.was_down: - s += " down" - if self.was_palm: - s += " palm" - - return s - - def _str_state(self): - touch = self.points[-1] - s = "{}, tags: {} {}".format( - touch, - "down" if self.is_down else " ", - "palm" if self.is_palm else " " - ) - return s - - -class InvalidDeviceError(Exception): - pass - - -class Device(object): - def __init__(self, path): - if path is None: - self.path = self.find_touch_device() - else: - self.path = path - - self.device = evdev.InputDevice(self.path) - - print("Using {}: {}\n".format(self.device.name, self.path)) - - # capabilities returns a dict with the EV_* codes as key, - # each of which is a list of tuples of (code, AbsInfo) - # - # Get the abs list first (or empty list if missing), - # then extract the pressure absinfo from that - caps = self.device.capabilities(absinfo=True).get( - evdev.ecodes.EV_ABS, [] - ) - codes = [cap[0] for cap in caps] - - if evdev.ecodes.ABS_MT_TOUCH_MAJOR not in codes: - raise InvalidDeviceError("device does not have ABS_MT_TOUCH_MAJOR") - - self.has_minor = evdev.ecodes.ABS_MT_TOUCH_MINOR in codes - self.has_orientation = evdev.ecodes.ABS_MT_ORIENTATION in codes - - self.up = 0 - self.down = 0 - self.palm = 0 - - self._init_thresholds_from_udev() - self.sequences = [] - self.touch = Touch(0, 0) - - def find_touch_device(self): - context = pyudev.Context() - for device in context.list_devices(subsystem='input'): - if not device.get('ID_INPUT_TOUCHPAD', 0) and \ - not device.get('ID_INPUT_TOUCHSCREEN', 0): - continue - - if not device.device_node or \ - not device.device_node.startswith('/dev/input/event'): - continue - - return device.device_node - - print("Unable to find a touch device.", file=sys.stderr) - sys.exit(1) - - def _init_thresholds_from_udev(self): - context = pyudev.Context() - ud = pyudev.Devices.from_device_file(context, self.path) - v = ud.get('LIBINPUT_ATTR_TOUCH_SIZE_RANGE') - if v: - self.down, self.up = colon_tuple(v) - - v = ud.get('LIBINPUT_ATTR_PALM_SIZE_THRESHOLD') - if v: - self.palm = int(v) - - def start_new_sequence(self, tracking_id): - self.sequences.append(TouchSequence(self, tracking_id)) - - def current_sequence(self): - return self.sequences[-1] - - def handle_key(self, event): - tapcodes = [evdev.ecodes.BTN_TOOL_DOUBLETAP, - evdev.ecodes.BTN_TOOL_TRIPLETAP, - evdev.ecodes.BTN_TOOL_QUADTAP, - evdev.ecodes.BTN_TOOL_QUINTTAP] - if event.code in tapcodes and event.value > 0: - print("\rThis tool cannot handle multiple fingers, " - "output will be invalid", file=sys.stderr) - - def handle_abs(self, event): - if event.code == evdev.ecodes.ABS_MT_TRACKING_ID: - if event.value > -1: - self.start_new_sequence(event.value) - else: - s = self.current_sequence() - s.finalize() - print("\r{}".format(s)) - elif event.code == evdev.ecodes.ABS_MT_TOUCH_MAJOR: - self.touch.major = event.value - elif event.code == evdev.ecodes.ABS_MT_TOUCH_MINOR: - self.touch.minor = event.value - elif event.code == evdev.ecodes.ABS_MT_ORIENTATION: - self.touch.orientation = event.value - - def handle_syn(self, event): - if self.touch.dirty: - self.current_sequence().append(self.touch) - print("\r{}".format(self.current_sequence()), end="") - self.touch = Touch(major=self.touch.major, - minor=self.touch.minor, - orientation=self.touch.orientation) - - def handle_event(self, event): - if event.type == evdev.ecodes.EV_ABS: - self.handle_abs(event) - elif event.type == evdev.ecodes.EV_KEY: - self.handle_key(event) - elif event.type == evdev.ecodes.EV_SYN: - self.handle_syn(event) - - def read_events(self): - print("Ready for recording data.") - print("Touch sizes used: {}:{}".format(self.down, self.up)) - print("Palm size used: {}".format(self.palm)) - print("Place a single finger on the device to measure touch size.\n" - "Ctrl+C to exit\n") - - for event in self.device.read_loop(): - self.handle_event(event) - - -def colon_tuple(string): - try: - ts = string.split(':') - t = tuple([int(x) for x in ts]) - if len(t) == 2 and t[0] >= t[1]: - return t - except: - pass - - msg = "{} is not in format N:M (N >= M)".format(string) - raise argparse.ArgumentTypeError(msg) - - -def main(args): - parser = argparse.ArgumentParser( - description="Measure touch size and orientation" - ) - parser.add_argument('path', metavar='/dev/input/event0', - nargs='?', type=str, help='Path to device (optional)') - parser.add_argument('--touch-thresholds', metavar='down:up', - type=colon_tuple, - help='Thresholds when a touch is logically down or up') - parser.add_argument('--palm-threshold', metavar='t', - type=int, help='Threshold when a touch is a palm') - args = parser.parse_args() - - try: - device = Device(args.path) - - if args.touch_thresholds is not None: - device.down, device.up = args.touch_thresholds - - if args.palm_threshold is not None: - device.palm = args.palm_threshold - - device.read_events() - except KeyboardInterrupt: - pass - except (PermissionError, OSError): - print("Error: failed to open device") - except InvalidDeviceError as e: - print("Error: {}".format(e)) - - -if __name__ == "__main__": - main(sys.argv) diff -Nru libinput-1.10.3/tools/libinput-measure-touch-size.man libinput-0.21.0/tools/libinput-measure-touch-size.man --- libinput-1.10.3/tools/libinput-measure-touch-size.man 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-measure-touch-size.man 1970-01-01 00:00:00.000000000 +0000 @@ -1,57 +0,0 @@ -.TH libinput-measure-touch-size "1" -.SH NAME -libinput\-measure\-touch-size \- measure touch size and orientation of devices -.SH SYNOPSIS -.B libinput measure touch\-size [\-\-help] [options] -[\fI/dev/input/event0\fI] -.SH DESCRIPTION -.PP -The -.B "libinput measure touch\-size" -tool measures the size and orientation of a touch as provided by the kernel. -This is an interactive tool. When executed, the tool will prompt the user to -interact with the touch device. On termination, the tool prints a summary of the -values seen. This data should be attached to any -touch\-size\-related bug report. -.PP -This is a debugging tool only, its output may change at any time. Do not -rely on the output. -.PP -This tool usually needs to be run as root to have access to the -/dev/input/eventX nodes. -.SH OPTIONS -If a device node is given, this tool opens that device node. Otherwise, this -tool searches for the first node that looks like a touch-capable device and -uses that node. -.TP 8 -.B \-\-help -Print help -.TP 8 -.B \-\-touch\-thresholds=\fI"down:up"\fR -Set the logical touch size thresholds to -.I down -and -.I up, -respectively. When a touch exceeds the size in -.I down -it is considered logically down. If a touch is logically down and goes below -the size in -.I up, -it is considered logically up. The thresholds have to be in -device-specific pressure values and it is required that -.I down ->= -.I up. -.TP 8 -.B \-\-palm\-threshold=\fIN\fR -Assume a palm threshold of -.I N. -The threshold has to be in device-specific pressure values. -.PP -If the touch-thresholds or the palm-threshold are not provided, -this tool uses the thresholds provided by the udev hwdb (if any) or the -built-in defaults. -.SH LIBINPUT -Part of the -.B libinput(1) -suite diff -Nru libinput-1.10.3/tools/libinput-measure-trackpoint-range libinput-0.21.0/tools/libinput-measure-trackpoint-range --- libinput-1.10.3/tools/libinput-measure-trackpoint-range 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-measure-trackpoint-range 1970-01-01 00:00:00.000000000 +0000 @@ -1,200 +0,0 @@ -#!/usr/bin/env python3 -# vim: set expandtab shiftwidth=4: -# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */ -# -# Copyright © 2017 Red Hat, Inc. -# -# 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 (including the next -# paragraph) 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 OR COPYRIGHT HOLDERS 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. -# - -import sys -import argparse -try: - import evdev - import evdev.ecodes - import pyudev -except ModuleNotFoundError as e: - print('Error: {}'.format(str(e)), file=sys.stderr) - print('One or more python modules are missing. Please install those ' - 'modules and re-run this tool.') - sys.exit(1) - -MINIMUM_EVENT_COUNT = 1000 - - -class InvalidDeviceError(Exception): - pass - - -class Delta(object): - def __init__(self, x=0, y=0): - self.x = x - self.y = y - - def __bool_(self): - return self.x != 0 or self.y != 0 - - -class Device(object): - def __init__(self, path): - if path is None: - path = self._find_trackpoint_device() - self.path = path - - self.device = evdev.InputDevice(self.path) - - print("Using {}: {}\n".format(self.device.name, path)) - - self.deltas = [] - self.nxdeltas = 0 - self.nydeltas = 0 - - self.current_delta = Delta() - self.max_delta = Delta(0, 0) - - def _find_trackpoint_device(self): - context = pyudev.Context() - for device in context.list_devices(subsystem='input'): - if not device.get('ID_INPUT_POINTINGSTICK', 0): - continue - - if not device.device_node or \ - not device.device_node.startswith('/dev/input/event'): - continue - - return device.device_node - - raise InvalidDeviceError("Unable to find a trackpoint device") - - def handle_rel(self, event): - if event.code == evdev.ecodes.REL_X: - self.current_delta.x = event.value - if self.max_delta.x < abs(event.value): - self.max_delta.x = abs(event.value) - elif event.code == evdev.ecodes.REL_Y: - self.current_delta.y = event.value - if self.max_delta.y < abs(event.value): - self.max_delta.y = abs(event.value) - - def handle_syn(self, event): - self.deltas.append(self.current_delta) - if self.current_delta.x != 0: - self.nxdeltas += 1 - if self.current_delta.y != 0: - self.nydeltas += 1 - - self.current_delta = Delta() - - print("\rTrackpoint sends: max x:{:3d}, max y:{:3} samples [{}, {}]" - .format( - self.max_delta.x, self.max_delta.y, - self.nxdeltas, self.nydeltas, - ), end="") - - def read_events(self): - for event in self.device.read_loop(): - if event.type == evdev.ecodes.EV_REL: - self.handle_rel(event) - elif event.type == evdev.ecodes.EV_SYN: - self.handle_syn(event) - - def print_summary(self): - print("\n") # undo the \r from the status line - if not self.deltas: - return - - if len(self.deltas) < MINIMUM_EVENT_COUNT: - print("WARNING: *******************************************\n" - "WARNING: Insufficient samples, data is not reliable\n" - "WARNING: *******************************************\n") - - print("Histogram for x axis deltas, in counts of 5") - xs = [d.x for d in self.deltas] - minx = min(xs) - maxx = max(xs) - for i in range(minx, maxx + 1): - xc = len([x for x in xs if x == i]) - xc = int(xc/5) # counts of 5 is enough - print("{:4}: {}".format(i, "+" * xc, end="")) - - print("Histogram for y axis deltas, in counts of 5") - ys = [d.y for d in self.deltas] - miny = min(ys) - maxy = max(ys) - for i in range(miny, maxy + 1): - yc = len([y for y in ys if y == i]) - yc = int(yc/5) # counts of 5 is enough - print("{:4}: {}".format(i, "+" * yc, end="")) - - axs = sorted([abs(x) for x in xs]) - ays = sorted([abs(y) for y in ys]) - - avgx = int(sum(axs)/len(axs)) - avgy = int(sum(ays)/len(ays)) - - medx = axs[int(len(axs)/2)] - medy = ays[int(len(ays)/2)] - - pc95x = axs[int(len(axs) * 0.95)] - pc95y = ays[int(len(ays) * 0.95)] - - print("Average for abs deltas: x: {:3} y: {:3}".format(avgx, avgy)) - print("Median for abs deltas: x: {:3} y: {:3}".format(medx, medy)) - print("95% percentile for abs deltas: x: {:3} y: {:3}" - .format(pc95x, pc95y) - ) - - -def main(args): - parser = argparse.ArgumentParser( - description="Measure the trackpoint delta coordinate range" - ) - parser.add_argument('path', metavar='/dev/input/event0', - nargs='?', type=str, help='Path to device (optional)') - - args = parser.parse_args() - - try: - device = Device(args.path) - - print( - "This tool measures the commonly used pressure range of the\n" - "trackpoint. Push the trackpoint:\n" - "- Four times around the screen edges\n" - "- From the top left to the bottom right and back, twice\n" - "- From the top right to the bottom left and back, twice\n" - "A minimum of {} events for each axis is required\n" - "\n" - "Movements should emulate fast pointer movement on the screen\n" - "but not use excessive pressure that would not be used\n" - "during day-to-day movement. For best results, run this tool \n" - "several times to get an idea of the common range.\n" - "\n".format(MINIMUM_EVENT_COUNT)) - device.read_events() - except KeyboardInterrupt: - device.print_summary() - except (PermissionError, OSError): - print("Error: failed to open device. Are you running as root?") - except InvalidDeviceError as e: - print("Error: {}".format(e)) - - -if __name__ == "__main__": - main(sys.argv) diff -Nru libinput-1.10.3/tools/libinput-measure-trackpoint-range.man libinput-0.21.0/tools/libinput-measure-trackpoint-range.man --- libinput-1.10.3/tools/libinput-measure-trackpoint-range.man 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-measure-trackpoint-range.man 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -.TH LIBINPUT-MEASURE-TRACKPOINT-RANGE "1" "" "libinput @LIBINPUT_VERSION@" "libinput Manual" -.SH NAME -libinput\-measure\-trackpoint\-range \- measure the delta range of a trackpoint -.SH SYNOPSIS -.B libinput measure trackpoint\-range [\-\-help] [/dev/input/event0] -.SH DESCRIPTION -.PP -The -.B "libinput measure trackpoint\-range" -tool measures the delta range of a trackpoint. This is -an interactive tool. When executed, the tool will prompt the user to -interact with the trackpoint. On termination, the tool prints a summary of -the trackpoint deltas seen. This data should be attached to any bug report -relating to the trackpoint's speed. -.PP -This is a debugging tool only, its output may change at any time. Do not -rely on the output. -.PP -This tool usually needs to be run as root to have access to the -/dev/input/eventX nodes. -.SH OPTIONS -If a device node is given, this tool opens that device node. Otherwise, this -tool searches for the first node that looks like a trackpoint and uses that -node. -.TP 8 -.B \-\-help -Print help -.SH LIBINPUT -Part of the -.B libinput(1) -suite diff -Nru libinput-1.10.3/tools/libinput-tool.c libinput-0.21.0/tools/libinput-tool.c --- libinput-1.10.3/tools/libinput-tool.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/libinput-tool.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ -/* - * Copyright © 2017 Red Hat, Inc. - * - * 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 (including the next - * paragraph) 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 OR COPYRIGHT HOLDERS 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. - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "shared.h" -static void -usage(void) -{ - printf("Usage: libinput [--help|--version] []\n" - "\n" - "Global options:\n" - " --help ...... show this help and exit\n" - " --version ... show version information and exit\n" - "\n" - "Commands:\n" - " list-devices\n" - " List all devices with their default configuration options\n" - "\n" - " debug-events\n" - " Print events to stdout\n" - "\n" - " debug-gui\n" - " Display a simple GUI to visualize libinput's events.\n" - "\n" - " measure \n" - " Measure various device properties. See the man page for more info\n" - "\n"); -} - -enum global_opts { - GOPT_HELP = 1, - GOPT_VERSION, -}; - -int -main(int argc, char **argv) -{ - int option_index = 0; - - while (1) { - int c; - static struct option opts[] = { - { "help", no_argument, 0, GOPT_HELP }, - { "version", no_argument, 0, GOPT_VERSION }, - { 0, 0, 0, 0} - }; - - c = getopt_long(argc, argv, "+h", opts, &option_index); - if (c == -1) - break; - - switch(c) { - case 'h': - case GOPT_HELP: - usage(); - return EXIT_SUCCESS; - case GOPT_VERSION: - printf("%s\n", LIBINPUT_VERSION); - return EXIT_SUCCESS; - default: - usage(); - return EXIT_FAILURE; - } - } - - if (optind >= argc) { - usage(); - return EXIT_FAILURE; - } - - argv += optind; - argc -= optind; - - return tools_exec_command("libinput", argc, argv); -} diff -Nru libinput-1.10.3/tools/Makefile.am libinput-0.21.0/tools/Makefile.am --- libinput-1.10.3/tools/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/tools/Makefile.am 2015-07-15 04:18:08.000000000 +0000 @@ -0,0 +1,41 @@ +noinst_PROGRAMS = event-debug ptraccel-debug +bin_PROGRAMS = libinput-list-devices libinput-debug-events +noinst_LTLIBRARIES = libshared.la + +AM_CPPFLAGS = -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + -I$(top_builddir)/src # for libinput-version.h + +libshared_la_SOURCES = \ + shared.c \ + shared.h +libshared_la_CFLAGS = $(LIBEVDEV_CFLAGS) +libshared_la_LIBADD = $(LIBEVDEV_LIBS) + +event_debug_SOURCES = event-debug.c +event_debug_LDADD = ../src/libinput.la libshared.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS) +event_debug_LDFLAGS = -no-install +event_debug_CFLAGS = $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS) + +ptraccel_debug_SOURCES = ptraccel-debug.c +ptraccel_debug_LDADD = ../src/libfilter.la +ptraccel_debug_LDFLAGS = -no-install + +libinput_list_devices_SOURCES = libinput-list-devices.c +libinput_list_devices_LDADD = ../src/libinput.la libshared.la $(LIBUDEV_LIBS) +libinput_list_devices_CFLAGS = $(LIBUDEV_CFLAGS) +dist_man1_MANS = libinput-list-devices.man + +libinput_debug_events_SOURCES = $(event_debug_SOURCES) +libinput_debug_events_LDADD = $(event_debug_LDADD) +libinput_debug_events_CFLAGS = $(event_debug_CFLAGS) +dist_man1_MANS += libinput-debug-events.man + +if BUILD_EVENTGUI +noinst_PROGRAMS += event-gui + +event_gui_SOURCES = event-gui.c +event_gui_LDADD = ../src/libinput.la libshared.la $(CAIRO_LIBS) $(GTK_LIBS) $(LIBUDEV_LIBS) +event_gui_CFLAGS = $(CAIRO_CFLAGS) $(GTK_CFLAGS) $(LIBUDEV_CFLAGS) +event_gui_LDFLAGS = -no-install +endif diff -Nru libinput-1.10.3/tools/Makefile.in libinput-0.21.0/tools/Makefile.in --- libinput-1.10.3/tools/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/tools/Makefile.in 2015-08-04 00:58:31.000000000 +0000 @@ -0,0 +1,929 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 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__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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@ +noinst_PROGRAMS = event-debug$(EXEEXT) ptraccel-debug$(EXEEXT) \ + $(am__EXEEXT_1) +bin_PROGRAMS = libinput-list-devices$(EXEEXT) \ + libinput-debug-events$(EXEEXT) +@BUILD_EVENTGUI_TRUE@am__append_1 = event-gui +subdir = tools +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(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)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +libshared_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_libshared_la_OBJECTS = libshared_la-shared.lo +libshared_la_OBJECTS = $(am_libshared_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 = +libshared_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libshared_la_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +@BUILD_EVENTGUI_TRUE@am__EXEEXT_1 = event-gui$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +am_event_debug_OBJECTS = event_debug-event-debug.$(OBJEXT) +event_debug_OBJECTS = $(am_event_debug_OBJECTS) +event_debug_DEPENDENCIES = ../src/libinput.la libshared.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +event_debug_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(event_debug_CFLAGS) \ + $(CFLAGS) $(event_debug_LDFLAGS) $(LDFLAGS) -o $@ +am__event_gui_SOURCES_DIST = event-gui.c +@BUILD_EVENTGUI_TRUE@am_event_gui_OBJECTS = \ +@BUILD_EVENTGUI_TRUE@ event_gui-event-gui.$(OBJEXT) +event_gui_OBJECTS = $(am_event_gui_OBJECTS) +@BUILD_EVENTGUI_TRUE@event_gui_DEPENDENCIES = ../src/libinput.la \ +@BUILD_EVENTGUI_TRUE@ libshared.la $(am__DEPENDENCIES_1) \ +@BUILD_EVENTGUI_TRUE@ $(am__DEPENDENCIES_1) \ +@BUILD_EVENTGUI_TRUE@ $(am__DEPENDENCIES_1) +event_gui_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(event_gui_CFLAGS) \ + $(CFLAGS) $(event_gui_LDFLAGS) $(LDFLAGS) -o $@ +am__objects_1 = libinput_debug_events-event-debug.$(OBJEXT) +am_libinput_debug_events_OBJECTS = $(am__objects_1) +libinput_debug_events_OBJECTS = $(am_libinput_debug_events_OBJECTS) +am__DEPENDENCIES_2 = ../src/libinput.la libshared.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +libinput_debug_events_DEPENDENCIES = $(am__DEPENDENCIES_2) +libinput_debug_events_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libinput_debug_events_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_libinput_list_devices_OBJECTS = \ + libinput_list_devices-libinput-list-devices.$(OBJEXT) +libinput_list_devices_OBJECTS = $(am_libinput_list_devices_OBJECTS) +libinput_list_devices_DEPENDENCIES = ../src/libinput.la libshared.la \ + $(am__DEPENDENCIES_1) +libinput_list_devices_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libinput_list_devices_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_ptraccel_debug_OBJECTS = ptraccel-debug.$(OBJEXT) +ptraccel_debug_OBJECTS = $(am_ptraccel_debug_OBJECTS) +ptraccel_debug_DEPENDENCIES = ../src/libfilter.la +ptraccel_debug_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(ptraccel_debug_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 = $(libshared_la_SOURCES) $(event_debug_SOURCES) \ + $(event_gui_SOURCES) $(libinput_debug_events_SOURCES) \ + $(libinput_list_devices_SOURCES) $(ptraccel_debug_SOURCES) +DIST_SOURCES = $(libshared_la_SOURCES) $(event_debug_SOURCES) \ + $(am__event_gui_SOURCES_DIST) $(libinput_debug_events_SOURCES) \ + $(libinput_list_devices_SOURCES) $(ptraccel_debug_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +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; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(dist_man1_MANS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(dist_man1_MANS) $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADDR2LINE = @ADDR2LINE@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GCC_CFLAGS = @GCC_CFLAGS@ +GCC_CXXFLAGS = @GCC_CXXFLAGS@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBEVDEV_CFLAGS = @LIBEVDEV_CFLAGS@ +LIBEVDEV_LIBS = @LIBEVDEV_LIBS@ +LIBINPUT_LT_VERSION = @LIBINPUT_LT_VERSION@ +LIBINPUT_VERSION = @LIBINPUT_VERSION@ +LIBINPUT_VERSION_MAJOR = @LIBINPUT_VERSION_MAJOR@ +LIBINPUT_VERSION_MICRO = @LIBINPUT_VERSION_MICRO@ +LIBINPUT_VERSION_MINOR = @LIBINPUT_VERSION_MINOR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@ +LIBUDEV_LIBS = @LIBUDEV_LIBS@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MTDEV_CFLAGS = @MTDEV_CFLAGS@ +MTDEV_LIBS = @MTDEV_LIBS@ +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@ +STRIP = @STRIP@ +UDEV_DIR = @UDEV_DIR@ +UDEV_TEST_PATH = @UDEV_TEST_PATH@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +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_CXX = @ac_ct_CXX@ +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@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +noinst_LTLIBRARIES = libshared.la +AM_CPPFLAGS = -I$(top_srcdir)/include \ + -I$(top_srcdir)/src \ + -I$(top_builddir)/src # for libinput-version.h + +libshared_la_SOURCES = \ + shared.c \ + shared.h + +libshared_la_CFLAGS = $(LIBEVDEV_CFLAGS) +libshared_la_LIBADD = $(LIBEVDEV_LIBS) +event_debug_SOURCES = event-debug.c +event_debug_LDADD = ../src/libinput.la libshared.la $(LIBUDEV_LIBS) $(LIBEVDEV_LIBS) +event_debug_LDFLAGS = -no-install +event_debug_CFLAGS = $(LIBUDEV_CFLAGS) $(LIBEVDEV_CFLAGS) +ptraccel_debug_SOURCES = ptraccel-debug.c +ptraccel_debug_LDADD = ../src/libfilter.la +ptraccel_debug_LDFLAGS = -no-install +libinput_list_devices_SOURCES = libinput-list-devices.c +libinput_list_devices_LDADD = ../src/libinput.la libshared.la $(LIBUDEV_LIBS) +libinput_list_devices_CFLAGS = $(LIBUDEV_CFLAGS) +dist_man1_MANS = libinput-list-devices.man libinput-debug-events.man +libinput_debug_events_SOURCES = $(event_debug_SOURCES) +libinput_debug_events_LDADD = $(event_debug_LDADD) +libinput_debug_events_CFLAGS = $(event_debug_CFLAGS) +@BUILD_EVENTGUI_TRUE@event_gui_SOURCES = event-gui.c +@BUILD_EVENTGUI_TRUE@event_gui_LDADD = ../src/libinput.la libshared.la $(CAIRO_LIBS) $(GTK_LIBS) $(LIBUDEV_LIBS) +@BUILD_EVENTGUI_TRUE@event_gui_CFLAGS = $(CAIRO_CFLAGS) $(GTK_CFLAGS) $(LIBUDEV_CFLAGS) +@BUILD_EVENTGUI_TRUE@event_gui_LDFLAGS = -no-install +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(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 tools/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign tools/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: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_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}; \ + } + +libshared.la: $(libshared_la_OBJECTS) $(libshared_la_DEPENDENCIES) $(EXTRA_libshared_la_DEPENDENCIES) + $(AM_V_CCLD)$(libshared_la_LINK) $(libshared_la_OBJECTS) $(libshared_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +event-debug$(EXEEXT): $(event_debug_OBJECTS) $(event_debug_DEPENDENCIES) $(EXTRA_event_debug_DEPENDENCIES) + @rm -f event-debug$(EXEEXT) + $(AM_V_CCLD)$(event_debug_LINK) $(event_debug_OBJECTS) $(event_debug_LDADD) $(LIBS) + +event-gui$(EXEEXT): $(event_gui_OBJECTS) $(event_gui_DEPENDENCIES) $(EXTRA_event_gui_DEPENDENCIES) + @rm -f event-gui$(EXEEXT) + $(AM_V_CCLD)$(event_gui_LINK) $(event_gui_OBJECTS) $(event_gui_LDADD) $(LIBS) + +libinput-debug-events$(EXEEXT): $(libinput_debug_events_OBJECTS) $(libinput_debug_events_DEPENDENCIES) $(EXTRA_libinput_debug_events_DEPENDENCIES) + @rm -f libinput-debug-events$(EXEEXT) + $(AM_V_CCLD)$(libinput_debug_events_LINK) $(libinput_debug_events_OBJECTS) $(libinput_debug_events_LDADD) $(LIBS) + +libinput-list-devices$(EXEEXT): $(libinput_list_devices_OBJECTS) $(libinput_list_devices_DEPENDENCIES) $(EXTRA_libinput_list_devices_DEPENDENCIES) + @rm -f libinput-list-devices$(EXEEXT) + $(AM_V_CCLD)$(libinput_list_devices_LINK) $(libinput_list_devices_OBJECTS) $(libinput_list_devices_LDADD) $(LIBS) + +ptraccel-debug$(EXEEXT): $(ptraccel_debug_OBJECTS) $(ptraccel_debug_DEPENDENCIES) $(EXTRA_ptraccel_debug_DEPENDENCIES) + @rm -f ptraccel-debug$(EXEEXT) + $(AM_V_CCLD)$(ptraccel_debug_LINK) $(ptraccel_debug_OBJECTS) $(ptraccel_debug_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event_debug-event-debug.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event_gui-event-gui.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_debug_events-event-debug.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_list_devices-libinput-list-devices.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libshared_la-shared.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ptraccel-debug.Po@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 -o $@ $< + +.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 -o $@ `$(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 $@ $< + +libshared_la-shared.lo: shared.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshared_la_CFLAGS) $(CFLAGS) -MT libshared_la-shared.lo -MD -MP -MF $(DEPDIR)/libshared_la-shared.Tpo -c -o libshared_la-shared.lo `test -f 'shared.c' || echo '$(srcdir)/'`shared.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libshared_la-shared.Tpo $(DEPDIR)/libshared_la-shared.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='shared.c' object='libshared_la-shared.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) $(AM_CPPFLAGS) $(CPPFLAGS) $(libshared_la_CFLAGS) $(CFLAGS) -c -o libshared_la-shared.lo `test -f 'shared.c' || echo '$(srcdir)/'`shared.c + +event_debug-event-debug.o: event-debug.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(event_debug_CFLAGS) $(CFLAGS) -MT event_debug-event-debug.o -MD -MP -MF $(DEPDIR)/event_debug-event-debug.Tpo -c -o event_debug-event-debug.o `test -f 'event-debug.c' || echo '$(srcdir)/'`event-debug.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/event_debug-event-debug.Tpo $(DEPDIR)/event_debug-event-debug.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='event-debug.c' object='event_debug-event-debug.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(event_debug_CFLAGS) $(CFLAGS) -c -o event_debug-event-debug.o `test -f 'event-debug.c' || echo '$(srcdir)/'`event-debug.c + +event_debug-event-debug.obj: event-debug.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(event_debug_CFLAGS) $(CFLAGS) -MT event_debug-event-debug.obj -MD -MP -MF $(DEPDIR)/event_debug-event-debug.Tpo -c -o event_debug-event-debug.obj `if test -f 'event-debug.c'; then $(CYGPATH_W) 'event-debug.c'; else $(CYGPATH_W) '$(srcdir)/event-debug.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/event_debug-event-debug.Tpo $(DEPDIR)/event_debug-event-debug.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='event-debug.c' object='event_debug-event-debug.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(event_debug_CFLAGS) $(CFLAGS) -c -o event_debug-event-debug.obj `if test -f 'event-debug.c'; then $(CYGPATH_W) 'event-debug.c'; else $(CYGPATH_W) '$(srcdir)/event-debug.c'; fi` + +event_gui-event-gui.o: event-gui.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(event_gui_CFLAGS) $(CFLAGS) -MT event_gui-event-gui.o -MD -MP -MF $(DEPDIR)/event_gui-event-gui.Tpo -c -o event_gui-event-gui.o `test -f 'event-gui.c' || echo '$(srcdir)/'`event-gui.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/event_gui-event-gui.Tpo $(DEPDIR)/event_gui-event-gui.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='event-gui.c' object='event_gui-event-gui.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(event_gui_CFLAGS) $(CFLAGS) -c -o event_gui-event-gui.o `test -f 'event-gui.c' || echo '$(srcdir)/'`event-gui.c + +event_gui-event-gui.obj: event-gui.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(event_gui_CFLAGS) $(CFLAGS) -MT event_gui-event-gui.obj -MD -MP -MF $(DEPDIR)/event_gui-event-gui.Tpo -c -o event_gui-event-gui.obj `if test -f 'event-gui.c'; then $(CYGPATH_W) 'event-gui.c'; else $(CYGPATH_W) '$(srcdir)/event-gui.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/event_gui-event-gui.Tpo $(DEPDIR)/event_gui-event-gui.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='event-gui.c' object='event_gui-event-gui.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(event_gui_CFLAGS) $(CFLAGS) -c -o event_gui-event-gui.obj `if test -f 'event-gui.c'; then $(CYGPATH_W) 'event-gui.c'; else $(CYGPATH_W) '$(srcdir)/event-gui.c'; fi` + +libinput_debug_events-event-debug.o: event-debug.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_debug_events_CFLAGS) $(CFLAGS) -MT libinput_debug_events-event-debug.o -MD -MP -MF $(DEPDIR)/libinput_debug_events-event-debug.Tpo -c -o libinput_debug_events-event-debug.o `test -f 'event-debug.c' || echo '$(srcdir)/'`event-debug.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_debug_events-event-debug.Tpo $(DEPDIR)/libinput_debug_events-event-debug.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='event-debug.c' object='libinput_debug_events-event-debug.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_debug_events_CFLAGS) $(CFLAGS) -c -o libinput_debug_events-event-debug.o `test -f 'event-debug.c' || echo '$(srcdir)/'`event-debug.c + +libinput_debug_events-event-debug.obj: event-debug.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_debug_events_CFLAGS) $(CFLAGS) -MT libinput_debug_events-event-debug.obj -MD -MP -MF $(DEPDIR)/libinput_debug_events-event-debug.Tpo -c -o libinput_debug_events-event-debug.obj `if test -f 'event-debug.c'; then $(CYGPATH_W) 'event-debug.c'; else $(CYGPATH_W) '$(srcdir)/event-debug.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_debug_events-event-debug.Tpo $(DEPDIR)/libinput_debug_events-event-debug.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='event-debug.c' object='libinput_debug_events-event-debug.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_debug_events_CFLAGS) $(CFLAGS) -c -o libinput_debug_events-event-debug.obj `if test -f 'event-debug.c'; then $(CYGPATH_W) 'event-debug.c'; else $(CYGPATH_W) '$(srcdir)/event-debug.c'; fi` + +libinput_list_devices-libinput-list-devices.o: libinput-list-devices.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_list_devices_CFLAGS) $(CFLAGS) -MT libinput_list_devices-libinput-list-devices.o -MD -MP -MF $(DEPDIR)/libinput_list_devices-libinput-list-devices.Tpo -c -o libinput_list_devices-libinput-list-devices.o `test -f 'libinput-list-devices.c' || echo '$(srcdir)/'`libinput-list-devices.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_list_devices-libinput-list-devices.Tpo $(DEPDIR)/libinput_list_devices-libinput-list-devices.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libinput-list-devices.c' object='libinput_list_devices-libinput-list-devices.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_list_devices_CFLAGS) $(CFLAGS) -c -o libinput_list_devices-libinput-list-devices.o `test -f 'libinput-list-devices.c' || echo '$(srcdir)/'`libinput-list-devices.c + +libinput_list_devices-libinput-list-devices.obj: libinput-list-devices.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_list_devices_CFLAGS) $(CFLAGS) -MT libinput_list_devices-libinput-list-devices.obj -MD -MP -MF $(DEPDIR)/libinput_list_devices-libinput-list-devices.Tpo -c -o libinput_list_devices-libinput-list-devices.obj `if test -f 'libinput-list-devices.c'; then $(CYGPATH_W) 'libinput-list-devices.c'; else $(CYGPATH_W) '$(srcdir)/libinput-list-devices.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_list_devices-libinput-list-devices.Tpo $(DEPDIR)/libinput_list_devices-libinput-list-devices.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libinput-list-devices.c' object='libinput_list_devices-libinput-list-devices.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_list_devices_CFLAGS) $(CFLAGS) -c -o libinput_list_devices-libinput-list-devices.obj `if test -f 'libinput-list-devices.c'; then $(CYGPATH_W) 'libinput-list-devices.c'; else $(CYGPATH_W) '$(srcdir)/libinput-list-devices.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(dist_man1_MANS) + @$(NORMAL_INSTALL) + @list1='$(dist_man1_MANS)'; \ + list2=''; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + 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-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + 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: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + 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) $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; 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-binPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES clean-noinstPROGRAMS 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-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man1 + +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-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ + clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstLTLIBRARIES clean-noinstPROGRAMS cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + 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-man install-man1 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru libinput-1.10.3/tools/make-ptraccel-graphs.sh libinput-0.21.0/tools/make-ptraccel-graphs.sh --- libinput-1.10.3/tools/make-ptraccel-graphs.sh 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/make-ptraccel-graphs.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -#!/bin/bash - -tool=`dirname $0`/ptraccel-debug -gnuplot=/usr/bin/gnuplot - -outfile="ptraccel-linear" -for speed in -1 -0.75 -0.5 -0.25 0 0.5 1; do - $tool --mode=accel --dpi=1000 --filter=linear --speed=$speed > $outfile-$speed.gnuplot -done -$gnuplot < $outfile-$dpi.gnuplot -done - -$gnuplot < $outfile-$speed.gnuplot - echo "\"$outfile-$speed.gnuplot\" using 1:2 title '$speed', \\" - done -) -EOF - -outfile="ptraccel-trackpoint" -$tool --mode=accel --dpi=1000 --filter=linear > $outfile-mouse.gnuplot -for constaccel in 1 2 3; do - dpi=$((1000/$constaccel)) - $tool --mode=accel --dpi=$dpi --filter=trackpoint > $outfile-trackpoint-$constaccel.gnuplot -done -$gnuplot < #include @@ -32,14 +31,13 @@ #include #include -#include "filter.h" -#include "libinput-util.h" +#include +#include static void print_ptraccel_deltas(struct motion_filter *filter, double step) { - struct device_float_coords motion; - struct normalized_coords accel; + struct normalized_coords motion; uint64_t time = 0; double i; @@ -56,9 +54,9 @@ motion.y = 0; time += us(12500); /* pretend 80Hz data */ - accel = filter_dispatch(filter, &motion, NULL, time); + motion = filter_dispatch(filter, &motion, NULL, time); - printf("%.2f %.3f\n", i, accel.x); + printf("%.2f %.3f\n", i, motion.x); } } @@ -68,8 +66,7 @@ double max_dx, double step) { - struct device_float_coords motion; - struct normalized_coords accel; + struct normalized_coords motion; uint64_t time = 0; double dx; int i; @@ -100,9 +97,9 @@ motion.y = 0; time += us(12500); /* pretend 80Hz data */ - accel = filter_dispatch(filter, &motion, NULL, time); + motion = filter_dispatch(filter, &motion, NULL, time); - printf("%d %.3f %.3f\n", i, accel.x, dx); + printf("%d %.3f %.3f\n", i, motion.x, dx); if (dx < max_dx) dx += step; @@ -114,8 +111,7 @@ int nevents, double *deltas) { - struct device_float_coords motion; - struct normalized_coords accel; + struct normalized_coords motion; uint64_t time = 0; double *dx; int i; @@ -135,55 +131,28 @@ motion.y = 0; time += us(12500); /* pretend 80Hz data */ - accel = filter_dispatch(filter, &motion, NULL, time); + motion = filter_dispatch(filter, &motion, NULL, time); - printf("%d %.3f %.3f\n", i, accel.x, *dx); + printf("%d %.3f %.3f\n", i, motion.x, *dx); } } -/* mm/s → units/µs */ -static inline double -mmps_to_upus(double mmps, int dpi) -{ - return mmps * (dpi/25.4) / 1e6; -} - static void -print_accel_func(struct motion_filter *filter, - accel_profile_func_t profile, - int dpi) +print_accel_func(struct motion_filter *filter) { - double mmps; + double vel; printf("# gnuplot:\n"); - printf("# set xlabel \"speed (mm/s)\"\n"); + printf("# set xlabel \"speed\"\n"); printf("# set ylabel \"raw accel factor\"\n"); printf("# set style data lines\n"); - printf("# plot \"gnuplot.data\" using 1:2 title 'accel factor'\n"); - printf("#\n"); - printf("# data: velocity(mm/s) factor velocity(units/us)\n"); - for (mmps = 0.0; mmps < 1000.0; mmps += 1) { - double units_per_us = mmps_to_upus(mmps, dpi); - double result = profile(filter, NULL, units_per_us, 0 /* time */); - printf("%.8f\t%.4f\t%.8f\n", mmps, result, units_per_us); - } -} - -static void -print_accel_func_trackpoint(struct motion_filter *filter, - int max) -{ - printf("# gnuplot:\n"); - printf("# set xlabel \"deltas (units)\"\n"); - printf("# set ylabel \"raw accel factor\"\n"); - printf("# set style data lines\n"); - printf("# plot \"gnuplot.data\" using 1:2 title 'accel factor'\n"); - printf("#\n"); - printf("# data: delta(units) factor\n"); - for (double delta = 0; delta < max; delta += 0.2) { - double factor = trackpoint_accel_profile(filter, NULL, delta); - - printf("%.2f %f\n", delta, factor); + printf("# plot \"gnuplot.data\" using 1:2\n"); + for (vel = 0.0; vel < 3.0; vel += .0001) { + double result = pointer_accel_profile_linear(filter, + NULL, + vel, + 0 /* time */); + printf("%.4f\t%.4f\n", vel, result); } } @@ -202,13 +171,6 @@ "--steps= ... in motion and delta modes only. Increase dx by step each round\n" "--speed= ... accel speed [-1, 1], default 0\n" "--dpi= ... device resolution in DPI (default: 1000)\n" - "--trackpoint_range= ... range of the trackpoint deltas (default: 30)\n" - "--filter= \n" - " linear ... the default motion filter\n" - " low-dpi ... low-dpi filter, use --dpi with this argument\n" - " touchpad ... the touchpad motion filter\n" - " x230 ... custom filter for the Lenovo x230 touchpad\n" - " trackpoint... trackpoint motion filter\n" "\n" "If extra arguments are present and mode is not given, mode defaults to 'sequence'\n" "and the arguments are interpreted as sequence of delta x coordinates\n" @@ -216,9 +178,6 @@ "If stdin is a pipe, mode defaults to 'sequence' and the pipe is read \n" "for delta coordinates\n" "\n" - "Delta coordinates passed into this tool must be in dpi as\n" - "specified by the --dpi argument\n" - "\n" "Output best viewed with gnuplot. See output for gnuplot commands\n"); } @@ -236,35 +195,26 @@ double custom_deltas[1024]; double speed = 0.0; int dpi = 1000; - const char *filter_type = "linear"; - accel_profile_func_t profile = NULL; - int tp_range_max = 20; enum { - OPT_HELP = 1, - OPT_MODE, + OPT_MODE = 1, OPT_NEVENTS, OPT_MAXDX, OPT_STEP, OPT_SPEED, OPT_DPI, - OPT_FILTER, - OPT_TRACKPOINT_RANGE, }; while (1) { int c; int option_index = 0; static struct option long_options[] = { - {"help", 0, 0, OPT_HELP }, {"mode", 1, 0, OPT_MODE }, {"nevents", 1, 0, OPT_NEVENTS }, {"maxdx", 1, 0, OPT_MAXDX }, {"step", 1, 0, OPT_STEP }, {"speed", 1, 0, OPT_SPEED }, {"dpi", 1, 0, OPT_DPI }, - {"filter", 1, 0, OPT_FILTER }, - {"trackpoint-range", 1, 0, OPT_TRACKPOINT_RANGE }, {0, 0, 0, 0} }; @@ -274,10 +224,6 @@ break; switch (c) { - case OPT_HELP: - usage(); - exit(0); - break; case OPT_MODE: if (streq(optarg, "accel")) print_accel = true; @@ -319,12 +265,6 @@ case OPT_DPI: dpi = strtod(optarg, NULL); break; - case OPT_FILTER: - filter_type = optarg; - break; - case OPT_TRACKPOINT_RANGE: - tp_range_max = strtod(optarg, NULL); - break; default: usage(); exit(1); @@ -332,26 +272,8 @@ } } - if (streq(filter_type, "linear")) { - filter = create_pointer_accelerator_filter_linear(dpi); - profile = pointer_accel_profile_linear; - } else if (streq(filter_type, "low-dpi")) { - filter = create_pointer_accelerator_filter_linear_low_dpi(dpi); - profile = pointer_accel_profile_linear_low_dpi; - } else if (streq(filter_type, "touchpad")) { - filter = create_pointer_accelerator_filter_touchpad(dpi, 0, 0); - profile = touchpad_accel_profile_linear; - } else if (streq(filter_type, "x230")) { - filter = create_pointer_accelerator_filter_lenovo_x230(dpi); - profile = touchpad_lenovo_x230_accel_profile; - } else if (streq(filter_type, "trackpoint")) { - filter = create_pointer_accelerator_filter_trackpoint(tp_range_max); - profile = NULL; /* trackpoint is special */ - } else { - fprintf(stderr, "Invalid filter type %s\n", filter_type); - return 1; - } - + filter = create_pointer_accelerator_filter(pointer_accel_profile_linear, + dpi); assert(filter != NULL); filter_set_speed(filter, speed); @@ -374,12 +296,9 @@ custom_deltas[nevents++] = strtod(argv[optind++], NULL); } - if (print_accel) { - if (!profile) /* trackpoint */ - print_accel_func_trackpoint(filter, tp_range_max); - else - print_accel_func(filter, profile, dpi); - } else if (print_delta) + if (print_accel) + print_accel_func(filter); + else if (print_delta) print_ptraccel_deltas(filter, step); else if (print_motion) print_ptraccel_movement(filter, nevents, max_dx, step); diff -Nru libinput-1.10.3/tools/publish-doc libinput-0.21.0/tools/publish-doc --- libinput-1.10.3/tools/publish-doc 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/publish-doc 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -#!/bin/bash - -set -e - -[ -e doc ] || (echo "Run this from the project root" && exit 1) - -if ! [ -f build/build.ninja ]; then - echo "Setting up meson in directory 'build'" - meson build -fi -ninja -C build - -[ -e build/html ] || (echo "HTML documentation failed to build" && exit 1) - -path=latest - -if [ -n "$1" ]; then - echo "Pushing to directory '$1'" - path="$1" -fi - -rsync --delete -avz build/html/ freedesktop.org:/srv/wayland.freedesktop.org/www/libinput/doc/$path diff -Nru libinput-1.10.3/tools/shared.c libinput-0.21.0/tools/shared.c --- libinput-1.10.3/tools/shared.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/shared.c 2015-07-31 01:50:42.000000000 +0000 @@ -21,16 +21,15 @@ * DEALINGS IN THE SOFTWARE. */ +#define _GNU_SOURCE #include #include #include -#include #include #include #include #include -#include #include #include @@ -38,38 +37,84 @@ #include "shared.h" -LIBINPUT_ATTRIBUTE_PRINTF(3, 0) +enum options { + OPT_DEVICE, + OPT_UDEV, + OPT_GRAB, + OPT_HELP, + OPT_VERBOSE, + OPT_TAP_ENABLE, + OPT_TAP_DISABLE, + OPT_DRAG_LOCK_ENABLE, + OPT_DRAG_LOCK_DISABLE, + OPT_NATURAL_SCROLL_ENABLE, + OPT_NATURAL_SCROLL_DISABLE, + OPT_LEFT_HANDED_ENABLE, + OPT_LEFT_HANDED_DISABLE, + OPT_MIDDLEBUTTON_ENABLE, + OPT_MIDDLEBUTTON_DISABLE, + OPT_DWT_ENABLE, + OPT_DWT_DISABLE, + OPT_CLICK_METHOD, + OPT_SCROLL_METHOD, + OPT_SCROLL_BUTTON, + OPT_SPEED, +}; + static void log_handler(struct libinput *li, enum libinput_log_priority priority, const char *format, va_list args) { - static int is_tty = -1; - - if (is_tty == -1) - is_tty = isatty(STDOUT_FILENO); - - if (is_tty) { - if (priority >= LIBINPUT_LOG_PRIORITY_ERROR) - printf(ANSI_RED); - else if (priority >= LIBINPUT_LOG_PRIORITY_INFO) - printf(ANSI_HIGHLIGHT); - } - vprintf(format, args); +} - if (is_tty && priority >= LIBINPUT_LOG_PRIORITY_INFO) - printf(ANSI_NORMAL); +void +tools_usage() +{ + printf("Usage: %s [options] [--udev []|--device /dev/input/event0]\n" + "--udev .... Use udev device discovery (default).\n" + " Specifying a seat ID is optional.\n" + "--device /path/to/device .... open the given device only\n" + "\n" + "Features:\n" + "--enable-tap\n" + "--disable-tap.... enable/disable tapping\n" + "--enable-drag-lock\n" + "--disable-drag-lock.... enable/disable tapping drag lock\n" + "--enable-natural-scrolling\n" + "--disable-natural-scrolling.... enable/disable natural scrolling\n" + "--enable-left-handed\n" + "--disable-left-handed.... enable/disable left-handed button configuration\n" + "--enable-middlebutton\n" + "--disable-middlebutton.... enable/disable middle button emulation\n" + "--enable-dwt\n" + "--disable-dwt..... enable/disable disable-while-typing\n" + "--set-click-method=[none|clickfinger|buttonareas] .... set the desired click method\n" + "--set-scroll-method=[none|twofinger|edge|button] ... set the desired scroll method\n" + "--set-scroll-button=BTN_MIDDLE ... set the button to the given button code\n" + "--set-speed=.... set pointer acceleration speed\n" + "\n" + "These options apply to all applicable devices, if a feature\n" + "is not explicitly specified it is left at each device's default.\n" + "\n" + "Other options:\n" + "--grab .......... Exclusively grab all openend devices\n" + "--verbose ....... Print debugging output.\n" + "--help .......... Print this help.\n", + program_invocation_short_name); } void -tools_init_options(struct tools_options *options) +tools_init_context(struct tools_context *context) { + struct tools_options *options = &context->options; + + context->user_data = NULL; + memset(options, 0, sizeof(*options)); options->tapping = -1; - options->tap_map = -1; - options->drag = -1; options->drag_lock = -1; options->natural_scroll = -1; options->left_handed = -1; @@ -78,180 +123,191 @@ options->click_method = -1; options->scroll_method = -1; options->scroll_button = -1; + options->backend = BACKEND_UDEV; + options->seat = "seat0"; options->speed = 0.0; - options->profile = LIBINPUT_CONFIG_ACCEL_PROFILE_NONE; } int -tools_parse_option(int option, - const char *optarg, - struct tools_options *options) +tools_parse_args(int argc, char **argv, struct tools_context *context) { - switch(option) { - case OPT_TAP_ENABLE: - options->tapping = 1; - break; - case OPT_TAP_DISABLE: - options->tapping = 0; - break; - case OPT_TAP_MAP: - if (!optarg) - return 1; + struct tools_options *options = &context->options; - if (streq(optarg, "lrm")) { - options->tap_map = LIBINPUT_CONFIG_TAP_MAP_LRM; - } else if (streq(optarg, "lmr")) { - options->tap_map = LIBINPUT_CONFIG_TAP_MAP_LMR; - } else { - return 1; - } - break; - case OPT_DRAG_ENABLE: - options->drag = 1; - break; - case OPT_DRAG_DISABLE: - options->drag = 0; - break; - case OPT_DRAG_LOCK_ENABLE: - options->drag_lock = 1; - break; - case OPT_DRAG_LOCK_DISABLE: - options->drag_lock = 0; - break; - case OPT_NATURAL_SCROLL_ENABLE: - options->natural_scroll = 1; - break; - case OPT_NATURAL_SCROLL_DISABLE: - options->natural_scroll = 0; - break; - case OPT_LEFT_HANDED_ENABLE: - options->left_handed = 1; - break; - case OPT_LEFT_HANDED_DISABLE: - options->left_handed = 0; - break; - case OPT_MIDDLEBUTTON_ENABLE: - options->middlebutton = 1; - break; - case OPT_MIDDLEBUTTON_DISABLE: - options->middlebutton = 0; - break; - case OPT_DWT_ENABLE: - options->dwt = LIBINPUT_CONFIG_DWT_ENABLED; - break; - case OPT_DWT_DISABLE: - options->dwt = LIBINPUT_CONFIG_DWT_DISABLED; - break; - case OPT_CLICK_METHOD: - if (!optarg) - return 1; - - if (streq(optarg, "none")) { - options->click_method = - LIBINPUT_CONFIG_CLICK_METHOD_NONE; - } else if (streq(optarg, "clickfinger")) { - options->click_method = - LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER; - } else if (streq(optarg, "buttonareas")) { - options->click_method = - LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS; - } else { - return 1; - } - break; - case OPT_SCROLL_METHOD: - if (!optarg) - return 1; - - if (streq(optarg, "none")) { - options->scroll_method = - LIBINPUT_CONFIG_SCROLL_NO_SCROLL; - } else if (streq(optarg, "twofinger")) { - options->scroll_method = - LIBINPUT_CONFIG_SCROLL_2FG; - } else if (streq(optarg, "edge")) { - options->scroll_method = - LIBINPUT_CONFIG_SCROLL_EDGE; - } else if (streq(optarg, "button")) { - options->scroll_method = - LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN; - } else { - return 1; - } - break; - case OPT_SCROLL_BUTTON: - if (!optarg) { - return 1; - } - options->scroll_button = - libevdev_event_code_from_name(EV_KEY, - optarg); - if (options->scroll_button == -1) { - fprintf(stderr, - "Invalid button %s\n", - optarg); - return 1; - } - break; - case OPT_SPEED: - if (!optarg) - return 1; - options->speed = atof(optarg); - break; - case OPT_PROFILE: - if (!optarg) + while (1) { + int c; + int option_index = 0; + static struct option opts[] = { + { "device", 1, 0, OPT_DEVICE }, + { "udev", 0, 0, OPT_UDEV }, + { "grab", 0, 0, OPT_GRAB }, + { "help", 0, 0, OPT_HELP }, + { "verbose", 0, 0, OPT_VERBOSE }, + { "enable-tap", 0, 0, OPT_TAP_ENABLE }, + { "disable-tap", 0, 0, OPT_TAP_DISABLE }, + { "enable-drag-lock", 0, 0, OPT_DRAG_LOCK_ENABLE }, + { "disable-drag-lock", 0, 0, OPT_DRAG_LOCK_DISABLE }, + { "enable-natural-scrolling", 0, 0, OPT_NATURAL_SCROLL_ENABLE }, + { "disable-natural-scrolling", 0, 0, OPT_NATURAL_SCROLL_DISABLE }, + { "enable-left-handed", 0, 0, OPT_LEFT_HANDED_ENABLE }, + { "disable-left-handed", 0, 0, OPT_LEFT_HANDED_DISABLE }, + { "enable-middlebutton", 0, 0, OPT_MIDDLEBUTTON_ENABLE }, + { "disable-middlebutton", 0, 0, OPT_MIDDLEBUTTON_DISABLE }, + { "enable-dwt", 0, 0, OPT_DWT_ENABLE }, + { "disable-dwt", 0, 0, OPT_DWT_DISABLE }, + { "set-click-method", 1, 0, OPT_CLICK_METHOD }, + { "set-scroll-method", 1, 0, OPT_SCROLL_METHOD }, + { "set-scroll-button", 1, 0, OPT_SCROLL_BUTTON }, + { "speed", 1, 0, OPT_SPEED }, + { 0, 0, 0, 0} + }; + + c = getopt_long(argc, argv, "h", opts, &option_index); + if (c == -1) + break; + + switch(c) { + case 'h': + case OPT_HELP: + tools_usage(); + exit(0); + case OPT_DEVICE: + options->backend = BACKEND_DEVICE; + if (!optarg) { + tools_usage(); + return 1; + } + options->device = optarg; + break; + case OPT_UDEV: + options->backend = BACKEND_UDEV; + if (optarg) + options->seat = optarg; + break; + case OPT_GRAB: + options->grab = 1; + break; + case OPT_VERBOSE: + options->verbose = 1; + break; + case OPT_TAP_ENABLE: + options->tapping = 1; + break; + case OPT_TAP_DISABLE: + options->tapping = 0; + break; + case OPT_DRAG_LOCK_ENABLE: + options->drag_lock = 1; + break; + case OPT_DRAG_LOCK_DISABLE: + options->drag_lock = 0; + break; + case OPT_NATURAL_SCROLL_ENABLE: + options->natural_scroll = 1; + break; + case OPT_NATURAL_SCROLL_DISABLE: + options->natural_scroll = 0; + break; + case OPT_LEFT_HANDED_ENABLE: + options->left_handed = 1; + break; + case OPT_LEFT_HANDED_DISABLE: + options->left_handed = 0; + break; + case OPT_MIDDLEBUTTON_ENABLE: + options->middlebutton = 1; + break; + case OPT_MIDDLEBUTTON_DISABLE: + options->middlebutton = 0; + break; + case OPT_DWT_ENABLE: + options->dwt = LIBINPUT_CONFIG_DWT_ENABLED; + break; + case OPT_DWT_DISABLE: + options->dwt = LIBINPUT_CONFIG_DWT_DISABLED; + break; + case OPT_CLICK_METHOD: + if (!optarg) { + tools_usage(); + return 1; + } + if (streq(optarg, "none")) { + options->click_method = + LIBINPUT_CONFIG_CLICK_METHOD_NONE; + } else if (streq(optarg, "clickfinger")) { + options->click_method = + LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER; + } else if (streq(optarg, "buttonareas")) { + options->click_method = + LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS; + } else { + tools_usage(); + return 1; + } + break; + case OPT_SCROLL_METHOD: + if (!optarg) { + tools_usage(); + return 1; + } + if (streq(optarg, "none")) { + options->scroll_method = + LIBINPUT_CONFIG_SCROLL_NO_SCROLL; + } else if (streq(optarg, "twofinger")) { + options->scroll_method = + LIBINPUT_CONFIG_SCROLL_2FG; + } else if (streq(optarg, "edge")) { + options->scroll_method = + LIBINPUT_CONFIG_SCROLL_EDGE; + } else if (streq(optarg, "button")) { + options->scroll_method = + LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN; + } else { + tools_usage(); + return 1; + } + break; + case OPT_SCROLL_BUTTON: + if (!optarg) { + tools_usage(); + return 1; + } + options->scroll_button = + libevdev_event_code_from_name(EV_KEY, + optarg); + if (options->scroll_button == -1) { + fprintf(stderr, + "Invalid button %s\n", + optarg); + return 1; + } + break; + case OPT_SPEED: + if (!optarg) { + tools_usage(); + return 1; + } + options->speed = atof(optarg); + break; + default: + tools_usage(); return 1; + } - if (streq(optarg, "adaptive")) - options->profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE; - else if (streq(optarg, "flat")) - options->profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT; - else - return 1; - break; - case OPT_DISABLE_SENDEVENTS: - if (!optarg) - return 1; + } - snprintf(options->disable_pattern, - sizeof(options->disable_pattern), - "%s", - optarg); - break; + if (optind < argc) { + tools_usage(); + return 1; } return 0; } -static int -open_restricted(const char *path, int flags, void *user_data) -{ - bool *grab = user_data; - int fd = open(path, flags); - - if (fd < 0) - fprintf(stderr, "Failed to open %s (%s)\n", - path, strerror(errno)); - else if (*grab && ioctl(fd, EVIOCGRAB, (void*)1) == -1) - fprintf(stderr, "Grab requested, but failed for %s (%s)\n", - path, strerror(errno)); - - return fd < 0 ? -errno : fd; -} - -static void -close_restricted(int fd, void *user_data) -{ - close(fd); -} - -static const struct libinput_interface interface = { - .open_restricted = open_restricted, - .close_restricted = close_restricted, -}; - static struct libinput * -tools_open_udev(const char *seat, bool verbose, bool grab) +open_udev(const struct libinput_interface *interface, + void *userdata, + const char *seat, + int verbose) { struct libinput *li; struct udev *udev = udev_new(); @@ -261,7 +317,7 @@ return NULL; } - li = libinput_udev_create_context(&interface, &grab, udev); + li = libinput_udev_create_context(interface, userdata, udev); if (!li) { fprintf(stderr, "Failed to initialize context from udev\n"); goto out; @@ -285,12 +341,15 @@ } static struct libinput * -tools_open_device(const char *path, bool verbose, bool grab) +open_device(const struct libinput_interface *interface, + void *userdata, + const char *path, + int verbose) { struct libinput_device *device; struct libinput *li; - li = libinput_path_create_context(&interface, &grab); + li = libinput_path_create_context(interface, userdata); if (!li) { fprintf(stderr, "Failed to initialize context from %s\n", path); return NULL; @@ -311,24 +370,46 @@ return li; } +static int +open_restricted(const char *path, int flags, void *user_data) +{ + const struct tools_context *context = user_data; + int fd = open(path, flags); + + if (fd < 0) + fprintf(stderr, "Failed to open %s (%s)\n", + path, strerror(errno)); + else if (context->options.grab && + ioctl(fd, EVIOCGRAB, (void*)1) == -1) + fprintf(stderr, "Grab requested, but failed for %s (%s)\n", + path, strerror(errno)); + + return fd < 0 ? -errno : fd; +} + +static void +close_restricted(int fd, void *user_data) +{ + close(fd); +} + +static const struct libinput_interface interface = { + .open_restricted = open_restricted, + .close_restricted = close_restricted, +}; + struct libinput * -tools_open_backend(enum tools_backend which, - const char *seat_or_device, - bool verbose, - bool grab) +tools_open_backend(struct tools_context *context) { - struct libinput *li; + struct libinput *li = NULL; + struct tools_options *options = &context->options; - switch (which) { - case BACKEND_UDEV: - li = tools_open_udev(seat_or_device, verbose, grab); - break; - case BACKEND_DEVICE: - li = tools_open_device(seat_or_device, verbose, grab); - break; - default: + if (options->backend == BACKEND_UDEV) { + li = open_udev(&interface, context, options->seat, options->verbose); + } else if (options->backend == BACKEND_DEVICE) { + li = open_device(&interface, context, options->device, options->verbose); + } else abort(); - } return li; } @@ -339,12 +420,6 @@ { if (options->tapping != -1) libinput_device_config_tap_set_enabled(device, options->tapping); - if (options->tap_map != (enum libinput_config_tap_button_map)-1) - libinput_device_config_tap_set_button_map(device, - options->tap_map); - if (options->drag != -1) - libinput_device_config_tap_set_drag_enabled(device, - options->drag); if (options->drag_lock != -1) libinput_device_config_tap_set_drag_lock_enabled(device, options->drag_lock); @@ -360,170 +435,17 @@ if (options->dwt != -1) libinput_device_config_dwt_set_enabled(device, options->dwt); - if (options->click_method != (enum libinput_config_click_method)-1) + if (options->click_method != -1) libinput_device_config_click_set_method(device, options->click_method); - if (options->scroll_method != (enum libinput_config_scroll_method)-1) + if (options->scroll_method != -1) libinput_device_config_scroll_set_method(device, options->scroll_method); if (options->scroll_button != -1) libinput_device_config_scroll_set_button(device, options->scroll_button); - if (libinput_device_config_accel_is_available(device)) { + if (libinput_device_config_accel_is_available(device)) libinput_device_config_accel_set_speed(device, options->speed); - if (options->profile != LIBINPUT_CONFIG_ACCEL_PROFILE_NONE) - libinput_device_config_accel_set_profile(device, - options->profile); - } - - if (libinput_device_config_send_events_get_modes(device) & - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED && - fnmatch(options->disable_pattern, - libinput_device_get_name(device), - 0) != FNM_NOMATCH) { - libinput_device_config_send_events_set_mode(device, - LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); - } -} - -static char* -find_device(const char *udev_tag) -{ - struct udev *udev; - struct udev_enumerate *e; - struct udev_list_entry *entry; - struct udev_device *device; - const char *path, *sysname; - char *device_node = NULL; - - udev = udev_new(); - e = udev_enumerate_new(udev); - udev_enumerate_add_match_subsystem(e, "input"); - udev_enumerate_scan_devices(e); - - udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) { - path = udev_list_entry_get_name(entry); - device = udev_device_new_from_syspath(udev, path); - if (!device) - continue; - - sysname = udev_device_get_sysname(device); - if (strncmp("event", sysname, 5) != 0) { - udev_device_unref(device); - continue; - } - - if (udev_device_get_property_value(device, udev_tag)) - device_node = safe_strdup(udev_device_get_devnode(device)); - - udev_device_unref(device); - - if (device_node) - break; - } - udev_enumerate_unref(e); - udev_unref(udev); - - return device_node; -} - -bool -find_touchpad_device(char *path, size_t path_len) -{ - char *devnode = find_device("ID_INPUT_TOUCHPAD"); - - if (devnode) { - snprintf(path, path_len, "%s", devnode); - free(devnode); - } - - return devnode != NULL; -} - -bool -is_touchpad_device(const char *devnode) -{ - struct udev *udev; - struct udev_device *dev = NULL; - struct stat st; - bool is_touchpad = false; - - if (stat(devnode, &st) < 0) - return false; - - udev = udev_new(); - dev = udev_device_new_from_devnum(udev, 'c', st.st_rdev); - if (!dev) - goto out; - - is_touchpad = udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD"); -out: - if (dev) - udev_device_unref(dev); - udev_unref(udev); - - return is_touchpad; -} - -static inline void -setup_path(void) -{ - const char *path = getenv("PATH"); - char new_path[PATH_MAX]; - - snprintf(new_path, - sizeof(new_path), - "%s:%s", - LIBINPUT_TOOL_PATH, - path ? path : ""); - setenv("PATH", new_path, 1); -} - -int -tools_exec_command(const char *prefix, int real_argc, char **real_argv) -{ - char *argv[64] = {NULL}; - char executable[128]; - const char *command; - int rc; - - assert((size_t)real_argc < ARRAY_LENGTH(argv)); - - command = real_argv[0]; - - rc = snprintf(executable, - sizeof(executable), - "%s-%s", - prefix, - command); - if (rc >= (int)sizeof(executable)) { - fprintf(stderr, "Failed to assemble command.\n"); - return EXIT_FAILURE; - } - - argv[0] = executable; - for (int i = 1; i < real_argc; i++) - argv[i] = real_argv[i]; - - setup_path(); - - rc = execvp(executable, argv); - if (rc) { - if (errno == ENOENT) { - fprintf(stderr, - "libinput: %s is not a libinput command or not installed. " - "See 'libinput --help'\n", - command); - - } else { - fprintf(stderr, - "Failed to execute '%s' (%s)\n", - command, - strerror(errno)); - } - } - - return EXIT_FAILURE; } diff -Nru libinput-1.10.3/tools/shared.h libinput-0.21.0/tools/shared.h --- libinput-1.10.3/tools/shared.h 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/tools/shared.h 2015-07-31 01:50:42.000000000 +0000 @@ -24,92 +24,42 @@ #ifndef _SHARED_H_ #define _SHARED_H_ -#include - #include -enum configuration_options { - OPT_TAP_ENABLE = 256, - OPT_TAP_DISABLE, - OPT_TAP_MAP, - OPT_DRAG_ENABLE, - OPT_DRAG_DISABLE, - OPT_DRAG_LOCK_ENABLE, - OPT_DRAG_LOCK_DISABLE, - OPT_NATURAL_SCROLL_ENABLE, - OPT_NATURAL_SCROLL_DISABLE, - OPT_LEFT_HANDED_ENABLE, - OPT_LEFT_HANDED_DISABLE, - OPT_MIDDLEBUTTON_ENABLE, - OPT_MIDDLEBUTTON_DISABLE, - OPT_DWT_ENABLE, - OPT_DWT_DISABLE, - OPT_CLICK_METHOD, - OPT_SCROLL_METHOD, - OPT_SCROLL_BUTTON, - OPT_SPEED, - OPT_PROFILE, - OPT_DISABLE_SENDEVENTS, -}; - -#define CONFIGURATION_OPTIONS \ - { "disable-sendevents", required_argument, 0, OPT_DISABLE_SENDEVENTS }, \ - { "enable-tap", no_argument, 0, OPT_TAP_ENABLE }, \ - { "disable-tap", no_argument, 0, OPT_TAP_DISABLE }, \ - { "enable-drag", no_argument, 0, OPT_DRAG_ENABLE }, \ - { "disable-drag", no_argument, 0, OPT_DRAG_DISABLE }, \ - { "enable-drag-lock", no_argument, 0, OPT_DRAG_LOCK_ENABLE }, \ - { "disable-drag-lock", no_argument, 0, OPT_DRAG_LOCK_DISABLE }, \ - { "enable-natural-scrolling", no_argument, 0, OPT_NATURAL_SCROLL_ENABLE }, \ - { "disable-natural-scrolling", no_argument, 0, OPT_NATURAL_SCROLL_DISABLE }, \ - { "enable-left-handed", no_argument, 0, OPT_LEFT_HANDED_ENABLE }, \ - { "disable-left-handed", no_argument, 0, OPT_LEFT_HANDED_DISABLE }, \ - { "enable-middlebutton", no_argument, 0, OPT_MIDDLEBUTTON_ENABLE }, \ - { "disable-middlebutton", no_argument, 0, OPT_MIDDLEBUTTON_DISABLE }, \ - { "enable-dwt", no_argument, 0, OPT_DWT_ENABLE }, \ - { "disable-dwt", no_argument, 0, OPT_DWT_DISABLE }, \ - { "set-click-method", required_argument, 0, OPT_CLICK_METHOD }, \ - { "set-scroll-method", required_argument, 0, OPT_SCROLL_METHOD }, \ - { "set-scroll-button", required_argument, 0, OPT_SCROLL_BUTTON }, \ - { "set-profile", required_argument, 0, OPT_PROFILE }, \ - { "set-tap-map", required_argument, 0, OPT_TAP_MAP }, \ - { "set-speed", required_argument, 0, OPT_SPEED } - enum tools_backend { BACKEND_DEVICE, BACKEND_UDEV }; struct tools_options { + enum tools_backend backend; + const char *device; /* if backend is BACKEND_DEVICE */ + const char *seat; /* if backend is BACKEND_UDEV */ + int grab; /* EVIOCGRAB */ + + int verbose; int tapping; - int drag; int drag_lock; int natural_scroll; int left_handed; int middlebutton; enum libinput_config_click_method click_method; enum libinput_config_scroll_method scroll_method; - enum libinput_config_tap_button_map tap_map; int scroll_button; double speed; int dwt; - enum libinput_config_accel_profile profile; - char disable_pattern[64]; }; -void tools_init_options(struct tools_options *options); -int tools_parse_option(int option, - const char *optarg, - struct tools_options *options); -struct libinput* tools_open_backend(enum tools_backend which, - const char *seat_or_device, - bool verbose, - bool grab); +struct tools_context { + struct tools_options options; + void *user_data; +}; + +void tools_init_context(struct tools_context *context); +int tools_parse_args(int argc, char **argv, struct tools_context *context); +struct libinput* tools_open_backend(struct tools_context *context); void tools_device_apply_config(struct libinput_device *device, struct tools_options *options); -int tools_exec_command(const char *prefix, int argc, char **argv); - -bool find_touchpad_device(char *path, size_t path_len); -bool is_touchpad_device(const char *devnode); +void tools_usage(); #endif diff -Nru libinput-1.10.3/udev/80-libinput-device-groups.rules libinput-0.21.0/udev/80-libinput-device-groups.rules --- libinput-1.10.3/udev/80-libinput-device-groups.rules 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/udev/80-libinput-device-groups.rules 2015-08-04 00:58:32.000000000 +0000 @@ -0,0 +1,8 @@ +ACTION!="add|change", GOTO="libinput_device_group_end" +KERNEL!="event[0-9]*", GOTO="libinput_device_group_end" + +ATTRS{phys}=="?*", \ + PROGRAM="libinput-device-group %S%p", \ + ENV{LIBINPUT_DEVICE_GROUP}="%c" + +LABEL="libinput_device_group_end" diff -Nru libinput-1.10.3/udev/80-libinput-device-groups.rules.in libinput-0.21.0/udev/80-libinput-device-groups.rules.in --- libinput-1.10.3/udev/80-libinput-device-groups.rules.in 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/udev/80-libinput-device-groups.rules.in 2015-07-28 22:12:38.000000000 +0000 @@ -2,7 +2,6 @@ KERNEL!="event[0-9]*", GOTO="libinput_device_group_end" ATTRS{phys}=="?*", \ - ENV{LIBINPUT_DEVICE_GROUP}=="", \ PROGRAM="@UDEV_TEST_PATH@libinput-device-group %S%p", \ ENV{LIBINPUT_DEVICE_GROUP}="%c" diff -Nru libinput-1.10.3/udev/90-libinput-model-quirks.hwdb libinput-0.21.0/udev/90-libinput-model-quirks.hwdb --- libinput-1.10.3/udev/90-libinput-model-quirks.hwdb 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/udev/90-libinput-model-quirks.hwdb 2015-08-03 04:35:00.000000000 +0000 @@ -9,38 +9,21 @@ # 90-libinput-model-quirks.rules # # Match string formats: -# libinput:mouse: -# libinput:touchpad: +# libinput: # libinput:name::dmi: -# libinput:name::dt: # libinput:name::fwversion: # # Sort by brand, model ########################################## -# Chassis types 9 (Laptop) and 10 -# (Notebook) are expected to have working -# lid switches -########################################## -libinput:name:*Lid Switch*:dmi:*:ct10:* -libinput:name:*Lid Switch*:dmi:*:ct9:* - LIBINPUT_ATTR_LID_SWITCH_RELIABILITY=reliable - -########################################## -# Serial keyboards are internal -########################################## -libinput:keyboard:input:b0011v* - LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal - -########################################## # ALPS ########################################## libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:dmi:* libinput:name:*AlpsPS/2 ALPS GlidePoint:dmi:* LIBINPUT_MODEL_ALPS_TOUCHPAD=1 -libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:fwversion:800 -libinput:name:*AlpsPS/2 ALPS GlidePoint:fwversion:800 +libinput:name:*AlpsPS/2 ALPS DualPoint TouchPad:fwversion:8 +libinput:name:*AlpsPS/2 ALPS GlidePoint:fwversion:8 LIBINPUT_ATTR_SIZE_HINT=100x55 ########################################## @@ -50,70 +33,13 @@ libinput:touchpad:input:b0005v05ACp* LIBINPUT_MODEL_APPLE_TOUCHPAD=1 LIBINPUT_ATTR_SIZE_HINT=104x75 - LIBINPUT_ATTR_TOUCH_SIZE_RANGE=150:130 - LIBINPUT_ATTR_PALM_SIZE_THRESHOLD=800 - -libinput:name:*Apple Inc. Apple Internal Keyboard*:dmi:* - LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal - -libinput:mouse:input:b0005v05ACp030D* - LIBINPUT_MODEL_APPLE_MAGICMOUSE=1 - -# Magic Trackpad -libinput:touchpad:input:b0005v05ACp030E* - LIBINPUT_ATTR_SIZE_HINT=130x110 - LIBINPUT_ATTR_TOUCH_SIZE_RANGE=60:40 - -libinput:touchpad:input:b0003v05ACp021A* - LIBINPUT_MODEL_APPLE_TOUCHPAD_ONEBUTTON=1 - -########################################## -# Asus -########################################## -libinput:name:*ETPS/2 Elantech Touchpad*:dmi:*svnASUSTeKCOMPUTERINC.:pnX555LAB:* - LIBINPUT_MODEL_TOUCHPAD_VISIBLE_MARKER=1 - -########################################## -# Chicony -########################################## -# Acer Hawaii Keyboard, uses Chicony VID -libinput:touchpad:input:b0003v04F2p1558* - LIBINPUT_ATTR_TPKBCOMBO_LAYOUT=below - -########################################## -# Cyborg -########################################## -# Saitek Cyborg R.A.T.5 Mouse -libinput:mouse:input:b0003v06A3p0CD5* - LIBINPUT_MODEL_CYBORG_RAT=1 - -########################################## -# Dell -########################################## -libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnDellInc.:* -libinput:name:* Touchpad:dmi:*svnDellInc.:* - LIBINPUT_MODEL_TOUCHPAD_VISIBLE_MARKER=1 - -libinput:name:*AlpsPS/2 ALPS GlidePoint:dmi:*svnDellInc.:pnLatitudeE6220:* - LIBINPUT_ATTR_PRESSURE_RANGE=100:90 ########################################## # Elantech ########################################## libinput:name:*ETPS/2 Elantech Touchpad*:dmi:* LIBINPUT_ATTR_RESOLUTION_HINT=31x31 - LIBINPUT_ATTR_PRESSURE_RANGE=10:8 - -libinput:name:*ETPS/2 Elantech Touchpad*:dmi:*svnASUSTeKComputerInc.:pnUX21E:* - LIBINPUT_ATTR_PRESSURE_RANGE=24:10 - -libinput:name:*Elan Touchpad*:dt:* - LIBINPUT_ATTR_PRESSURE_RANGE=10:8 - -libinput:name:*Elan Touchpad*:dt:*Chrombook R13* -libinput:name:*Elan Touchpad*:dt:*CB5-312T* -libinput:name:*Elan Touchpad*:dt:*Elm* - LIBINPUT_ATTR_PRESSURE_RANGE=6:4 + LIBINPUT_MODEL_ELANTECH_TOUCHPAD=1 ########################################## # Google @@ -122,128 +48,29 @@ # The various chromebooks, info from modinfo chromeos_laptop, touchpad names # extrapolated from the chromiumos touchad-tests repo # https://chromium.googlesource.com/chromiumos/platform/touchpad-tests -libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*pnFalco:pvr* +libinput:name:Cypress APA Trackpad (cyapa):dmi:*pnFalco:pvr* libinput:name:SynPS/2 Synaptics TouchPad:dmi:*pn*Mario* -libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*pn*Butterfly* -libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*pn*Peppy* +libinput:name:Cypress APA Trackpad (cyapa):dmi:*pn*Butterfly* +libinput:name:Cypress APA Trackpad (cyapa):dmi:*pn*Peppy* libinput:name:SynPS/2 Synaptics TouchPad:dmi:*pn*ZGB* -libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*pn*Parrot* -libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*bvn*coreboot*:pn*Leon* -libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*bvn*coreboot*:pn*Falco* -libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*bvn*coreboot*:pn*Wolf* -libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*svn*GOOGLE*:pn*Link* +libinput:name:Cypress APA Trackpad (cyapa):dmi:*pn*Parrot* +libinput:name:Cypress APA Trackpad (cyapa):dmi:*bvn*coreboot*:pn*Leon* +libinput:name:Cypress APA Trackpad (cyapa):dmi:*bvn*coreboot*:pn*Falco* +libinput:name:Cypress APA Trackpad (cyapa):dmi:*bvn*coreboot*:pn*Wolf* +libinput:name:Cypress APA Trackpad (cyapa):dmi:*svn*GOOGLE*:pn*Link* libinput:name:SynPS/2 Synaptics TouchPad:dmi:*pn*Alex* -libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*svn*SAMSUNG*:pn*Lumpy* +libinput:name:Cypress APA Trackpad (cyapa):dmi:*svn*SAMSUNG*:pn*Lumpy* libinput:name:Atmel maXTouch Touchpad:dmi:*svn*GOOGLE*:pn*Samus* LIBINPUT_MODEL_CHROMEBOOK=1 -libinput:name:Cypress APA Trackpad ?cyapa?:dmi:* - LIBINPUT_ATTR_PRESSURE_RANGE=10:8 - -########################################## -# HP -########################################## - -# HP Compaq6910p -libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnHewlett-Packard:*pnHPCompaq6910p* - LIBINPUT_MODEL_HP6910_TOUCHPAD=1 - -# HP Compaq 8510w -libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnHewlett-Packard:*pnHPCompaq8510w* - LIBINPUT_MODEL_HP8510_TOUCHPAD=1 - -# HP Pavillion dm4 -libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnHewlett-Packard:*pnHPPaviliondm4NotebookPC* - LIBINPUT_MODEL_HP_PAVILION_DM4_TOUCHPAD=1 - -# HP Stream 11 -libinput:name:SYN1EDE:00 06CB:7442:dmi:*svnHewlett-Packard:pnHPStreamNotebookPC11* - LIBINPUT_MODEL_HP_STREAM11_TOUCHPAD=1 - -# HP Zbook Studio G3 -libinput:name:AlpsPS/2 ALPS GlidePoint:dmi:*svnHP:pnHPZBookStudioG3:* - LIBINPUT_MODEL_HP_ZBOOK_STUDIO_G3=1 - -########################################## -# HUION -########################################## -# -# HUION PenTablet device. Some of these devices send a BTN_TOOL_PEN event -# with value 1 on the first event received by the device but never send the -# matching BTN_TOOL_PEN value 0 event. The device appears as if it was -# permanently in proximity. -# -# HUION re-uses USB IDs for its devices, not every HUION tablet is -# affected by this bug, libinput will auto-disable this feature -libinput:tablet:input:b0003v256Cp* - LIBINPUT_MODEL_TABLET_NO_PROXIMITY_OUT=1 - ########################################## # LENOVO ########################################## -# X220 after a bios update updating the touchpad firmware version to 8.1 -# See https://bugzilla.redhat.com/show_bug.cgi?id=1264453 for details -# If the touchpad is unresponsive and dmesg includes this line -# psmouse serio1: synaptics: Touchpad model: 1, fw: 8.1 [...] -# then copy the two lines below into a new file -# /etc/udev/hwdb.d/90-libinput-x220-touchpad-fw81.hwdb, then run -# sudo udevadm hwdb --update and reboot. -# -# Copy the two lines below: -#libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*:pvrThinkPadX220* -# LIBINPUT_MODEL_LENOVO_X220_TOUCHPAD_FW81=1 - # X230 (Tablet) libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*:pvrThinkPadX230* LIBINPUT_MODEL_LENOVO_X230=1 -# Lenovo T450/T460 and all other Lenovos of the *50 and *60 generation, -# including the X1 Carbon 3rd gen -libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*:pvrThinkPad??50*: -libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*:pvrThinkPad??60*: -libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*:pvrThinkPadX1Carbon3rd:* - LIBINPUT_MODEL_LENOVO_T450_TOUCHPAD=1 - LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD=150 - -# Lenovo ThinkPad Compact USB Keyboard with TrackPoint -libinput:keyboard:input:b0003v17EFp6047* - LIBINPUT_ATTR_KEYBOARD_INTEGRATION=external - -########################################## -# Logitech -########################################## -libinput:name:*Logitech M570*:dmi:* - LIBINPUT_MODEL_TRACKBALL=1 - -# Logitech Marble Mouse trackball -libinput:mouse:input:b0003v046DpC408* - LIBINPUT_MODEL_LOGITECH_MARBLE_MOUSE=1 - -########################################## -# Microsoft -########################################## -# Surface3 needs us to write the open lid switch event -libinput:name:*Lid Switch*:dmi:*svnMicrosoftCorporation:pnSurface3:* - LIBINPUT_ATTR_LID_SWITCH_RELIABILITY=write_open - -# Surface 3 Type Cover keyboard -libinput:name:*Microsoft Surface Type Cover Keyboard*:dmi:*svnMicrosoftCorporation:pnSurface3:* - LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal - -# Microsoft Microsoft® Nano Transceiver v2.0" -libinput:mouse:input:b0003v045Ep0800* - LIBINPUT_MODEL_MS_NANO_TRANSCEIVER=1 - -########################################## -# Razer -########################################## -libinput:keyboard:input:b0003v1532p0220* - LIBINPUT_ATTR_KEYBOARD_INTEGRATION=internal - -libinput:name:*Lid Switch*:dmi:*svnRazer:pnBlade* - LIBINPUT_ATTR_LID_SWITCH_RELIABILITY=write_open - ########################################## # Synaptics ########################################## @@ -275,10 +102,3 @@ ########################################## libinput:touchpad:input:b0003v056Ap* LIBINPUT_MODEL_WACOM_TOUCHPAD=1 - -########################################## -# Anything that has trackball in the name -########################################## -libinput:name:*Trackball*:dmi:* - LIBINPUT_MODEL_TRACKBALL=1 - diff -Nru libinput-1.10.3/udev/90-libinput-model-quirks.rules libinput-0.21.0/udev/90-libinput-model-quirks.rules --- libinput-1.10.3/udev/90-libinput-model-quirks.rules 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/udev/90-libinput-model-quirks.rules 2015-08-04 00:58:32.000000000 +0000 @@ -0,0 +1,36 @@ +# Do not edit this file, it will be overwritten on update +# +# This file contains lookup rules for libinput model-specific quirks. +# The contents of this file are a contract between libinput, udev rules and +# the hwdb. +# IT IS NOT A STABLE API AND SUBJECT TO CHANGE AT ANY TIME +# +# The hwdb database is in: +# 90-libinput-model-quirks.hwdb + +ACTION!="add|change", GOTO="libinput_model_quirks_end" +KERNEL!="event*", GOTO="libinput_model_quirks_end" + +# Touchpad firmware detection, two-stage process. +# First, run the program and import the LIBINPUT_MODEL_FIRMWARE_VERSION +# environment (if any) +KERNELS=="*input*", \ + ENV{ID_INPUT_TOUCHPAD}=="1", \ + IMPORT{program}="libinput-model-quirks %S%p" + +# Second, match on anything with that env set and import from the hwdb +KERNELS=="*input*", \ + ENV{ID_INPUT_TOUCHPAD}=="1", \ + ENV{LIBINPUT_MODEL_FIRMWARE_VERSION}!="", \ + IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:fwversion:$env{LIBINPUT_MODEL_FIRMWARE_VERSION}'" +# End of touchpad firmware detection + +# libinput:touchpad: +ENV{ID_INPUT_TOUCHPAD}=="1", \ + IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:touchpad:" + +# libinput:name::dmi: +KERNELS=="input*", \ + IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:$attr{[dmi/id]modalias}'" + +LABEL="libinput_model_quirks_end" diff -Nru libinput-1.10.3/udev/90-libinput-model-quirks.rules.in libinput-0.21.0/udev/90-libinput-model-quirks.rules.in --- libinput-1.10.3/udev/90-libinput-model-quirks.rules.in 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/udev/90-libinput-model-quirks.rules.in 2015-07-31 01:50:42.000000000 +0000 @@ -29,24 +29,8 @@ ENV{ID_INPUT_TOUCHPAD}=="1", \ IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:touchpad:" -# libinput:tablet: -ENV{ID_INPUT_TABLET}=="1", \ - IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:tablet:" - -# libinput:mouse: -ENV{ID_INPUT_MOUSE}=="1", \ - IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:mouse:" - -# libinput:touchpad: -ENV{ID_INPUT_KEYBOARD}=="1", \ - IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:keyboard:" - # libinput:name::dmi: KERNELS=="input*", \ IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:$attr{[dmi/id]modalias}'" -# libinput:name::dt: -KERNELS=="input*", \ - IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:dt:$attr{[devicetree/base]model}'" - LABEL="libinput_model_quirks_end" diff -Nru libinput-1.10.3/udev/libinput-device-group.c libinput-0.21.0/udev/libinput-device-group.c --- libinput-1.10.3/udev/libinput-device-group.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/udev/libinput-device-group.c 2015-07-15 04:18:08.000000000 +0000 @@ -21,129 +21,11 @@ * DEALINGS IN THE SOFTWARE. */ -#include "config.h" - #include #include #include #include -#include "libinput-util.h" - -#if HAVE_LIBWACOM_GET_PAIRED_DEVICE -#include - -static void -wacom_handle_paired(struct udev_device *device, - int *vendor_id, - int *product_id) -{ - WacomDeviceDatabase *db = NULL; - WacomDevice *tablet = NULL; - const WacomMatch *paired; - - db = libwacom_database_new(); - if (!db) - goto out; - - tablet = libwacom_new_from_usbid(db, *vendor_id, *product_id, NULL); - if (!tablet) - goto out; - paired = libwacom_get_paired_device(tablet); - if (!paired) - goto out; - - *vendor_id = libwacom_match_get_vendor_id(paired); - *product_id = libwacom_match_get_product_id(paired); - -out: - if (tablet) - libwacom_destroy(tablet); - if (db) - libwacom_database_destroy(db); -} -#endif - -static int -find_tree_distance(struct udev_device *a, struct udev_device *b) -{ - struct udev_device *ancestor_a = a; - int dist_a = 0; - - while (ancestor_a != NULL) { - const char *path_a = udev_device_get_syspath(ancestor_a); - struct udev_device *ancestor_b = b; - int dist_b = 0; - - while (ancestor_b != NULL) { - const char *path_b = udev_device_get_syspath(ancestor_b); - - if (streq(path_a, path_b)) - return dist_a + dist_b; - - dist_b++; - ancestor_b = udev_device_get_parent(ancestor_b); - } - - dist_a++; - ancestor_a = udev_device_get_parent(ancestor_a); - } - return -1; -} - -static void -wacom_handle_ekr(struct udev_device *device, - int *vendor_id, - int *product_id) -{ - struct udev *udev; - struct udev_enumerate *e; - struct udev_list_entry *entry; - int best_dist = -1; - - udev = udev_device_get_udev(device); - e = udev_enumerate_new(udev); - udev_enumerate_add_match_subsystem(e, "input"); - udev_enumerate_add_match_sysname(e, "input*"); - udev_enumerate_scan_devices(e); - - udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) { - struct udev_device *d; - const char *path; - const char *pidstr, *vidstr; - int pid, vid, dist; - - /* Find and use the closest Wacom device on the system, - * relying on wacom_handle_paired() to fix our ID later - * if needed. - */ - path = udev_list_entry_get_name(entry); - d = udev_device_new_from_syspath(udev, path); - if (!d) - continue; - - vidstr = udev_device_get_property_value(d, "ID_VENDOR_ID"); - pidstr = udev_device_get_property_value(d, "ID_MODEL_ID"); - - if (vidstr && pidstr && - safe_atoi_base(vidstr, &vid, 16) && - safe_atoi_base(pidstr, &pid, 16) && - vid == VENDOR_ID_WACOM && - pid != PRODUCT_ID_WACOM_EKR) { - dist = find_tree_distance(device, d); - if (dist > 0 && (dist < best_dist || best_dist < 0)) { - *vendor_id = vid; - *product_id = pid; - best_dist = dist; - } - } - - udev_device_unref(d); - } - - udev_enumerate_unref(e); -} - int main(int argc, char **argv) { int rc = 1; @@ -152,7 +34,6 @@ const char *syspath, *phys = NULL; const char *product; - int bustype, vendor_id, product_id, version; char group[1024]; char *str; @@ -192,36 +73,8 @@ on that*/ product = udev_device_get_property_value(device, "PRODUCT"); if (!product) - product = "00/00/00/00"; - - if (sscanf(product, - "%x/%x/%x/%x", - &bustype, - &vendor_id, - &product_id, - &version) != 4) { - snprintf(group, sizeof(group), "%s:%s", product, phys); - } else { -#if HAVE_LIBWACOM_GET_PAIRED_DEVICE - if (vendor_id == VENDOR_ID_WACOM) { - if (product_id == PRODUCT_ID_WACOM_EKR) - wacom_handle_ekr(device, - &vendor_id, - &product_id); - /* This is called for the EKR as well */ - wacom_handle_paired(device, - &vendor_id, - &product_id); - } -#endif - snprintf(group, - sizeof(group), - "%x/%x/%x:%s", - bustype, - vendor_id, - product_id, - phys); - } + product = ""; + snprintf(group, sizeof(group), "%s:%s", product, phys); str = strstr(group, "/input"); if (str) diff -Nru libinput-1.10.3/udev/libinput-model-quirks.c libinput-0.21.0/udev/libinput-model-quirks.c --- libinput-1.10.3/udev/libinput-model-quirks.c 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/udev/libinput-model-quirks.c 2015-08-03 03:44:04.000000000 +0000 @@ -63,9 +63,9 @@ if (sscanf(product, "%x/%x/%x/%x", &bus, &vid, &pid, &version) != 4) return; - /* ALPS' firmware version is the version */ - if (version) - printf("LIBINPUT_MODEL_FIRMWARE_VERSION=%x\n", version); + /* ALPS' firmware version is the PID */ + if (pid) + printf("LIBINPUT_MODEL_FIRMWARE_VERSION=%d\n", pid); } static void @@ -127,7 +127,7 @@ if (!device) goto out; - if (prop_value(device, "ID_INPUT_TOUCHPAD")) + if (udev_device_get_property_value(device, "ID_INPUT_TOUCHPAD")) handle_touchpad(device); rc = 0; diff -Nru libinput-1.10.3/udev/Makefile.am libinput-0.21.0/udev/Makefile.am --- libinput-1.10.3/udev/Makefile.am 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/udev/Makefile.am 2015-08-04 00:33:56.000000000 +0000 @@ -0,0 +1,36 @@ +udevdir=$(UDEV_DIR) +udev_PROGRAMS = libinput-device-group \ + libinput-model-quirks + +litest_rules = 80-libinput-device-groups-litest.rules \ + 90-libinput-model-quirks-litest.rules +noinst_SCRIPTS = $(litest_rules) + +libinput_device_group_SOURCES = libinput-device-group.c +libinput_device_group_CFLAGS = $(LIBUDEV_CFLAGS) $(GCC_CFLAGS) +libinput_device_group_LDADD = $(LIBUDEV_LIBS) + +libinput_model_quirks_SOURCES = libinput-model-quirks.c +libinput_model_quirks_CFLAGS = \ + -I$(top_srcdir)/src \ + $(LIBUDEV_CFLAGS) \ + $(GCC_CFLAGS) +libinput_model_quirks_LDADD = $(LIBUDEV_LIBS) + +udev_rulesdir=$(UDEV_DIR)/rules.d +dist_udev_rules_DATA = \ + 80-libinput-device-groups.rules \ + 90-libinput-model-quirks.rules + +udev_hwdbdir=$(UDEV_DIR)/hwdb.d +dist_udev_hwdb_DATA = \ + 90-libinput-model-quirks.hwdb + +%-litest.rules: %.rules.in + $(SED) -e "s|\@UDEV_TEST_PATH\@|$(abs_builddir)/|" < $^ > $@ + +CLEANFILES = $(litest_rules) +DISTCLEANFILES = \ + 80-libinput-device-groups.rules \ + 90-libinput-model-quirks.rules +EXTRA_DIST = 80-libinput-test-device.rules diff -Nru libinput-1.10.3/udev/Makefile.in libinput-0.21.0/udev/Makefile.in --- libinput-1.10.3/udev/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ libinput-0.21.0/udev/Makefile.in 2015-08-04 00:58:31.000000000 +0000 @@ -0,0 +1,830 @@ +# Makefile.in generated by automake 1.15 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2014 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__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +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@ +udev_PROGRAMS = libinput-device-group$(EXEEXT) \ + libinput-model-quirks$(EXEEXT) +subdir = udev +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(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)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(dist_udev_hwdb_DATA) \ + $(dist_udev_rules_DATA) $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = 80-libinput-device-groups.rules \ + 90-libinput-model-quirks.rules +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(udevdir)" "$(DESTDIR)$(udev_hwdbdir)" \ + "$(DESTDIR)$(udev_rulesdir)" +PROGRAMS = $(udev_PROGRAMS) +am_libinput_device_group_OBJECTS = \ + libinput_device_group-libinput-device-group.$(OBJEXT) +libinput_device_group_OBJECTS = $(am_libinput_device_group_OBJECTS) +am__DEPENDENCIES_1 = +libinput_device_group_DEPENDENCIES = $(am__DEPENDENCIES_1) +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 = +libinput_device_group_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libinput_device_group_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_libinput_model_quirks_OBJECTS = \ + libinput_model_quirks-libinput-model-quirks.$(OBJEXT) +libinput_model_quirks_OBJECTS = $(am_libinput_model_quirks_OBJECTS) +libinput_model_quirks_DEPENDENCIES = $(am__DEPENDENCIES_1) +libinput_model_quirks_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libinput_model_quirks_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SCRIPTS = $(noinst_SCRIPTS) +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 = $(libinput_device_group_SOURCES) \ + $(libinput_model_quirks_SOURCES) +DIST_SOURCES = $(libinput_device_group_SOURCES) \ + $(libinput_model_quirks_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +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; }; \ + } +DATA = $(dist_udev_hwdb_DATA) $(dist_udev_rules_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__DIST_COMMON = $(srcdir)/80-libinput-device-groups.rules.in \ + $(srcdir)/90-libinput-model-quirks.rules.in \ + $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADDR2LINE = @ADDR2LINE@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_LIBS = @CAIRO_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOT = @DOT@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GCC_CFLAGS = @GCC_CFLAGS@ +GCC_CXXFLAGS = @GCC_CXXFLAGS@ +GREP = @GREP@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBEVDEV_CFLAGS = @LIBEVDEV_CFLAGS@ +LIBEVDEV_LIBS = @LIBEVDEV_LIBS@ +LIBINPUT_LT_VERSION = @LIBINPUT_LT_VERSION@ +LIBINPUT_VERSION = @LIBINPUT_VERSION@ +LIBINPUT_VERSION_MAJOR = @LIBINPUT_VERSION_MAJOR@ +LIBINPUT_VERSION_MICRO = @LIBINPUT_VERSION_MICRO@ +LIBINPUT_VERSION_MINOR = @LIBINPUT_VERSION_MINOR@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBUDEV_CFLAGS = @LIBUDEV_CFLAGS@ +LIBUDEV_LIBS = @LIBUDEV_LIBS@ +LIBUNWIND_CFLAGS = @LIBUNWIND_CFLAGS@ +LIBUNWIND_LIBS = @LIBUNWIND_LIBS@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MTDEV_CFLAGS = @MTDEV_CFLAGS@ +MTDEV_LIBS = @MTDEV_LIBS@ +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@ +STRIP = @STRIP@ +UDEV_DIR = @UDEV_DIR@ +UDEV_TEST_PATH = @UDEV_TEST_PATH@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +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_CXX = @ac_ct_CXX@ +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@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +udevdir = $(UDEV_DIR) +litest_rules = 80-libinput-device-groups-litest.rules \ + 90-libinput-model-quirks-litest.rules + +noinst_SCRIPTS = $(litest_rules) +libinput_device_group_SOURCES = libinput-device-group.c +libinput_device_group_CFLAGS = $(LIBUDEV_CFLAGS) $(GCC_CFLAGS) +libinput_device_group_LDADD = $(LIBUDEV_LIBS) +libinput_model_quirks_SOURCES = libinput-model-quirks.c +libinput_model_quirks_CFLAGS = \ + -I$(top_srcdir)/src \ + $(LIBUDEV_CFLAGS) \ + $(GCC_CFLAGS) + +libinput_model_quirks_LDADD = $(LIBUDEV_LIBS) +udev_rulesdir = $(UDEV_DIR)/rules.d +dist_udev_rules_DATA = \ + 80-libinput-device-groups.rules \ + 90-libinput-model-quirks.rules + +udev_hwdbdir = $(UDEV_DIR)/hwdb.d +dist_udev_hwdb_DATA = \ + 90-libinput-model-quirks.hwdb + +CLEANFILES = $(litest_rules) +DISTCLEANFILES = \ + 80-libinput-device-groups.rules \ + 90-libinput-model-quirks.rules + +EXTRA_DIST = 80-libinput-test-device.rules +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(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 udev/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign udev/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: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +80-libinput-device-groups.rules: $(top_builddir)/config.status $(srcdir)/80-libinput-device-groups.rules.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +90-libinput-model-quirks.rules: $(top_builddir)/config.status $(srcdir)/90-libinput-model-quirks.rules.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-udevPROGRAMS: $(udev_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(udev_PROGRAMS)'; test -n "$(udevdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(udevdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(udevdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(udevdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(udevdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-udevPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(udev_PROGRAMS)'; test -n "$(udevdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(udevdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(udevdir)" && rm -f $$files + +clean-udevPROGRAMS: + @list='$(udev_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +libinput-device-group$(EXEEXT): $(libinput_device_group_OBJECTS) $(libinput_device_group_DEPENDENCIES) $(EXTRA_libinput_device_group_DEPENDENCIES) + @rm -f libinput-device-group$(EXEEXT) + $(AM_V_CCLD)$(libinput_device_group_LINK) $(libinput_device_group_OBJECTS) $(libinput_device_group_LDADD) $(LIBS) + +libinput-model-quirks$(EXEEXT): $(libinput_model_quirks_OBJECTS) $(libinput_model_quirks_DEPENDENCIES) $(EXTRA_libinput_model_quirks_DEPENDENCIES) + @rm -f libinput-model-quirks$(EXEEXT) + $(AM_V_CCLD)$(libinput_model_quirks_LINK) $(libinput_model_quirks_OBJECTS) $(libinput_model_quirks_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_device_group-libinput-device-group.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinput_model_quirks-libinput-model-quirks.Po@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 -o $@ $< + +.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 -o $@ `$(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 $@ $< + +libinput_device_group-libinput-device-group.o: libinput-device-group.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_device_group_CFLAGS) $(CFLAGS) -MT libinput_device_group-libinput-device-group.o -MD -MP -MF $(DEPDIR)/libinput_device_group-libinput-device-group.Tpo -c -o libinput_device_group-libinput-device-group.o `test -f 'libinput-device-group.c' || echo '$(srcdir)/'`libinput-device-group.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_device_group-libinput-device-group.Tpo $(DEPDIR)/libinput_device_group-libinput-device-group.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libinput-device-group.c' object='libinput_device_group-libinput-device-group.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_device_group_CFLAGS) $(CFLAGS) -c -o libinput_device_group-libinput-device-group.o `test -f 'libinput-device-group.c' || echo '$(srcdir)/'`libinput-device-group.c + +libinput_device_group-libinput-device-group.obj: libinput-device-group.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_device_group_CFLAGS) $(CFLAGS) -MT libinput_device_group-libinput-device-group.obj -MD -MP -MF $(DEPDIR)/libinput_device_group-libinput-device-group.Tpo -c -o libinput_device_group-libinput-device-group.obj `if test -f 'libinput-device-group.c'; then $(CYGPATH_W) 'libinput-device-group.c'; else $(CYGPATH_W) '$(srcdir)/libinput-device-group.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_device_group-libinput-device-group.Tpo $(DEPDIR)/libinput_device_group-libinput-device-group.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libinput-device-group.c' object='libinput_device_group-libinput-device-group.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_device_group_CFLAGS) $(CFLAGS) -c -o libinput_device_group-libinput-device-group.obj `if test -f 'libinput-device-group.c'; then $(CYGPATH_W) 'libinput-device-group.c'; else $(CYGPATH_W) '$(srcdir)/libinput-device-group.c'; fi` + +libinput_model_quirks-libinput-model-quirks.o: libinput-model-quirks.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_model_quirks_CFLAGS) $(CFLAGS) -MT libinput_model_quirks-libinput-model-quirks.o -MD -MP -MF $(DEPDIR)/libinput_model_quirks-libinput-model-quirks.Tpo -c -o libinput_model_quirks-libinput-model-quirks.o `test -f 'libinput-model-quirks.c' || echo '$(srcdir)/'`libinput-model-quirks.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_model_quirks-libinput-model-quirks.Tpo $(DEPDIR)/libinput_model_quirks-libinput-model-quirks.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libinput-model-quirks.c' object='libinput_model_quirks-libinput-model-quirks.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_model_quirks_CFLAGS) $(CFLAGS) -c -o libinput_model_quirks-libinput-model-quirks.o `test -f 'libinput-model-quirks.c' || echo '$(srcdir)/'`libinput-model-quirks.c + +libinput_model_quirks-libinput-model-quirks.obj: libinput-model-quirks.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_model_quirks_CFLAGS) $(CFLAGS) -MT libinput_model_quirks-libinput-model-quirks.obj -MD -MP -MF $(DEPDIR)/libinput_model_quirks-libinput-model-quirks.Tpo -c -o libinput_model_quirks-libinput-model-quirks.obj `if test -f 'libinput-model-quirks.c'; then $(CYGPATH_W) 'libinput-model-quirks.c'; else $(CYGPATH_W) '$(srcdir)/libinput-model-quirks.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libinput_model_quirks-libinput-model-quirks.Tpo $(DEPDIR)/libinput_model_quirks-libinput-model-quirks.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libinput-model-quirks.c' object='libinput_model_quirks-libinput-model-quirks.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinput_model_quirks_CFLAGS) $(CFLAGS) -c -o libinput_model_quirks-libinput-model-quirks.obj `if test -f 'libinput-model-quirks.c'; then $(CYGPATH_W) 'libinput-model-quirks.c'; else $(CYGPATH_W) '$(srcdir)/libinput-model-quirks.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-dist_udev_hwdbDATA: $(dist_udev_hwdb_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_udev_hwdb_DATA)'; test -n "$(udev_hwdbdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(udev_hwdbdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(udev_hwdbdir)" || 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)$(udev_hwdbdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(udev_hwdbdir)" || exit $$?; \ + done + +uninstall-dist_udev_hwdbDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_udev_hwdb_DATA)'; test -n "$(udev_hwdbdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(udev_hwdbdir)'; $(am__uninstall_files_from_dir) +install-dist_udev_rulesDATA: $(dist_udev_rules_DATA) + @$(NORMAL_INSTALL) + @list='$(dist_udev_rules_DATA)'; test -n "$(udev_rulesdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(udev_rulesdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(udev_rulesdir)" || 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)$(udev_rulesdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(udev_rulesdir)" || exit $$?; \ + done + +uninstall-dist_udev_rulesDATA: + @$(NORMAL_UNINSTALL) + @list='$(dist_udev_rules_DATA)'; test -n "$(udev_rulesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(udev_rulesdir)'; $(am__uninstall_files_from_dir) + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + 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-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + 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: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + 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 $(PROGRAMS) $(SCRIPTS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(udevdir)" "$(DESTDIR)$(udev_hwdbdir)" "$(DESTDIR)$(udev_rulesdir)"; 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) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +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-libtool clean-udevPROGRAMS \ + 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-dist_udev_hwdbDATA \ + install-dist_udev_rulesDATA install-udevPROGRAMS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +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-dist_udev_hwdbDATA \ + uninstall-dist_udev_rulesDATA uninstall-udevPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-udevPROGRAMS cscopelist-am ctags ctags-am \ + 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-dist_udev_hwdbDATA \ + install-dist_udev_rulesDATA install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + install-udevPROGRAMS installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-dist_udev_hwdbDATA uninstall-dist_udev_rulesDATA \ + uninstall-udevPROGRAMS + +.PRECIOUS: Makefile + + +%-litest.rules: %.rules.in + $(SED) -e "s|\@UDEV_TEST_PATH\@|$(abs_builddir)/|" < $^ > $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -Nru libinput-1.10.3/udev/parse_hwdb.py libinput-0.21.0/udev/parse_hwdb.py --- libinput-1.10.3/udev/parse_hwdb.py 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/udev/parse_hwdb.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,210 +0,0 @@ -#!/usr/bin/env python3 -# vim: set expandtab shiftwidth=4: -# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */ -# -# ANY MODIFICATIONS TO THIS FILE SHOULD BE MERGED INTO THE SYSTEMD UPSTREAM -# -# This file is part of systemd. It is distributed under the MIT license, see -# below. -# -# Copyright 2016 Zbigniew Jędrzejewski-Szmek -# -# The MIT License (MIT) -# -# 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 OR COPYRIGHT HOLDERS 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. - -import functools -import glob -import string -import sys -import os - -try: - from pyparsing import (Word, White, Literal, ParserElement, Regex, - LineEnd, OneOrMore, Combine, Or, Optional, - Suppress, Group, nums, alphanums, printables, - stringEnd, pythonStyleComment, - ParseBaseException) -except ImportError: - print('pyparsing is not available') - sys.exit(77) - -try: - from evdev.ecodes import ecodes -except ImportError: - ecodes = None - print('WARNING: evdev is not available') - -EOL = LineEnd().suppress() -EMPTYLINE = LineEnd() -COMMENTLINE = pythonStyleComment + EOL -INTEGER = Word(nums) -REAL = Combine((INTEGER + Optional('.' + Optional(INTEGER))) ^ ('.' + INTEGER)) -UDEV_TAG = Word(string.ascii_uppercase, alphanums + '_') - -TYPES = { - 'libinput': ('name', 'touchpad', 'mouse', 'keyboard', 'tablet'), -} - - -@functools.lru_cache() -def hwdb_grammar(): - ParserElement.setDefaultWhitespaceChars('') - - prefix = Or(category + ':' + Or(conn) + ':' - for category, conn in TYPES.items()) - matchline = Combine(prefix + Word(printables + ' ' + '®')) + EOL - propertyline = ( - White(' ', exact=1).suppress() - + Combine(UDEV_TAG - - '=' - - Word(alphanums + '_=:@*.! ') - - Optional(pythonStyleComment)) - + EOL - ) - propertycomment = White(' ', exact=1) + pythonStyleComment + EOL - - group = ( - OneOrMore(matchline('MATCHES*') ^ COMMENTLINE.suppress()) - - OneOrMore(propertyline('PROPERTIES*') ^ propertycomment.suppress()) - - (EMPTYLINE ^ stringEnd()).suppress() - ) - commentgroup = OneOrMore(COMMENTLINE).suppress() - EMPTYLINE.suppress() - - grammar = OneOrMore(group('GROUPS*') ^ commentgroup) + stringEnd() - - return grammar - - -@functools.lru_cache() -def property_grammar(): - ParserElement.setDefaultWhitespaceChars(' ') - - model_props = [ - Regex(r'LIBINPUT_MODEL_[_0-9A-Z]+')('NAME') - - Suppress('=') - (Literal('1'))('VALUE') - ] - - dimension = INTEGER('X') + Suppress('x') + INTEGER('Y') - - crange = INTEGER('X') + Suppress(':') + INTEGER('Y') - vprops = ( - ('LIBINPUT_ATTR_SIZE_HINT', Group(dimension('SETTINGS*'))), - ('LIBINPUT_ATTR_RESOLUTION_HINT', Group(dimension('SETTINGS*'))), - ('LIBINPUT_ATTR_PRESSURE_RANGE', Group(crange('SETTINGS*'))), - ('LIBINPUT_ATTR_TOUCH_SIZE_RANGE', Group(crange('SETTINGS*'))), - ('LIBINPUT_ATTR_TPKBCOMBO_LAYOUT', Or(('below'))), - ('LIBINPUT_ATTR_LID_SWITCH_RELIABILITY', - Or(('reliable', 'write_open'))), - ('LIBINPUT_ATTR_KEYBOARD_INTEGRATION', Or(('internal', 'external'))), - ) - value_props = [Literal(name)('NAME') - Suppress('=') - val('VALUE') for - name, val in vprops] - - tprops = ( - ('LIBINPUT_ATTR_PALM_PRESSURE_THRESHOLD', INTEGER('X')), - ('LIBINPUT_ATTR_PALM_SIZE_THRESHOLD', INTEGER('X')), - ) - typed_props = [Literal(name)('NAME') - Suppress('=') - val - for name, val in tprops] - - grammar = Or(model_props + value_props + typed_props) - - return grammar - -ERROR = False - - -def error(fmt, *args, **kwargs): - global ERROR - ERROR = True - print(fmt.format(*args, **kwargs)) - - -def convert_properties(group): - matches = [m[0] for m in group.MATCHES] - props = [p[0] for p in group.PROPERTIES] - return matches, props - - -def parse(fname): - grammar = hwdb_grammar() - try: - parsed = grammar.parseFile(fname) - except ParseBaseException as e: - error('Cannot parse {}: {}', fname, e) - return [] - return [convert_properties(g) for g in parsed.GROUPS] - - -def check_match_uniqueness(groups): - matches = sum((group[0] for group in groups), []) - matches.sort() - prev = None - for match in matches: - if match == prev: - error('Match {!r} is duplicated', match) - prev = match - - -def check_one_dimension(prop, value): - if int(value[0]) <= 0 or int(value[1]) <= 0: - error('Dimension {} invalid', value) - - -def check_properties(groups): - grammar = property_grammar() - for matches, props in groups: - prop_names = set() - for prop in props: - # print('--', prop) - prop = prop.partition('#')[0].rstrip() - try: - parsed = grammar.parseString(prop) - except ParseBaseException as e: - error('Failed to parse: {!r}', prop) - continue - # print('{!r}'.format(parsed)) - if parsed.NAME in prop_names: - error('Property {} is duplicated', parsed.NAME) - prop_names.add(parsed.NAME) - if parsed.NAME == "LIBINPUT_ATTR_SIZE_HINT" or \ - parsed.NAME == "LIBINPUT_ATTR_RESOLUTION_HINT": - check_one_dimension(prop, parsed.VALUE) - - -def print_summary(fname, groups): - print('{}: {} match groups, {} matches, {} properties' - .format(fname, - len(groups), - sum(len(matches) for matches, props in groups), - sum(len(props) for matches, props in groups), - )) - - -if __name__ == '__main__': - args = sys.argv[1:] or glob.glob(os.path.dirname(sys.argv[0]) + '/*.hwdb') - - for fname in args: - groups = parse(fname) - print_summary(fname, groups) - check_match_uniqueness(groups) - check_properties(groups) - - sys.exit(ERROR) diff -Nru libinput-1.10.3/.vimdir libinput-0.21.0/.vimdir --- libinput-1.10.3/.vimdir 2018-03-14 05:34:05.000000000 +0000 +++ libinput-0.21.0/.vimdir 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -set noexpandtab shiftwidth=8 cinoptions=:0,+0,(0