sync code with last improvements from OpenBSD

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

View file

@ -0,0 +1,31 @@
# Copyright 2008 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
# on the rights to use, copy, modify, merge, publish, distribute, sub
# license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL
# ADAM JACKSON 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.
bin_PROGRAMS = synclient syndaemon
AM_CPPFLAGS = -I$(top_srcdir)/include
AM_CFLAGS = $(XI_CFLAGS)
AM_LDFLAGS = $(XI_LIBS)
synclient_SOURCES = synclient.c
syndaemon_SOURCES = syndaemon.c
syndaemon_CFLAGS = $(AM_CFLAGS) $(XTST_CFLAGS)
syndaemon_LDFLAGS = $(AM_LDFLAGS) $(XTST_LIBS)

View file

@ -0,0 +1,660 @@
# Makefile.in generated by automake 1.12.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Copyright 2008 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
# on the rights to use, copy, modify, merge, publish, distribute, sub
# license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL
# ADAM JACKSON 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.
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = synclient$(EXEEXT) syndaemon$(EXEEXT)
subdir = tools
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_synclient_OBJECTS = synclient.$(OBJEXT)
synclient_OBJECTS = $(am_synclient_OBJECTS)
synclient_LDADD = $(LDADD)
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 =
am_syndaemon_OBJECTS = syndaemon-syndaemon.$(OBJEXT)
syndaemon_OBJECTS = $(am_syndaemon_OBJECTS)
syndaemon_LDADD = $(LDADD)
syndaemon_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(syndaemon_CFLAGS) \
$(CFLAGS) $(syndaemon_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 = $(synclient_SOURCES) $(syndaemon_SOURCES)
DIST_SOURCES = $(synclient_SOURCES) $(syndaemon_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
APP_MAN_DIR = @APP_MAN_DIR@
APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHANGELOG_CMD = @CHANGELOG_CMD@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CWARNFLAGS = @CWARNFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_CMD = @INSTALL_CMD@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBEVDEV_CFLAGS = @LIBEVDEV_CFLAGS@
LIBEVDEV_LIBS = @LIBEVDEV_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
VERSION = @VERSION@
XI_CFLAGS = @XI_CFLAGS@
XI_LIBS = @XI_LIBS@
XORG_CFLAGS = @XORG_CFLAGS@
XORG_LIBS = @XORG_LIBS@
XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@
XORG_MAN_PAGE = @XORG_MAN_PAGE@
XTST_CFLAGS = @XTST_CFLAGS@
XTST_LIBS = @XTST_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
configdir = @configdir@
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@
inputdir = @inputdir@
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@
runstatedir = @runstatedir@
sbindir = @sbindir@
sdkdir = @sdkdir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/include
AM_CFLAGS = $(XI_CFLAGS)
AM_LDFLAGS = $(XI_LIBS)
synclient_SOURCES = synclient.c
syndaemon_SOURCES = syndaemon.c
syndaemon_CFLAGS = $(AM_CFLAGS) $(XTST_CFLAGS)
syndaemon_LDFLAGS = $(AM_LDFLAGS) $(XTST_LIBS)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign tools/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-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
synclient$(EXEEXT): $(synclient_OBJECTS) $(synclient_DEPENDENCIES) $(EXTRA_synclient_DEPENDENCIES)
@rm -f synclient$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(synclient_OBJECTS) $(synclient_LDADD) $(LIBS)
syndaemon$(EXEEXT): $(syndaemon_OBJECTS) $(syndaemon_DEPENDENCIES) $(EXTRA_syndaemon_DEPENDENCIES)
@rm -f syndaemon$(EXEEXT)
$(AM_V_CCLD)$(syndaemon_LINK) $(syndaemon_OBJECTS) $(syndaemon_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/synclient.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syndaemon-syndaemon.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 $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
syndaemon-syndaemon.o: syndaemon.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(syndaemon_CFLAGS) $(CFLAGS) -MT syndaemon-syndaemon.o -MD -MP -MF $(DEPDIR)/syndaemon-syndaemon.Tpo -c -o syndaemon-syndaemon.o `test -f 'syndaemon.c' || echo '$(srcdir)/'`syndaemon.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/syndaemon-syndaemon.Tpo $(DEPDIR)/syndaemon-syndaemon.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='syndaemon.c' object='syndaemon-syndaemon.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) $(syndaemon_CFLAGS) $(CFLAGS) -c -o syndaemon-syndaemon.o `test -f 'syndaemon.c' || echo '$(srcdir)/'`syndaemon.c
syndaemon-syndaemon.obj: syndaemon.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(syndaemon_CFLAGS) $(CFLAGS) -MT syndaemon-syndaemon.obj -MD -MP -MF $(DEPDIR)/syndaemon-syndaemon.Tpo -c -o syndaemon-syndaemon.obj `if test -f 'syndaemon.c'; then $(CYGPATH_W) 'syndaemon.c'; else $(CYGPATH_W) '$(srcdir)/syndaemon.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/syndaemon-syndaemon.Tpo $(DEPDIR)/syndaemon-syndaemon.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='syndaemon.c' object='syndaemon-syndaemon.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) $(syndaemon_CFLAGS) $(CFLAGS) -c -o syndaemon-syndaemon.obj `if test -f 'syndaemon.c'; then $(CYGPATH_W) 'syndaemon.c'; else $(CYGPATH_W) '$(srcdir)/syndaemon.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; 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 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-binPROGRAMS
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-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool cscopelist ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-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-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 uninstall uninstall-am uninstall-binPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -0,0 +1,523 @@
/*
* Copyright © 2002-2005,2007 Peter Osterlund
*
* 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 Red Hat
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission. Red
* Hat makes no representations about the suitability of this software
* for any purpose. It is provided "as is" without express or implied
* warranty.
*
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL THE AUTHORS 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.
*
* Authors:
* Peter Osterlund (petero2@telia.com)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/time.h>
#include <unistd.h>
#include <string.h>
#include <stddef.h>
#include <math.h>
#include <limits.h>
#include <X11/Xdefs.h>
#include <X11/Xatom.h>
#include <X11/extensions/XI.h>
#include <X11/extensions/XInput.h>
#include "synaptics-properties.h"
#ifndef XATOM_FLOAT
#define XATOM_FLOAT "FLOAT"
#endif
#define SYN_MAX_BUTTONS 12
#define SBR_MIN 10
#define SBR_MAX 1000
union flong { /* Xlibs 64-bit property handling madness */
long l;
float f;
};
enum ParaType {
PT_INT,
PT_BOOL,
PT_DOUBLE
};
struct Parameter {
char *name; /* Name of parameter */
enum ParaType type; /* Type of parameter */
double min_val; /* Minimum allowed value */
double max_val; /* Maximum allowed value */
char *prop_name; /* Property name */
int prop_format; /* Property format (0 for floats) */
int prop_offset; /* Offset inside property */
};
static struct Parameter params[] = {
{"LeftEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_EDGES, 32, 0},
{"RightEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_EDGES, 32, 1},
{"TopEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_EDGES, 32, 2},
{"BottomEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_EDGES, 32, 3},
{"FingerLow", PT_INT, 0, 255, SYNAPTICS_PROP_FINGER, 32, 0},
{"FingerHigh", PT_INT, 0, 255, SYNAPTICS_PROP_FINGER, 32, 1},
{"MaxTapTime", PT_INT, 0, 1000, SYNAPTICS_PROP_TAP_TIME, 32, 0},
{"MaxTapMove", PT_INT, 0, 2000, SYNAPTICS_PROP_TAP_MOVE, 32, 0},
{"MaxDoubleTapTime", PT_INT, 0, 1000, SYNAPTICS_PROP_TAP_DURATIONS,32, 1},
{"SingleTapTimeout", PT_INT, 0, 1000, SYNAPTICS_PROP_TAP_DURATIONS,32, 0},
{"ClickTime", PT_INT, 0, 1000, SYNAPTICS_PROP_TAP_DURATIONS,32, 2},
{"EmulateMidButtonTime", PT_INT, 0, 1000, SYNAPTICS_PROP_MIDDLE_TIMEOUT,32, 0},
{"EmulateTwoFingerMinZ", PT_INT, 0, 1000, SYNAPTICS_PROP_TWOFINGER_PRESSURE, 32, 0},
{"EmulateTwoFingerMinW", PT_INT, 0, 15, SYNAPTICS_PROP_TWOFINGER_WIDTH, 32, 0},
{"VertScrollDelta", PT_INT, -1000, 1000, SYNAPTICS_PROP_SCROLL_DISTANCE, 32, 0},
{"HorizScrollDelta", PT_INT, -1000, 1000, SYNAPTICS_PROP_SCROLL_DISTANCE, 32, 1},
{"VertEdgeScroll", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_EDGE, 8, 0},
{"HorizEdgeScroll", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_EDGE, 8, 1},
{"CornerCoasting", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_EDGE, 8, 2},
{"VertTwoFingerScroll", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_TWOFINGER, 8, 0},
{"HorizTwoFingerScroll", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_TWOFINGER, 8, 1},
{"MinSpeed", PT_DOUBLE, 0, 255.0, SYNAPTICS_PROP_SPEED, 0, /*float */ 0},
{"MaxSpeed", PT_DOUBLE, 0, 255.0, SYNAPTICS_PROP_SPEED, 0, /*float */ 1},
{"AccelFactor", PT_DOUBLE, 0, 1.0, SYNAPTICS_PROP_SPEED, 0, /*float */ 2},
{"UpDownScrolling", PT_BOOL, 0, 1, SYNAPTICS_PROP_BUTTONSCROLLING, 8, 0},
{"LeftRightScrolling", PT_BOOL, 0, 1, SYNAPTICS_PROP_BUTTONSCROLLING, 8, 1},
{"UpDownScrollRepeat", PT_BOOL, 0, 1, SYNAPTICS_PROP_BUTTONSCROLLING_REPEAT, 8, 0},
{"LeftRightScrollRepeat", PT_BOOL, 0, 1, SYNAPTICS_PROP_BUTTONSCROLLING_REPEAT, 8, 1},
{"ScrollButtonRepeat", PT_INT, SBR_MIN , SBR_MAX, SYNAPTICS_PROP_BUTTONSCROLLING_TIME, 32, 0},
{"TouchpadOff", PT_INT, 0, 2, SYNAPTICS_PROP_OFF, 8, 0},
{"LockedDrags", PT_BOOL, 0, 1, SYNAPTICS_PROP_LOCKED_DRAGS, 8, 0},
{"LockedDragTimeout", PT_INT, 0, 30000, SYNAPTICS_PROP_LOCKED_DRAGS_TIMEOUT, 32, 0},
{"RTCornerButton", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 0},
{"RBCornerButton", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 1},
{"LTCornerButton", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 2},
{"LBCornerButton", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 3},
{"TapButton1", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 4},
{"TapButton2", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 5},
{"TapButton3", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 6},
{"ClickFinger1", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_CLICK_ACTION, 8, 0},
{"ClickFinger2", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_CLICK_ACTION, 8, 1},
{"ClickFinger3", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_CLICK_ACTION, 8, 2},
{"CircularScrolling", PT_BOOL, 0, 1, SYNAPTICS_PROP_CIRCULAR_SCROLLING, 8, 0},
{"CircScrollDelta", PT_DOUBLE, .01, 3, SYNAPTICS_PROP_CIRCULAR_SCROLLING_DIST, 0 /* float */, 0},
{"CircScrollTrigger", PT_INT, 0, 8, SYNAPTICS_PROP_CIRCULAR_SCROLLING_TRIGGER, 8, 0},
{"CircularPad", PT_BOOL, 0, 1, SYNAPTICS_PROP_CIRCULAR_PAD, 8, 0},
{"PalmDetect", PT_BOOL, 0, 1, SYNAPTICS_PROP_PALM_DETECT, 8, 0},
{"PalmMinWidth", PT_INT, 0, 15, SYNAPTICS_PROP_PALM_DIMENSIONS, 32, 0},
{"PalmMinZ", PT_INT, 0, 255, SYNAPTICS_PROP_PALM_DIMENSIONS, 32, 1},
{"CoastingSpeed", PT_DOUBLE, 0, 255, SYNAPTICS_PROP_COASTING_SPEED, 0 /* float*/, 0},
{"CoastingFriction", PT_DOUBLE, 0, 255, SYNAPTICS_PROP_COASTING_SPEED, 0 /* float*/, 1},
{"PressureMotionMinZ", PT_INT, 1, 255, SYNAPTICS_PROP_PRESSURE_MOTION, 32, 0},
{"PressureMotionMaxZ", PT_INT, 1, 255, SYNAPTICS_PROP_PRESSURE_MOTION, 32, 1},
{"PressureMotionMinFactor", PT_DOUBLE, 0, 10.0,SYNAPTICS_PROP_PRESSURE_MOTION_FACTOR, 0 /*float*/, 0},
{"PressureMotionMaxFactor", PT_DOUBLE, 0, 10.0,SYNAPTICS_PROP_PRESSURE_MOTION_FACTOR, 0 /*float*/, 1},
{"GrabEventDevice", PT_BOOL, 0, 1, SYNAPTICS_PROP_GRAB, 8, 0},
{"TapAndDragGesture", PT_BOOL, 0, 1, SYNAPTICS_PROP_GESTURES, 8, 0},
{"AreaLeftEdge", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_AREA, 32, 0},
{"AreaRightEdge", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_AREA, 32, 1},
{"AreaTopEdge", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_AREA, 32, 2},
{"AreaBottomEdge", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_AREA, 32, 3},
{"HorizHysteresis", PT_INT, 0, 10000, SYNAPTICS_PROP_NOISE_CANCELLATION, 32, 0},
{"VertHysteresis", PT_INT, 0, 10000, SYNAPTICS_PROP_NOISE_CANCELLATION, 32, 1},
{"ClickPad", PT_BOOL, 0, 1, SYNAPTICS_PROP_CLICKPAD, 8, 0},
{"RightButtonAreaLeft", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 0},
{"RightButtonAreaRight", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 1},
{"RightButtonAreaTop", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 2},
{"RightButtonAreaBottom", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 3},
{"MiddleButtonAreaLeft", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 4},
{"MiddleButtonAreaRight", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 5},
{"MiddleButtonAreaTop", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 6},
{"MiddleButtonAreaBottom", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 7},
{ NULL, 0, 0, 0, 0 }
};
static double
parse_cmd(char *cmd, struct Parameter **par)
{
char *eqp = strchr(cmd, '=');
*par = NULL;
if (eqp) {
int j;
int found = 0;
*eqp = 0;
for (j = 0; params[j].name; j++) {
if (strcasecmp(cmd, params[j].name) == 0) {
found = 1;
break;
}
}
if (found) {
double val = atof(&eqp[1]);
*par = &params[j];
if (val < (*par)->min_val)
val = (*par)->min_val;
if (val > (*par)->max_val)
val = (*par)->max_val;
return val;
}
else {
printf("Unknown parameter %s\n", cmd);
}
}
else {
printf("Invalid command: %s\n", cmd);
}
return 0;
}
/** Init display connection or NULL on error */
static Display *
dp_init()
{
Display *dpy = NULL;
XExtensionVersion *v = NULL;
Atom touchpad_type = 0;
Atom synaptics_property = 0;
int error = 0;
dpy = XOpenDisplay(NULL);
if (!dpy) {
fprintf(stderr, "Failed to connect to X Server.\n");
error = 1;
goto unwind;
}
v = XGetExtensionVersion(dpy, INAME);
if (!v->present ||
(v->major_version * 1000 + v->minor_version) <
(XI_Add_DeviceProperties_Major * 1000 +
XI_Add_DeviceProperties_Minor)) {
fprintf(stderr, "X server supports X Input %d.%d. I need %d.%d.\n",
v->major_version, v->minor_version,
XI_Add_DeviceProperties_Major, XI_Add_DeviceProperties_Minor);
error = 1;
goto unwind;
}
/* We know synaptics sets XI_TOUCHPAD for all the devices. */
touchpad_type = XInternAtom(dpy, XI_TOUCHPAD, True);
if (!touchpad_type) {
fprintf(stderr, "XI_TOUCHPAD not initialised.\n");
error = 1;
goto unwind;
}
synaptics_property = XInternAtom(dpy, SYNAPTICS_PROP_EDGES, True);
if (!synaptics_property) {
fprintf(stderr, "Couldn't find synaptics properties. No synaptics "
"driver loaded?\n");
error = 1;
goto unwind;
}
unwind:
XFree(v);
if (error && dpy) {
XCloseDisplay(dpy);
dpy = NULL;
}
return dpy;
}
static XDevice *
dp_get_device(Display * dpy)
{
XDevice *dev = NULL;
XDeviceInfo *info = NULL;
int ndevices = 0;
Atom touchpad_type = 0;
Atom synaptics_property = 0;
Atom *properties = NULL;
int nprops = 0;
int error = 0;
touchpad_type = XInternAtom(dpy, XI_TOUCHPAD, True);
synaptics_property = XInternAtom(dpy, SYNAPTICS_PROP_EDGES, True);
info = XListInputDevices(dpy, &ndevices);
while (ndevices--) {
if (info[ndevices].type == touchpad_type) {
dev = XOpenDevice(dpy, info[ndevices].id);
if (!dev) {
fprintf(stderr, "Failed to open device '%s'.\n",
info[ndevices].name);
error = 1;
goto unwind;
}
properties = XListDeviceProperties(dpy, dev, &nprops);
if (!properties || !nprops) {
fprintf(stderr, "No properties on device '%s'.\n",
info[ndevices].name);
error = 1;
goto unwind;
}
while (nprops--) {
if (properties[nprops] == synaptics_property)
break;
}
if (!nprops) {
fprintf(stderr, "No synaptics properties on device '%s'.\n",
info[ndevices].name);
error = 1;
goto unwind;
}
break; /* Yay, device is suitable */
}
}
unwind:
XFree(properties);
XFreeDeviceList(info);
if (!dev)
fprintf(stderr, "Unable to find a synaptics device.\n");
else if (error && dev) {
XCloseDevice(dpy, dev);
dev = NULL;
}
return dev;
}
static void
dp_set_variables(Display * dpy, XDevice * dev, int argc, char *argv[],
int first_cmd)
{
int i;
double val;
struct Parameter *par;
Atom prop, type, float_type;
int format;
unsigned char *data;
unsigned long nitems, bytes_after;
union flong *f;
long *n;
char *b;
float_type = XInternAtom(dpy, XATOM_FLOAT, True);
if (!float_type)
fprintf(stderr, "Float properties not available.\n");
for (i = first_cmd; i < argc; i++) {
val = parse_cmd(argv[i], &par);
if (!par)
continue;
prop = XInternAtom(dpy, par->prop_name, True);
if (!prop) {
fprintf(stderr, "Property for '%s' not available. Skipping.\n",
par->name);
continue;
}
XGetDeviceProperty(dpy, dev, prop, 0, 1000, False, AnyPropertyType,
&type, &format, &nitems, &bytes_after, &data);
if (type == None) {
fprintf(stderr, "Property for '%s' not available. Skipping.\n",
par->name);
continue;
}
switch (par->prop_format) {
case 8:
if (format != par->prop_format || type != XA_INTEGER) {
fprintf(stderr, " %-23s = format mismatch (%d)\n",
par->name, format);
break;
}
b = (char *) data;
b[par->prop_offset] = rint(val);
break;
case 32:
if (format != par->prop_format ||
(type != XA_INTEGER && type != XA_CARDINAL)) {
fprintf(stderr, " %-23s = format mismatch (%d)\n",
par->name, format);
break;
}
n = (long *) data;
n[par->prop_offset] = rint(val);
break;
case 0: /* float */
if (!float_type)
continue;
if (format != 32 || type != float_type) {
fprintf(stderr, " %-23s = format mismatch (%d)\n",
par->name, format);
break;
}
f = (union flong *) data;
f[par->prop_offset].f = val;
break;
}
XChangeDeviceProperty(dpy, dev, prop, type, format,
PropModeReplace, data, nitems);
XFlush(dpy);
}
}
/* FIXME: horribly inefficient. */
static void
dp_show_settings(Display * dpy, XDevice * dev)
{
int j;
Atom a, type, float_type;
int format;
unsigned long nitems, bytes_after;
unsigned char *data;
int len;
union flong *f;
long *i;
char *b;
float_type = XInternAtom(dpy, XATOM_FLOAT, True);
if (!float_type)
fprintf(stderr, "Float properties not available.\n");
printf("Parameter settings:\n");
for (j = 0; params[j].name; j++) {
struct Parameter *par = &params[j];
a = XInternAtom(dpy, par->prop_name, True);
if (!a)
continue;
len =
1 +
((par->prop_offset * (par->prop_format ? par->prop_format : 32) /
8)) / 4;
XGetDeviceProperty(dpy, dev, a, 0, len, False,
AnyPropertyType, &type, &format,
&nitems, &bytes_after, &data);
if (type == None)
continue;
switch (par->prop_format) {
case 8:
if (format != par->prop_format || type != XA_INTEGER) {
fprintf(stderr, " %-23s = format mismatch (%d)\n",
par->name, format);
break;
}
b = (char *) data;
printf(" %-23s = %d\n", par->name, b[par->prop_offset]);
break;
case 32:
if (format != par->prop_format ||
(type != XA_INTEGER && type != XA_CARDINAL)) {
fprintf(stderr, " %-23s = format mismatch (%d)\n",
par->name, format);
break;
}
i = (long *) data;
printf(" %-23s = %ld\n", par->name, i[par->prop_offset]);
break;
case 0: /* Float */
if (!float_type)
continue;
if (format != 32 || type != float_type) {
fprintf(stderr, " %-23s = format mismatch (%d)\n",
par->name, format);
break;
}
f = (union flong *) data;
printf(" %-23s = %g\n", par->name, f[par->prop_offset].f);
break;
}
XFree(data);
}
}
static void
usage(void)
{
fprintf(stderr, "Usage: synclient [-h] [-l] [-V] [-?] [var1=value1 [var2=value2] ...]\n");
fprintf(stderr, " -l List current user settings\n");
fprintf(stderr, " -V Print synclient version string and exit\n");
fprintf(stderr, " -? Show this help message\n");
fprintf(stderr, " var=value Set user parameter 'var' to 'value'.\n");
exit(1);
}
int
main(int argc, char *argv[])
{
int c;
int dump_settings = 0;
int first_cmd;
Display *dpy;
XDevice *dev;
if (argc == 1)
dump_settings = 1;
/* Parse command line parameters */
while ((c = getopt(argc, argv, "lV?")) != -1) {
switch (c) {
case 'l':
dump_settings = 1;
break;
case 'V':
printf("%s\n", VERSION);
exit(0);
case '?':
default:
usage();
}
}
first_cmd = optind;
if (!dump_settings && first_cmd == argc)
usage();
dpy = dp_init();
if (!dpy || !(dev = dp_get_device(dpy)))
return 1;
dp_set_variables(dpy, dev, argc, argv, first_cmd);
if (dump_settings)
dp_show_settings(dpy, dev);
XCloseDevice(dpy, dev);
XCloseDisplay(dpy);
return 0;
}

View file

@ -0,0 +1,676 @@
/*
* Copyright © 2003-2004 Peter Osterlund
*
* 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 Red Hat
* not be used in advertising or publicity pertaining to distribution
* of the software without specific, written prior permission. Red
* Hat makes no representations about the suitability of this software
* for any purpose. It is provided "as is" without express or implied
* warranty.
*
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
* NO EVENT SHALL THE AUTHORS 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.
*
* Authors:
* Peter Osterlund (petero2@telia.com)
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/extensions/XInput.h>
#ifdef HAVE_X11_EXTENSIONS_RECORD_H
#include <X11/Xproto.h>
#include <X11/extensions/record.h>
#endif /* HAVE_X11_EXTENSIONS_RECORD_H */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/stat.h>
#include "synaptics-properties.h"
enum KeyboardActivity {
ActivityNew,
ActivityNone,
ActivityReset
};
enum TouchpadState {
TouchpadOn = 0,
TouchpadOff = 1,
TappingOff = 2
};
static Bool pad_disabled
/* internal flag, this does not correspond to device state */ ;
static int ignore_modifier_combos;
static int ignore_modifier_keys;
static int background;
static const char *pid_file;
static Display *display;
static XDevice *dev;
static Atom touchpad_off_prop;
static enum TouchpadState previous_state;
static enum TouchpadState disable_state = TouchpadOff;
static int verbose;
#define KEYMAP_SIZE 32
static unsigned char keyboard_mask[KEYMAP_SIZE];
static void
usage(void)
{
fprintf(stderr,
"Usage: syndaemon [-i idle-time] [-m poll-delay] [-d] [-t] [-k]\n");
fprintf(stderr,
" -i How many seconds to wait after the last key press before\n");
fprintf(stderr, " enabling the touchpad. (default is 2.0s)\n");
fprintf(stderr, " -m How many milli-seconds to wait until next poll.\n");
fprintf(stderr, " (default is 200ms)\n");
fprintf(stderr, " -d Start as a daemon, i.e. in the background.\n");
fprintf(stderr, " -p Create a pid file with the specified name.\n");
fprintf(stderr,
" -t Only disable tapping and scrolling, not mouse movements.\n");
fprintf(stderr,
" -k Ignore modifier keys when monitoring keyboard activity.\n");
fprintf(stderr, " -K Like -k but also ignore Modifier+Key combos.\n");
fprintf(stderr, " -R Use the XRecord extension.\n");
fprintf(stderr, " -v Print diagnostic messages.\n");
fprintf(stderr, " -? Show this help message.\n");
exit(1);
}
static void
store_current_touchpad_state(void)
{
Atom real_type;
int real_format;
unsigned long nitems, bytes_after;
unsigned char *data;
if ((XGetDeviceProperty(display, dev, touchpad_off_prop, 0, 1, False,
XA_INTEGER, &real_type, &real_format, &nitems,
&bytes_after, &data) == Success) &&
(real_type != None)) {
previous_state = data[0];
}
}
/**
* Toggle touchpad enabled/disabled state, decided by value.
*/
static void
toggle_touchpad(Bool enable)
{
unsigned char data;
if (pad_disabled && enable) {
data = previous_state;
pad_disabled = False;
if (verbose)
printf("Enable\n");
}
else if (!pad_disabled && !enable &&
previous_state != disable_state && previous_state != TouchpadOff) {
store_current_touchpad_state();
pad_disabled = True;
data = disable_state;
if (verbose)
printf("Disable\n");
}
else
return;
/* This potentially overwrites a different client's setting, but ... */
XChangeDeviceProperty(display, dev, touchpad_off_prop, XA_INTEGER, 8,
PropModeReplace, &data, 1);
XFlush(display);
}
static void
signal_handler(int signum)
{
toggle_touchpad(True);
if (pid_file)
unlink(pid_file);
kill(getpid(), signum);
}
static void
install_signal_handler(void)
{
static int signals[] = {
SIGHUP, SIGINT, SIGQUIT, SIGILL, SIGTRAP, SIGABRT,
SIGBUS, SIGFPE, SIGUSR1, SIGSEGV, SIGUSR2, SIGPIPE,
SIGALRM, SIGTERM,
#ifdef SIGPWR
SIGPWR
#endif
};
int i;
struct sigaction act;
sigset_t set;
sigemptyset(&set);
act.sa_handler = signal_handler;
act.sa_mask = set;
#ifdef SA_RESETHAND
act.sa_flags = SA_RESETHAND;
#else
act.sa_flags = 0;
#endif
for (i = 0; i < sizeof(signals) / sizeof(int); i++) {
if (sigaction(signals[i], &act, NULL) == -1) {
perror("sigaction");
exit(2);
}
}
}
static enum KeyboardActivity
keyboard_activity(Display * display)
{
static unsigned char old_key_state[KEYMAP_SIZE];
unsigned char key_state[KEYMAP_SIZE];
int i;
int ret = ActivityNone;
XQueryKeymap(display, (char *) key_state);
for (i = 0; i < KEYMAP_SIZE; i++) {
if ((key_state[i] & ~old_key_state[i]) & keyboard_mask[i]) {
ret = ActivityNew;
break;
}
}
if (ignore_modifier_combos) {
for (i = 0; i < KEYMAP_SIZE; i++) {
if (key_state[i] & ~keyboard_mask[i]) {
if (old_key_state[i] & ~keyboard_mask[i])
ret = ActivityNone;
else
ret = ActivityReset;
break;
}
}
}
for (i = 0; i < KEYMAP_SIZE; i++)
old_key_state[i] = key_state[i];
return ret;
}
static double
get_time(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
return tv.tv_sec + tv.tv_usec / 1000000.0;
}
static void
main_loop(Display * display, double idle_time, int poll_delay)
{
double last_activity = 0.0;
double current_time;
keyboard_activity(display);
for (;;) {
current_time = get_time();
switch (keyboard_activity(display)) {
case ActivityNew:
last_activity = current_time;
break;
case ActivityNone:
/* NOP */;
break;
case ActivityReset:
last_activity = 0.0;
break;
}
/* If system times goes backwards, touchpad can get locked. Make
* sure our last activity wasn't in the future and reset if it was. */
if (last_activity > current_time)
last_activity = current_time - idle_time - 1;
if (current_time > last_activity + idle_time) { /* Enable touchpad */
toggle_touchpad(True);
}
else { /* Disable touchpad */
toggle_touchpad(False);
}
usleep(poll_delay);
}
}
static void
clear_bit(unsigned char *ptr, int bit)
{
int byte_num = bit / 8;
int bit_num = bit % 8;
ptr[byte_num] &= ~(1 << bit_num);
}
static void
setup_keyboard_mask(Display * display, int ignore_modifier_keys)
{
XModifierKeymap *modifiers;
int i;
for (i = 0; i < KEYMAP_SIZE; i++)
keyboard_mask[i] = 0xff;
if (ignore_modifier_keys) {
modifiers = XGetModifierMapping(display);
for (i = 0; i < 8 * modifiers->max_keypermod; i++) {
KeyCode kc = modifiers->modifiermap[i];
if (kc != 0)
clear_bit(keyboard_mask, kc);
}
XFreeModifiermap(modifiers);
}
}
/* ---- the following code is for using the xrecord extension ----- */
#ifdef HAVE_X11_EXTENSIONS_RECORD_H
#define MAX_MODIFIERS 16
/* used for exchanging information with the callback function */
struct xrecord_callback_results {
XModifierKeymap *modifiers;
Bool key_event;
Bool non_modifier_event;
KeyCode pressed_modifiers[MAX_MODIFIERS];
};
/* test if the xrecord extension is found */
Bool
check_xrecord(Display * display)
{
Bool found;
Status status;
int major_opcode, minor_opcode, first_error;
int version[2];
found = XQueryExtension(display,
"RECORD",
&major_opcode, &minor_opcode, &first_error);
status = XRecordQueryVersion(display, version, version + 1);
if (verbose && status) {
printf("X RECORD extension version %d.%d\n", version[0], version[1]);
}
return found;
}
/* called by XRecordProcessReplies() */
void
xrecord_callback(XPointer closure, XRecordInterceptData * recorded_data)
{
struct xrecord_callback_results *cbres;
xEvent *xev;
int nxev;
cbres = (struct xrecord_callback_results *) closure;
if (recorded_data->category != XRecordFromServer) {
XRecordFreeData(recorded_data);
return;
}
nxev = recorded_data->data_len / 8;
xev = (xEvent *) recorded_data->data;
while (nxev--) {
if ((xev->u.u.type == KeyPress) || (xev->u.u.type == KeyRelease)) {
int i;
int is_modifier = 0;
cbres->key_event = 1; /* remember, a key was pressed or released. */
/* test if it was a modifier */
for (i = 0; i < 8 * cbres->modifiers->max_keypermod; i++) {
KeyCode kc = cbres->modifiers->modifiermap[i];
if (kc == xev->u.u.detail) {
is_modifier = 1; /* yes, it is a modifier. */
break;
}
}
if (is_modifier) {
if (xev->u.u.type == KeyPress) {
for (i = 0; i < MAX_MODIFIERS; ++i)
if (!cbres->pressed_modifiers[i]) {
cbres->pressed_modifiers[i] = xev->u.u.detail;
break;
}
}
else { /* KeyRelease */
for (i = 0; i < MAX_MODIFIERS; ++i)
if (cbres->pressed_modifiers[i] == xev->u.u.detail)
cbres->pressed_modifiers[i] = 0;
}
}
else {
/* remember, a non-modifier was pressed. */
cbres->non_modifier_event = 1;
}
}
xev++;
}
XRecordFreeData(recorded_data); /* cleanup */
}
static int
is_modifier_pressed(const struct xrecord_callback_results *cbres)
{
int i;
for (i = 0; i < MAX_MODIFIERS; ++i)
if (cbres->pressed_modifiers[i])
return 1;
return 0;
}
void
record_main_loop(Display * display, double idle_time)
{
struct xrecord_callback_results cbres;
XRecordContext context;
XRecordClientSpec cspec = XRecordAllClients;
Display *dpy_data;
XRecordRange *range;
int i;
dpy_data = XOpenDisplay(NULL); /* we need an additional data connection. */
range = XRecordAllocRange();
range->device_events.first = KeyPress;
range->device_events.last = KeyRelease;
context = XRecordCreateContext(dpy_data, 0, &cspec, 1, &range, 1);
XRecordEnableContextAsync(dpy_data, context, xrecord_callback,
(XPointer) & cbres);
cbres.modifiers = XGetModifierMapping(display);
/* clear list of modifiers */
for (i = 0; i < MAX_MODIFIERS; ++i)
cbres.pressed_modifiers[i] = 0;
while (1) {
int fd = ConnectionNumber(dpy_data);
fd_set read_fds;
int ret;
int disable_event = 0;
int modifier_event = 0;
struct timeval timeout;
FD_ZERO(&read_fds);
FD_SET(fd, &read_fds);
ret = select(fd + 1 /* =(max descriptor in read_fds) + 1 */ ,
&read_fds, NULL, NULL,
pad_disabled ? &timeout : NULL
/* timeout only required for enabling */ );
if (FD_ISSET(fd, &read_fds)) {
cbres.key_event = 0;
cbres.non_modifier_event = 0;
XRecordProcessReplies(dpy_data);
/* If there are any events left over, they are in error. Drain them
* from the connection queue so we don't get stuck. */
while (XEventsQueued(dpy_data, QueuedAlready) > 0) {
XEvent event;
XNextEvent(dpy_data, &event);
fprintf(stderr, "bad event received, major opcode %d\n",
event.type);
}
if (!ignore_modifier_keys && cbres.key_event) {
disable_event = 1;
}
if (cbres.non_modifier_event) {
if (ignore_modifier_combos && is_modifier_pressed(&cbres)) {
modifier_event = 1;
} else {
disable_event = 1;
}
} else if (ignore_modifier_keys) {
modifier_event = 1;
}
}
if (disable_event) {
/* adjust the enable_time */
timeout.tv_sec = (int) idle_time;
timeout.tv_usec = (idle_time - (double) timeout.tv_sec) * 1.e6;
toggle_touchpad(False);
}
if (modifier_event && pad_disabled) {
toggle_touchpad(True);
}
if (ret == 0 && pad_disabled) { /* timeout => enable event */
toggle_touchpad(True);
}
} /* end while(1) */
XFreeModifiermap(cbres.modifiers);
}
#endif /* HAVE_X11_EXTENSIONS_RECORD_H */
static XDevice *
dp_get_device(Display * dpy)
{
XDevice *dev = NULL;
XDeviceInfo *info = NULL;
int ndevices = 0;
Atom touchpad_type = 0;
Atom *properties = NULL;
int nprops = 0;
int error = 0;
touchpad_type = XInternAtom(dpy, XI_TOUCHPAD, True);
touchpad_off_prop = XInternAtom(dpy, SYNAPTICS_PROP_OFF, True);
info = XListInputDevices(dpy, &ndevices);
while (ndevices--) {
if (info[ndevices].type == touchpad_type) {
dev = XOpenDevice(dpy, info[ndevices].id);
if (!dev) {
fprintf(stderr, "Failed to open device '%s'.\n",
info[ndevices].name);
error = 1;
goto unwind;
}
properties = XListDeviceProperties(dpy, dev, &nprops);
if (!properties || !nprops) {
fprintf(stderr, "No properties on device '%s'.\n",
info[ndevices].name);
error = 1;
goto unwind;
}
while (nprops--) {
if (properties[nprops] == touchpad_off_prop)
break;
}
if (nprops < 0) {
fprintf(stderr, "No synaptics properties on device '%s'.\n",
info[ndevices].name);
error = 1;
goto unwind;
}
break; /* Yay, device is suitable */
}
}
unwind:
XFree(properties);
XFreeDeviceList(info);
if (!dev)
fprintf(stderr, "Unable to find a synaptics device.\n");
else if (error && dev) {
XCloseDevice(dpy, dev);
dev = NULL;
}
return dev;
}
int
main(int argc, char *argv[])
{
double idle_time = 2.0;
int poll_delay = 200000; /* 200 ms */
int c;
int use_xrecord = 0;
/* Parse command line parameters */
while ((c = getopt(argc, argv, "i:m:dtp:kKR?v")) != EOF) {
switch (c) {
case 'i':
idle_time = atof(optarg);
break;
case 'm':
poll_delay = atoi(optarg) * 1000;
break;
case 'd':
background = 1;
break;
case 't':
disable_state = TappingOff;
break;
case 'p':
pid_file = optarg;
break;
case 'k':
ignore_modifier_keys = 1;
break;
case 'K':
ignore_modifier_combos = 1;
ignore_modifier_keys = 1;
break;
case 'R':
use_xrecord = 1;
break;
case 'v':
verbose = 1;
break;
case '?':
default:
usage();
break;
}
}
if (idle_time <= 0.0)
usage();
/* Open a connection to the X server */
display = XOpenDisplay(NULL);
if (!display) {
fprintf(stderr, "Can't open display.\n");
exit(2);
}
if (!(dev = dp_get_device(display)))
exit(2);
/* Install a signal handler to restore synaptics parameters on exit */
install_signal_handler();
if (background) {
pid_t pid;
if ((pid = fork()) < 0) {
perror("fork");
exit(3);
}
else if (pid != 0)
exit(0);
/* Child (daemon) is running here */
setsid(); /* Become session leader */
chdir("/"); /* In case the file system gets unmounted */
umask(0); /* We don't want any surprises */
if (pid_file) {
FILE *fd = fopen(pid_file, "w");
if (!fd) {
perror("Can't create pid file");
exit(3);
}
fprintf(fd, "%d\n", getpid());
fclose(fd);
}
}
pad_disabled = False;
store_current_touchpad_state();
#ifdef HAVE_X11_EXTENSIONS_RECORD_H
if (use_xrecord) {
if (check_xrecord(display))
record_main_loop(display, idle_time);
else {
fprintf(stderr, "Use of XRecord requested, but failed to "
" initialize.\n");
exit(4);
}
}
else
#endif /* HAVE_X11_EXTENSIONS_RECORD_H */
{
setup_keyboard_mask(display, ignore_modifier_keys);
/* Run the main loop */
main_loop(display, idle_time, poll_delay);
}
return 0;
}
/* vim: set noexpandtab tabstop=8 shiftwidth=4: */