diff options
author | pingc <pingc> | 2008-01-03 18:27:52 +0000 |
---|---|---|
committer | pingc <pingc> | 2008-01-03 18:27:52 +0000 |
commit | 635463a5246a16df6fd1d6b5d6070a5dc59a490d (patch) | |
tree | 55ecc77ff55fd57ab0b155dd047fe7ece2deac5d | |
parent | 50cb6085d0fbeb2f9e8d9796c0adb5d5631ea6d9 (diff) | |
download | xf86-input-wacom-635463a5246a16df6fd1d6b5d6070a5dc59a490d.tar.gz |
Clean support of outbound tracking for Bamboo
37 files changed, 1144 insertions, 964 deletions
@@ -4,7 +4,8 @@ Special thanks go to: John E. Joganic <jej@j-arkadia.com> for establishing this project; -Magnus Vigerlöf <wigge@bigfoot.com> for fixing bugs and supporting user requests. +Magnus Vigerlöf <wigge@bigfoot.com> for fixing bugs, adding new +features, and supporting user requests. Jens Georg <listen@jensgeorg.de> for being active and supportive in discussion and development groups. @@ -1,3 +1,11 @@ +2008-01-02 Ping Cheng <pingc@wacom.com> + * Updated build and configure scripts (Magnus Vigerlöf) + * Support Xorg 7.3 with multimonitors + * Unified screen, tablet, and cordinate initialization + +2007-12-19 Ping Cheng <pingc@wacom.com> + * Support multimonitor setup on 4 directions + 2007-12-13 Ping Cheng <pingc@wacom.com> * Updated wacomcpl * Incorporated Xorg 7.3 workaround from Magnus Vigerlöf @@ -2,8 +2,6 @@ aclocal if test $? != 0; then exit; fi -autoheader -if test $? != 0; then exit; fi libtoolize --force --copy if test $? != 0; then exit; fi automake --foreign --add-missing diff --git a/configure.in b/configure.in index 44846a0..30bfd3f 100644 --- a/configure.in +++ b/configure.in @@ -1,520 +1,813 @@ AC_PREREQ(2.58) -AC_INIT(src/2.4/wacom.c) -AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(linuxwacom, 0.7.9) +AC_INIT(linuxwacom, 0.7.9) +AM_INIT_AUTOMAKE AM_MAINTAINER_MODE + +AM_CONFIG_HEADER(src/include/xdrv-config.h) +AM_CONFIG_HEADER(src/include/kernel-config.h) +AM_CONFIG_HEADER(src/include/util-config.h) + AC_PROG_CC AC_PROG_AWK AC_PROG_LIBTOOL +PKG_PROG_PKG_CONFIG dnl Library versions WCM_LIBWACOMCFG_VER="0:1:0" AC_SUBST(WCM_LIBWACOMCFG_VER) dnl Targets -WCM_PROGS="" -WCM_LIBS="" +WCM_PROGS= +WCM_LIBS= +WCM_MODULES= +WCM_XF86MODULES= + WCM_TCLLIBS="" WCM_TCLPKGS="" -WCM_MODULES="" -WCM_XF86PROGS="" -WCM_XF86MODULES="" WCM_XSERVER64="" -WCM_EXPPROGS="" -WCM_EXPMODULES="" -WCM_PATCH_HID="" + +dnl Configuration +WCM_MODVER= +WCM_ENV_XFREE86=no +WCM_ENV_XORGSDK=no dnl Setup paths based on configuration parameters -AC_WCM_SET_PATHS +WCM_PREFIX=$prefix +test "$WCM_PREFIX" = NONE && WCM_PREFIX=$ac_default_prefix + +dnl ======================================================= +dnl Check architecture we compile for +AC_MSG_CHECKING(for arch type) +AC_ARG_WITH(arch, + AC_HELP_STRING([--with-arch], [Use specified architecture]), +[ WCM_ARCHITECTURE=$withval ], +[ + dnl Try the compiler for the build arch first. + dnl We may be cross compiling or building for + dnl a 32bit system with a 64 bit kernel etc. + WCM_ARCHITECTURE=`$CC -dumpmachine 2>/dev/null` + test $? = 0 || WCM_ARCHITECTURE=`uname -m` +]) +AC_MSG_RESULT($WCM_ARCHITECTURE) +WCM_ARCH="`echo $WCM_ARCHITECTURE | cut -d- -f 1`" + +dnl ======================================================= +dnl Check if we should be compiling for linux +AC_MSG_CHECKING(for kernel type) +WCM_KERNEL=`uname -s` +AC_MSG_RESULT($WCM_KERNEL) + +AC_MSG_CHECKING(for linux-based kernel) +WCM_ISLINUX=no +if echo $WCM_KERNEL | grep -i linux >/dev/null; then + WCM_ISLINUX=yes +fi +AC_MSG_RESULT($WCM_ISLINUX) + +dnl Check for 64bit XServer +WCM_OPTION_XSERVER64=no +AC_ARG_ENABLE(xserver64, + AC_HELP_STRING([--enable-xserver64], [Use 64bit XServer [[default=usually]]]), + [ WCM_OPTION_XSERVER64=$enableval ], + [ echo $WCM_ARCHITECTURE | grep "64" >/dev/null && WCM_OPTION_XSERVER64=yes ]) + +dnl Check for linux kernel override +AC_ARG_WITH(linux, + AS_HELP_STRING([--with-linux], [Override linux kernel check]), + [ WCM_ISLINUX=$withval ]) + +dnl Enable linux specific features if linux kernel is detected. +dnl kernel source, module versioning, etc +WCM_OPTION_WACOM=no +WCM_OPTION_HID=no +WCM_OPTION_USBMOUSE=no +WCM_OPTION_EVDEV=no +WCM_OPTION_MOUSEDEV=no +WCM_OPTION_INPUT=no +WCM_OPTION_MODVER=no +WCM_PATCH_HID= +WCM_ENV_KERNEL=no +WCM_KERNEL_DIR= +WCM_KERNEL_VER= +WCM_KSTACK= +if test "$WCM_ISLINUX" != yes; then + WCM_PATCH_WACDUMP="(no USB)" + WCM_PATCH_WACOMDRV="(no USB)" +else + WCM_PATCH_WACDUMP= + WCM_PATCH_WACOMDRV= + + dnl Check for kernel build environment + AC_ARG_WITH(kernel, + AS_HELP_STRING([--with-kernel=dir], [Specify kernel source directory]), + [WCM_KERNEL_DIR="$withval"]) + + AC_MSG_CHECKING(for kernel source/headers) + if test "$WCM_KERNEL_DIR" = "yes" -o -z "$WCM_KERNEL_DIR"; then + WCM_KERNEL_DIR= + dnl Kernel source not specified, guess where it is + for i in /lib/modules/`uname -r`/source /lib/modules/`uname -r`/build \ + /usr/src/linux /usr/src/linux-`uname -r` /usr/src/linux-2.4 \ + /usr/src/linux-2.6; do + if test -f "$i/include/linux/input.h"; then + WCM_KERNEL_DIR=$i + WCM_ENV_KERNEL=yes + AC_MSG_RESULT($WCM_KERNEL_DIR) + break + fi + done + if test -z "$WCM_KERNEL_DIR"; then + AC_MSG_RESULT(not found) + echo "***" + echo "*** WARNING:" + echo "*** Unable to guess kernel source directory" + echo "*** Looked at /lib/modules/`uname -r`/source, /lib/modules/`uname -r`/build," + echo "*** /usr/src/linux, /usr/src/linux-`uname -r`, /usr/src/linux-2.4, and" + echo "*** /usr/src/linux-2.6" + echo "*** Kernel modules will not be built" + echo "***" + fi + elif test "$WCM_KERNEL_DIR" != "no"; then + if test -f "$WCM_KERNEL_DIR/include/linux/input.h"; then + WCM_ENV_KERNEL=yes + AC_MSG_RESULT([yes, $WCM_KERNEL_DIR]) + else + AC_MSG_ERROR([Provided kernel path is invalid]) + fi + else + WCM_KERNEL_DIR= + AC_MSG_RESULT(no) + fi -dnl Check architecture, kernel type -AC_WCM_CHECK_ENVIRON + dnl Check which version of the driver we should compile + if test -n "$WCM_KERNEL_DIR"; then + AC_MSG_CHECKING(kernel version) + MODUTS= + for a in "$WCM_KERNEL_DIR/include/linux/version.h" \ + "$WCM_KERNEL_DIR/include/linux/utsrelease.h"; do + MODUTS=`grep UTS_RELEASE $a | sed -e 's/^[[^"]]*"\([[^"]]*\).*$/\1/g'` + test -n "$MODUTS" && break + done + if test -z "$MODUTS"; then + AC_MSG_WARN(unable to identify kernel version) + else + AC_MSG_RESULT([$MODUTS]) + MINOR=`echo $MODUTS | sed 's/[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\).*/\1/'` + if echo $MODUTS | grep "^2.4" >/dev/null; then + WCM_KERNEL_VER="2.4" + test $MINOR -ge 20 && WCM_PATCH_HID="(value_patch)" + test $MINOR -ge 22 && WCM_KERNEL_VER="2.4.22" + if echo $WCM_ARCHITECTURE | grep "x86_64" >/dev/null; then + AC_MSG_WARN([module compilation not supported on x86-64 for Linux 2.4-kernels ]) + WCM_KERNEL_VER= + fi + elif echo $MODUTS | grep "^2.6" >/dev/null; then + if test $MINOR -ge 8; then + case $MINOR in + 8) WCM_KERNEL_VER="2.6.8";; + 9) WCM_KERNEL_VER="2.6.9";; + 10) WCM_KERNEL_VER="2.6.10";; + 11|12) WCM_KERNEL_VER="2.6.11";; + 13) WCM_KERNEL_VER="2.6.13";; + 14) WCM_KERNEL_VER="2.6.14";; + 15) WCM_KERNEL_VER="2.6.15";; + 16|17) WCM_KERNEL_VER="2.6.16";; + 18) WCM_KERNEL_VER="2.6.18";; + 19|20|21) WCM_KERNEL_VER="2.6.19";; + *) WCM_KERNEL_VER="2.6.22";; + esac + else + AC_MSG_WARN([support for kernels older than 2.6.8 has been dropped after 0.7.4]) + fi + else + AC_MSG_WARN(kernel version $MODUTS not supported) + fi + fi + fi -dnl If linux kernel is detected, check for module versioning and kernel source -if test x$WCM_ISLINUX = xyes; then - AC_WCM_CHECK_KERNELSOURCE - AC_WCM_CHECK_MODSUPP - AC_WCM_CHECK_MODVER -fi + dnl Check if we have support for modules in the kernel, needed if + dnl we are compiling any kernel modules. + if test -n "$WCM_KERNEL_DIR"; then + AC_MSG_CHECKING(for kernel module support) + if grep CONFIG_MODULES $WCM_KERNEL_DIR/include/linux/autoconf.h >/dev/null 2>&1; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + WCM_KERNEL_VER= + fi + fi -dnl Check for X source or X SDK -AC_WCM_CHECK_XSOURCE -AC_WCM_CHECK_XORG_SDK -# Define X_CFLAGS, X_LIBS, X_EXTRA_LIBS and X_PRELIBS as required if X -# is found, else defines X_DISPLAY_MISSING. We need at least X_CFLAGS. -AC_PATH_XTRA + if test -n "$WCM_KERNEL_VER"; then + dnl Check for kernel module build + AC_ARG_ENABLE(wacom, + AC_HELP_STRING([--enable-wacom], [Enable building wacom.o [[default=no]]]), + WCM_OPTION_WACOM=$enable_wacom) + AC_ARG_ENABLE(hid, + AC_HELP_STRING([--enable-hid], [Enable building hid.o [[default=no]]]), + WCM_OPTION_HID=$enable_hid) + + if test "$WCM_OPTION_WACOM" = yes; then + WCM_MODULES="$WCM_MODULES wacom.o" + fi + if echo $WCM_KERNEL_VER | grep "^2.4" >/dev/null; then + AC_ARG_ENABLE(usbmouse, + AC_HELP_STRING([--enable-usbmouse], [Enable building usbmouse.o [[default=no]]]), + WCM_OPTION_USBMOUSE=$enable_usbmouse) + AC_ARG_ENABLE(evdev, + AC_HELP_STRING([--enable-evdev], [Enable building evdev.o [[default=no]]]), + WCM_OPTION_EVDEV=$enable_evdev) + AC_ARG_ENABLE(mousedev, + AC_HELP_STRING([--enable-mousedev], [Enable building mousedev.o [[default=no]]]), + WCM_OPTION_MOUSEDEV=$enable_mousedev) + AC_ARG_ENABLE(input, + AC_HELP_STRING([--enable-input], [Enable building input.o [[default=no]]]), + WCM_OPTION_INPUT=$enable_input) + AC_ARG_ENABLE(modver, + AC_HELP_STRING([--enable-modver], [Enable kernel module versioning [[default=usually]]]), + WCM_OPTION_MODVER=$enable_modver, WCM_OPTION_MODVER=yes) + + WCM_KSTACK="-mpreferred-stack-boundary=2" + if echo $WCM_ARCHITECTURE | grep "x86_64" >/dev/null; then + WCM_KSTACK="-mpreferred-stack-boundary=4 -mcmodel=kernel" + fi -dnl Check for -fstack-protector/-fno-stack-protector option in compiler -AC_MSG_CHECKING(for stack-protector flags support in $CC) -if $CC -dumpspecs | grep stack-protector >/dev/null 2>&1; then - AC_MSG_RESULT(yes) - WCM_CFLAGS_STACK_PROTECTOR="-fno-stack-protector" -else - AC_MSG_RESULT(no) - WCM_CFLAGS_STACK_PROTECTOR="" -fi -AC_SUBST(WCM_CFLAGS_STACK_PROTECTOR) + if test "$WCM_OPTION_EVDEV" = yes; then + WCM_MODULES="$WCM_MODULES evdev.o" + fi + if test "$WCM_OPTION_USBMOUSE" = yes; then + if test "$WCM_KERNEL_VER" = "2.4.22"; then + if test -f $WCM_KERNEL_DIR/drivers/usb/usbmouse.c; then + cp $WCM_KERNEL_DIR/drivers/usb/usbmouse.c src/$WCM_KERNEL_VER + WCM_MODULES="$WCM_MODULES usbmouse.o" + else + AC_MSG_WARN(usbmouse.c not found in kernel source) + WCM_OPTION_USBMOUSE=no + fi + else + WCM_MODULES="$WCM_MODULES usbmouse.o" + fi + fi + if test "$WCM_OPTION_MOUSEDEV" = yes; then + WCM_MODULES="$WCM_MODULES mousedev.o" + fi + if test "$WCM_OPTION_INPUT" = yes; then + if test "$WCM_KERNEL_VER" = "2.4.22"; then + if test -f $WCM_KERNEL_DIR/drivers/input/input.c; then + cp $WCM_KERNEL_DIR/drivers/input/input.c src/$WCM_KERNEL_VER + WCM_MODULES="$WCM_MODULES input.o" + else + AC_MSG_WARN(input.c not found in kernel source) + WCM_OPTION_INPUT=no + fi + else + WCM_MODULES="$WCM_MODULES input.o" + fi + fi + if test "$WCM_OPTION_HID" = yes; then + if test "$WCM_KERNEL_VER" = "2.4.22"; then + if test -f $WCM_KERNEL_DIR/drivers/usb/hid-input.c; then + cp $WCM_KERNEL_DIR/drivers/usb/hid-input.c src/$WCM_KERNEL_VER + cp $WCM_KERNEL_DIR/drivers/usb/hiddev.c src/$WCM_KERNEL_VER + WCM_MODULES="$WCM_MODULES hid.o" + else + AC_MSG_WARN(hid-input.c/hiddev.c not found in kernel source) + WCM_OPTION_HID=no + fi + else + WCM_MODULES="$WCM_MODULES hid.o" + fi -dnl Check for TCL, TK, and XLib -AC_WCM_CHECK_XLIB -AC_WCM_CHECK_TCL -AC_WCM_CHECK_TK + if echo "$WCM_PATCH_HID" | grep value_patch >/dev/null; then + AC_DEFINE(WCM_PATCH_DRVALUE,1,[Need the dr.wValue patch]) + else + AC_DEFINE(WCM_PATCH_DRVALUE,0,[Need the dr.wValue patch]) + fi + fi + if test $WCM_OPTION_MODVER = yes; then + WCM_MODVER="-DCONFIG_MODVERSIONS -DMODVERSIONS -include $WCM_KERNEL_DIR/include/linux/modversions.h" + fi + elif echo $WCM_KERNEL_VER | grep "^2.6" >/dev/null 2>&1; then + MINOR=`echo $WCM_KERNEL_VER | cut -f 3 -d.` + if test $MINOR -ge 18; then + WCM_OPTION_HID=no + else + WCM_MODULES="$WCM_MODULES hid.o" + fi + fi + fi + if test "$WCM_ENV_KERNEL" = yes; then + AC_DEFINE(WCM_ENABLE_LINUXINPUT,,[Enable the Linux Input subsystem]) + fi +fi -dnl Check for ncurses -AC_WCM_CHECK_NCURSES +dnl ======================================================= +dnl Check for Xlib +WCM_CLEVEL=-ansi +WCM_ENV_XLIB=no +WCM_XLIB_DIR= +WCM_XSERVER64= +AC_ARG_WITH(xlib, + AS_HELP_STRING([--with-xlib=dir], [uses a specified X11R6 directory]), + [WCM_XLIB_DIR=$withval]) +if test -z "$WCM_XLIB_DIR" -o "$WCM_XLIB_DIR" = "yes"; then + PKG_CHECK_MODULES(Xlib,[x11], + [ + dnl Found it with pkg-config, use that information + WCM_XLIB_DIR="`$PKG_CONFIG --variable=libdir x11`" + WCM_ENV_XLIB=yes + ], + [ + AC_MSG_CHECKING(for X lib directory) + WCM_XLIBDIR_DEFAULT=/usr/X11R6/lib + WCM_XLIBDIR_DEFAULT2=/usr/lib + if test "$WCM_OPTION_XSERVER64" = "yes"; then + WCM_XLIBDIR_DEFAULT=/usr/X11R6/lib64 + test -d /usr/lib64 && WCM_XLIBDIR_DEFAULT2=/usr/lib64 + fi -dnl Check for wacom build -WCM_OPTION_WACOM=no -AC_ARG_ENABLE(wacom, -AC_HELP_STRING([--enable-wacom], [Enable building wacom.o [[default=no]]]), - , enable_wacom=no) -if test "$enable_wacom" != "no"; then - if test "$WCM_ENV_KERNEL" != "yes"; then - echo "***"; echo "*** WARNING:"; - echo "*** Unable to compile wacom.o without kernel build environment" - echo "*** wacom.o will not be built" - echo "***" + if test -f $WCM_XLIBDIR_DEFAULT/libX11.so; then + WCM_ENV_XLIB=yes + WCM_XLIB_DIR=$WCM_XLIBDIR_DEFAULT + AC_MSG_RESULT([found, $WCM_XLIB_DIR]) + elif test -d $WCM_XLIBDIR_DEFAULT2; then + WCM_ENV_XLIB=yes + WCM_XLIB_DIR=$WCM_XLIBDIR_DEFAULT2 + AC_MSG_RESULT([found, $WCM_XLIB_DIR]) + else + WCM_ENV_XLIB=no + AC_MSG_RESULT([not found, tried $WCM_XLIBDIR_DEFAULT and $WCM_XLIBDIR_DEFAULT2]) + fi + ]) +elif test "$WCM_XLIB_DIR" != "no"; then + AC_MSG_CHECKING(for X lib directory) + if test -f $WCM_XLIB_DIR/libX11.so; then + AC_MSG_RESULT([found, $WCM_XLIB_DIR]) + WCM_ENV_XLIB=yes else - WCM_OPTION_WACOM=yes - WCM_MODULES="$WCM_MODULES wacom.o" + AC_MSG_ERROR([Provided Xlib-path is invalid]) + fi +else + WCM_ENV_XLIB=no +fi +if test "$WCM_ENV_XLIB" = yes; then + if test "$WCM_OPTION_XSERVER64" = "yes"; then + CFLAGS="$CFLAGS -D__amd64__" + WCM_XSERVER64="-D_XSERVER64" fi fi -dnl Check for wacdump build -WCM_OPTION_WACDUMP=no -AC_ARG_ENABLE(wacdump, -AC_HELP_STRING([--enable-wacdump], [Enable building wacdump [[default=yes]]]), - , enable_wacdump=yes) -if test "$enable_wacdump" != "no"; then - if test x$WCM_ENV_NCURSES != xyes; then - echo "***"; echo "*** WARNING:"; - echo "*** Unable to compile wacdump without ncurses environment" - echo "*** wacdump will not be built" - echo "***" +dnl ======================================================= +dnl Check for XFree86 source or X.org SDK +test -d "x-include" && WCM_XFREE86_DIR="x-include" +AC_ARG_WITH(x-src, + AS_HELP_STRING([--with-x-src=dir], [Specify X driver build directory]), + WCM_XFREE86_DIR="$withval") +if test -n "$WCM_XFREE86_DIR"; then + XFREE86SUBDIR=programs/Xserver/hw/xfree86 + AC_MSG_CHECKING(for valid XFree86/X.org build environment) + if test -f $WCM_XFREE86_DIR/xc/$XFREE86SUBDIR/xf86Version.h; then + WCM_ENV_XFREE86=yes + WCM_XFREE86_DIR="$WCM_XFREE86_DIR/xc" + AC_MSG_RESULT([ok, $WCM_XFREE86_DIR]) + elif test -f $WCM_XFREE86_DIR/$XFREE86SUBDIR/xf86Version.h; then + WCM_ENV_XFREE86=yes + AC_MSG_RESULT([ok, $WCM_XFREE86_DIR]) else - WCM_OPTION_WACDUMP=yes - WCM_PROGS="$WCM_PROGS wacdump" + WCM_ENV_XFREE86=no + WCM_XFREE86_DIR= + AC_MSG_RESULT(xf86Version.h missing) + AC_MSG_RESULT(Tried $WCM_XFREE86_DIR/$XFREE86SUBDIR and $WCM_XFREE86_DIR/xc/$XFREE86SUBDIR) + fi +fi +if test "$WCM_ENV_XFREE86" = yes; then + AM_CONDITIONAL(WCM_ENV_XFREE86, true) + AC_DEFINE(WCM_XFREE86,1,[Compiling for XFree86]) +else + AM_CONDITIONAL(WCM_ENV_XFREE86, false) +fi +dnl Check for X.org SDK +if test "$WCM_ENV_XFREE86" != yes; then + AC_ARG_WITH(xorg-sdk, + AS_HELP_STRING([--with-xorg-sdk=dir], [Specify Xorg SDK directory]), + WCM_XORGSDK_DIR="$withval") + + if test "$WCM_XORGSDK_DIR" = "yes" -o -z "$WCM_XORGSDK_DIR"; then + PKG_CHECK_MODULES(XSERVER,[xorg-server], + [ + dnl Found it with pkg-config, use that information + WCM_ENV_XORGSDK=yes + WCM_XORGSDK_DIR="`$PKG_CONFIG --variable=sdkdir xorg-server`" + WCM_XORGSDK_VER="`$PKG_CONFIG --modversion xorg-server`" + ], + [ + AC_MSG_CHECKING(for valid Xorg SDK) + WCM_XORGSDK_DEFAULT="$WCM_XLIB_DIR/Server" + test -d "$WCM_XORGSDK_DEFAULT" || WCM_XORGSDK_DEFAULT="/usr" + for a in include include/xorg xc/include; do + if test -f $WCM_XORGSDK_DEFAULT/$a/xf86Version.h; then + WCM_ENV_XORGSDK=yes + WCM_XORGSDK_DIR=$WCM_XORGSDK_DEFAULT/$a + AC_MSG_RESULT([found, $WCM_XORGSDK_DIR]) + break + fi + done + if test -z "$WCM_XORGSDK_DIR"; then + AC_MSG_RESULT("xf86Version.h missing") + AC_MSG_RESULT([Tried $WCM_XORGSDK_DEFAULT/include, $WCM_XORGSDK_DEFAULT/include/xorg, and $WCM_XORGSDK_DEFAULT/xc/include]) + fi + ]) + elif test "$WCM_XORGSDK_DIR" != "no"; then + AC_MSG_CHECKING(for valid Xorg SDK) + if test -f $WCM_XORGSDK_DIR/xf86Version.h; then + AC_MSG_RESULT(ok) + WCM_ENV_XORGSDK=yes + else + AC_MSG_ERROR("provided path for Xorg SDK invalid") + fi + fi + if test -n "$WCM_XORGSDK_DIR"; then + AC_DEFINE(WCM_XORG,1,[Compiling for X.org]) + AC_MSG_CHECKING([for xserver libc-wrapper header-files]) + if test -f "$WCM_XORGSDK_DIR/xf86_libc.h"; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + AC_DEFINE(WCM_NO_LIBCWRAPPER,1,[The xserver have no wraps around libc-functions]) + fi + dnl Try to get rid of a few warnings, X.org 1.4 need c99 + case "$WCM_XORGSDK_VER" in + 1.0*|1.1*|1.2*|1.3*) + ;; + 1.*|2*) + WCM_CLEVEL=-std=c99;; + *) + ;; + esac fi fi +AM_CONDITIONAL(WCM_ENV_XORGSDK, [test "$WCM_ENV_XORGSDK" = yes]) -dnl Check for xidump build -WCM_PATCH_XIDUMP= -WCM_OPTION_XIDUMP=no -AC_ARG_ENABLE(xidump, -AC_HELP_STRING([--enable-xidump], [Enable building xidump [[default=yes]]]), - , enable_xidump=$WCM_XIDUMP_DEFAULT) -if test "$enable_xidump" != "no"; then - if test x$WCM_ENV_XLIB != xyes; then - echo "***"; echo "*** WARNING:"; - echo "*** xidump requires XLib environment; xidump will not be built." - echo "***" - else - if test x$WCM_ENV_NCURSES != xyes; then - echo "***"; echo "*** WARNING:"; - echo "*** xidump will build without ncurses support." - echo "***" - WCM_PATCH_XIDUMP="(no ncurses) $WCM_PATCH_XIDUMP" +# Define X_CFLAGS, X_LIBS, X_EXTRA_LIBS and X_PRELIBS as required if X +# is found, else defines X_DISPLAY_MISSING. We need at least X_CFLAGS. +AC_PATH_XTRA + +dnl ======================================================= +dnl Check for TCL development environment +WCM_ENV_TCL=no +WCM_TCL_DIR= +WCM_TCL_CFLAGS= +dnl get tcl version +AC_PATH_PROG([TCLSH],[tclsh],[no]) +if test "x$TCLSH" != "xno"; then + AC_MSG_CHECKING([for tcl version]) + version=$(echo ["puts [set tcl_version]"] | $TCLSH) + AC_MSG_RESULT([$version]) +fi + +AC_ARG_WITH(tcl, + AS_HELP_STRING([--with-tcl=dir], [uses the specified tcl directory]), + [ WCM_TCL_DIR=$withval ]) +if test "$WCM_TCL_DIR" = yes -o -z "$WCM_TCL_DIR"; then + AC_MSG_CHECKING([for tcl header files]) + for i in /usr/include /usr/include/tcl "/usr/include/tcl$version"; do + if test -f "$i/tcl.h"; then + AC_MSG_RESULT([found, $i]) + WCM_ENV_TCL=yes + WCM_TCL_DIR="$i" + WCM_TCL_CFLAGS="-I$WCM_TCL_DIR" + CFLAGS="$CFLAGS $WCM_TCL_CFLAGS" + break fi - WCM_OPTION_XIDUMP=yes - WCM_XIDUMP_LIBS="-L$WCM_XLIBDIR -lX11 -lXi -lm" - WCM_PROGS="$WCM_PROGS xidump" + done + if test "$WCM_ENV_TCL" != yes; then + AC_MSG_WARN([not found; tried /usr/include, tcl, and tcl$version; ]) + fi +elif test "$WCM_TCL_DIR" != no; then + AC_MSG_CHECKING([for tcl header files]) + for i in include .; do + if test -f "$WCM_TCL_DIR/$i/tcl.h"; then + AC_MSG_RESULT([found, ]) + WCM_ENV_TCL=yes + if test "$WCM_TCL_DIR" != "/usr"; then + WCM_TCL_CFLAGS="-I$WCM_TCL_DIR/$i" + CFLAGS="$CFLAGS $WCM_TCL_CFLAGS" + fi + fi + done + if test "$WCM_ENV_TCL" != yes; then + AC_MSG_RESULT([not found; tried $WCM_TCL_DIR/include/tcl.h and $WCM_TCL_DIR/tcl.h]) + WCM_TCL_DIR= + fi +fi +if test "$WCM_ENV_TCL" != yes; then + echo "***" + echo "*** The tcl development environment can not be found." + echo "*** The header file tcl.h does not appear at the normal" + echo "*** (or provided) include path. Some build features" + echo "*** will be unavailable." + echo "***" +fi + +dnl ======================================================= +dnl Check for TK development environment +WCM_ENV_TK=no +WCM_TK_DIR= +WCM_TK_CFLAGS= +AC_ARG_WITH(tk, + AS_HELP_STRING([--with-tk=dir], [uses a specified tk directory ]), + [ WCM_TK_DIR=$withval ]) +if test "$WCM_TK_DIR" = yes -o -z "$WCM_TK_DIR"; then + AC_MSG_CHECKING([for tk header files]) + for i in $WCM_TCL_DIR /usr/include ; do + if test -f "$i/tk.h"; then + AC_MSG_RESULT([found, $i]) + WCM_ENV_TK=yes + WCM_TK_DIR="$i" + if test "$WCM_TCL_DIR" != "$WCM_TK_DIR" -a "$WCM_TK_DIR" != "/usr"; then + WCM_TK_CFLAGS="-I$WCM_TK_DIR" + CFLAGS="$CFLAGS $WCM_TK_CFLAGS" + fi + break + fi + done + if test "$WCM_ENV_TK" != yes; then + AC_MSG_WARN([not found; tried $WCM_TCL_DIR/tk.h and /usr/include/tk.h]) fi +elif test "$WCM_TK_DIR" != no; then + AC_MSG_CHECKING([for tk header files]) + + for i in "$WCM_TK_DIR/include" "$WCM_TK_DIR"; do + if test -f "$i/tk.h"; then + AC_MSG_RESULT([found, $i]) + WCM_ENV_TK=yes + WCM_TK_DIR="$i" + if test "$WCM_TCL_DIR" != "$WCM_TK_DIR" -a "$WCM_TK_DIR" != "/usr"; then + WCM_TK_CFLAGS="-I$WCM_TK_DIR" + CFLAGS="$CFLAGS $WCM_TK_CFLAGS" + fi + break + fi + done + if test "$WCM_ENV_TK" != yes; then + AC_MSG_WARN([not found; tried $WCM_TK_DIR/tk.h and $WCM_TK_DIR/include/tk.h]) + WCM_TK_DIR= + fi +fi +if test "$WCM_ENV_TK" != yes; then + echo "***" + echo "*** The tk development environment can not be found." + echo "*** The header file tk.h does not appear at the normal" + echo "*** (or provided) include path. Some build features" + echo "*** will be unavailable." + echo "***" fi +dnl ======================================================= +dnl Check for ncurses development environment +WCM_ENV_NCURSES=no +AC_CHECK_HEADER(ncurses.h, [WCM_ENV_NCURSES=yes]) +if test "$WCM_ENV_NCURSES" != yes; then + AC_CHECK_HEADER(ncurses/ncurses.h, [WCM_ENV_NCURSES=yes]) +fi +if test "$WCM_ENV_NCURSES" != yes; then + AC_MSG_WARN([ncurses not available, ncurses UI disabled]) + AC_DEFINE(WCM_ENABLE_NCURSES,0,[ncurses header files available]) + AM_CONDITIONAL(WCM_ENV_NCURSES, false) +else + AC_DEFINE(WCM_ENABLE_NCURSES,1,[ncurses header files available]) + AM_CONDITIONAL(WCM_ENV_NCURSES, true) +fi + +dnl ======================================================= dnl Check for libwacomcfg build +AC_MSG_CHECKING([if libwacomcfg should/can be built]) WCM_OPTION_LIBWACOMCFG=no AC_ARG_ENABLE(libwacomcfg, -AC_HELP_STRING([--enable-libwacomcfg], [Enable building libwacomcfg [[default=yes]]]), + AC_HELP_STRING([--enable-libwacomcfg], [Enable building libwacomcfg [[default=yes]]]), , enable_libwacomcfg=yes) -if test "$enable_libwacomcfg" != "no"; then - if test x$WCM_ENV_XLIB != xyes; then - echo "***"; echo "*** WARNING:"; - echo "*** libwacomcfg requires XLib environment; libwacomcfg will not be built." - echo "***" - else +if test "$enable_libwacomcfg" != no; then + if test "$WCM_ENV_XLIB" = yes; then + AC_MSG_RESULT(yes) WCM_OPTION_LIBWACOMCFG=yes - WCM_LIBWACOMCFG_LIBS="-L$WCM_XLIBDIR -lX11 -lXi" + WCM_LIBWACOMCFG_LIBS="-L$WCM_XLIB_DIR -lX11 -lXi" WCM_LIBS="$WCM_LIBS libwacomcfg.la" - fi -fi - -dnl Check for xsetwacom build -WCM_OPTION_XSETWACOM=no -AC_ARG_ENABLE(xsetwacom, -AC_HELP_STRING([--enable-xsetwacom], [Enable building xsetwacom [[default=yes]]]), - , enable_xsetwacom=yes) -if test "$enable_xsetwacom" != "no"; then - if test x$WCM_OPTION_LIBWACOMCFG != xyes; then - echo "***"; echo "*** WARNING:"; - echo "*** xsetwacom requires libwacomcfg; xsetwacom will not be built." - echo "***" else - WCM_OPTION_XSETWACOM=yes - WCM_XSETWACOM_LIBS="-L$WCM_XLIBDIR -lX11 -lXi" - WCM_PROGS="$WCM_PROGS xsetwacom" + AC_MSG_WARN([XLib environment missing, libwacomcfg not built]) fi +else + AC_MSG_RESULT(no) fi +dnl ======================================================= dnl Check for libwacomxi build -WCM_WACOMXI_BINDIR=$WCM_EXECDIR/bin -WCM_WACOMXI_LIBDIR=$WCM_EXECDIR/lib -AC_SUBST(WCM_WACOMXI_BINDIR) -AC_SUBST(WCM_WACOMXI_LIBDIR) +AC_MSG_CHECKING([if libwacomxi should/can be built]) +WCM_TCLLIBS= +WCM_TCLPKGS= WCM_OPTION_LIBWACOMXI=no AC_ARG_ENABLE(libwacomxi, -AC_HELP_STRING([--enable-libwacomxi], [Enable building libwacomxi [[default=yes]]]), + AC_HELP_STRING([--enable-libwacomxi], [Enable building libwacomxi [[default=yes]]]), , enable_libwacomxi=yes) -if test "$enable_libwacomxi" != "no"; then - if test x$WCM_ENV_XLIB != xyes; then - echo "***"; echo "*** WARNING:"; - echo "*** libwacomxi requires XLib environment; libwacomxi will not be built." - echo "***" - elif test x$WCM_ENV_TCL != xyes; then - echo "***"; echo "*** WARNING:"; - echo "*** libwacomxi requires tcl environment; libwacomxi will not be built." - echo "***" - elif test x$WCM_ENV_TK != xyes; then - echo "***"; echo "*** WARNING:"; - echo "*** libwacomxi requires tk environment; libwacomxi will not be built." - echo "***" +if test "$enable_libwacomxi" != no; then + if test "$WCM_ENV_XLIB" != yes; then + AC_MSG_WARN([XLib environment missing, libwacomxi not built]) + elif test "$WCM_ENV_TCL" != yes; then + AC_MSG_WARN([tcl environment missing, libwacomxi not built]) + elif test "$WCM_ENV_TK" != yes; then + AC_MSG_WARN([tk environment missing, libwacomxi not built]) else + AC_MSG_RESULT(yes) WCM_OPTION_LIBWACOMXI=yes - WCM_WACOMXI_LIBS="-L$WCM_XLIBDIR -lX11 -lXi" - WCM_TCLLIBS="$WCM_TCLLIBS libwacomxi.la" - WCM_TCLPKGS="$WCM_TCLPCKS pkgIndex.tcl" - fi -fi - -AM_CONDITIONAL(WACOMXI_INSTALL, test "$WCM_OPTION_LIBWACOMXI" == "yes") - -dnl Check for hid build -WCM_OPTION_HID=no -AC_ARG_ENABLE(hid, -AC_HELP_STRING([--enable-hid], [Enable building hid.o [[default=no]]]), - , enable_hid=no) -if test "$enable_hid" != "no"; then - kver=`echo $WCM_KERNEL_VER | grep "2.6"` - kver=`echo $kver | cut -f 3 -d.` - if test $kver -ge 18; then - echo "***"; echo "*** WARNING:"; - echo "*** No need to build (usb)hid.ko for kernel 2.6.18 or later" - echo "***" - else - kver=`echo $WCM_KERNEL_VER | grep -c "2.4"` - if test "$WCM_ENV_KERNEL" != "yes"; then - echo "***"; echo "*** WARNING:"; - echo "*** Unable to compile hid.o without kernel build environment" - echo "*** hid.o will not be built" - echo "***" - else - WCM_OPTION_HID=yes - if test $kver != 0; then - if test "$WCM_KERNEL_VER" = "2.4.22"; then - cp $WCM_KERNELDIR/drivers/usb/hid-input.c src/$WCM_KERNEL_VER - cp $WCM_KERNELDIR/drivers/usb/hiddev.c src/$WCM_KERNEL_VER - fi - fi - WCM_MODULES="$WCM_MODULES hid.o" - fi - fi -fi - -dnl Check for usbmouse build -WCM_OPTION_USBMOUSE=no -AC_ARG_ENABLE(usbmouse, -AC_HELP_STRING([--enable-usbmouse], [Enable building usbmouse.o [[default=no]]]), - , enable_usbmouse=no) -if test "$enable_usbmouse" != "no"; then - kver=`echo $WCM_KERNEL_VER | grep -c "2.4"` - if test "$WCM_ENV_KERNEL" != "yes"; then - echo "***"; echo "*** WARNING:"; - echo "*** Unable to compile usbmouse.o without kernel build environment" - echo "*** usbmouse.o will not be built" - echo "***" - elif test $kver != 0 ; then - WCM_OPTION_USBMOUSE=yes - if test "$WCM_KERNEL_VER" = "2.4.22"; then - cp $WCM_KERNELDIR/drivers/usb/usbmouse.c src/$WCM_KERNEL_VER - fi - WCM_MODULES="$WCM_MODULES usbmouse.o" - else - echo "***"; echo "*** WARNING:"; - echo "*** No need to build usbmouse.o for kernel 2.6" - echo "***" - fi -fi - -dnl Check for evdev build -WCM_OPTION_EVDEV=no -AC_ARG_ENABLE(evdev, -AC_HELP_STRING([--enable-evdev], [Enable building evdev.o [[default=no]]]), - , enable_evdev=no) -if test "$enable_evdev" != "no"; then - kver=`echo $WCM_KERNEL_VER | grep -c "2.4"` - if test "$WCM_ENV_KERNEL" != "yes"; then - echo "***"; echo "*** WARNING:"; - echo "*** Unable to compile evdev.o without kernel build environment" - echo "*** evdev.o will not be built" - echo "***" - elif test $kver != 0 ; then - WCM_OPTION_EVDEV=yes - WCM_MODULES="$WCM_MODULES evdev.o" - else - echo "***"; echo "*** WARNING:"; - echo "*** No need to build evdev.o for kernel 2.6" - echo "***" + WCM_WACOMXI_LIBS="-L$WCM_XLIB_DIR -lX11 -lXi" + WCM_TCLLIBS="libwacomxi.la" + WCM_TCLPKGS="pkgIndex.tcl" fi + AM_CONDITIONAL(WACOMXI_INSTALL, true) +else + AC_MSG_RESULT(no) + AM_CONDITIONAL(WACOMXI_INSTALL, false) fi -dnl Check for mousedev build -WCM_OPTION_MOUSEDEV=no -AC_ARG_ENABLE(mousedev, -AC_HELP_STRING([--enable-mousedev], [Enable building mousedev.o [[default=no]]]), - , enable_mousedev=no) -if test "$enable_mousedev" != "no"; then - kver=`echo $WCM_KERNEL_VER | grep -c "2.4"` - if test "$WCM_ENV_KERNEL" != "yes"; then - echo "***"; echo "*** WARNING:"; - echo "*** Unable to compile mousedev.o without kernel build environment" - echo "*** mousedev.o will not be built" - echo "***" - elif test $kver != 0 ; then - WCM_OPTION_MOUSEDEV=yes - WCM_MODULES="$WCM_MODULES mousedev.o" +dnl ======================================================= +dnl Check for wacdump build +AC_MSG_CHECKING([if wacdump should/can be built]) +WCM_OPTION_WACDUMP=no +AC_ARG_ENABLE(wacdump, + AC_HELP_STRING([--enable-wacdump], [Enable building wacdump [[default=yes]]]), + , enable_wacdump=yes) +if test "$enable_wacdump" != "no"; then + if test "$WCM_ENV_NCURSES" = yes; then + AC_MSG_RESULT(yes) + WCM_OPTION_WACDUMP=yes + WCM_PROGS="$WCM_PROGS wacdump" else - echo "***"; echo "*** WARNING:"; - echo "*** No need to build mousedev.o for kernel 2.6" - echo "***" + AC_MSG_WARN([ncurses environment missing, wacdump not built]) fi fi -dnl Check for input build -WCM_OPTION_INPUT=no -AC_ARG_ENABLE(input, -AC_HELP_STRING([--enable-input], [Enable building input.o [[default=no]]]), - , enable_input=no) -if test "$enable_input" != "no"; then - kver=`echo $WCM_KERNEL_VER | grep -c "2.4"` - if test "$WCM_ENV_KERNEL" != "yes"; then - echo "***"; echo "*** WARNING:"; - echo "*** Unable to compile input.o without kernel build environment" - echo "*** input.o will not be built" - echo "***" - elif test $kver != 0 ; then - WCM_OPTION_INPUT=yes - cp $WCM_KERNELDIR/drivers/input/input.c src/$WCM_KERNEL_VER - WCM_MODULES="$WCM_MODULES input.o" +dnl ======================================================= +dnl Check for xidump build +AC_MSG_CHECKING([if xidump should/can be built]) +WCM_PATCH_XIDUMP= +WCM_OPTION_XIDUMP=no +AC_ARG_ENABLE(xidump, + AC_HELP_STRING([--enable-xidump], [Enable building xidump [[default=yes]]]), + , enable_xidump=yes) +if test "$enable_xidump" != "no"; then + if test "$WCM_ENV_XLIB" != yes; then + AC_MSG_WARN([XLib environment missing, xidump not built]) else - echo "***"; echo "*** WARNING:"; - echo "*** No need to build input.o for kernel 2.6" - echo "***" + if test "$WCM_ENV_NCURSES" != yes; then + AC_MSG_RESULT([yes, no ncurses]) + WCM_PATCH_XIDUMP="(no ncurses)" + else + AC_MSG_RESULT(yes) + fi + WCM_OPTION_XIDUMP=yes + WCM_XIDUMP_LIBS="-L$WCM_XLIB_DIR -lX11 -lXi -lm" + WCM_PROGS="$WCM_PROGS xidump" fi +else + AC_MSG_RESULT(no) fi -dnl Check for tabletdev build -WCM_OPTION_TABLETDEV=no -AC_ARG_ENABLE(tabletdev, -AC_HELP_STRING([--enable-tabletdev], [Enable building tabletdev.o [[default=no]]]), - , enable_tabletdev=no) -if test "$enable_tabletdev" != "no"; then - if test "$WCM_ENV_KERNEL" != "yes"; then - echo "***"; echo "*** WARNING:"; - echo "*** Unable to compile tabletdev.o without kernel build environment" - echo "*** tabletdev.o will not be built" - echo "***" +dnl ======================================================= +dnl Check for xsetwacom build +AC_MSG_CHECKING([if xsetwacom should be built]) +WCM_OPTION_XSETWACOM=no +AC_ARG_ENABLE(xsetwacom, + AC_HELP_STRING([--enable-xsetwacom], [Enable building xsetwacom [[default=yes]]]), + , enable_xsetwacom=yes) +if test "$enable_xsetwacom" != "no"; then + if test "$WCM_OPTION_LIBWACOMCFG" != yes; then + AC_MSG_WARN([requires libwacomcfg, xsetwacom not built]) else - WCM_OPTION_TABLETDEV=yes - WCM_MODULES="$WCM_MODULES tabletdev.o" + AC_MSG_RESULT(yes) + WCM_OPTION_XSETWACOM=yes + WCM_XSETWACOM_LIBS="-L$WCM_XLIB_DIR -lX11 -lXi" + WCM_PROGS="$WCM_PROGS xsetwacom" fi fi +dnl ======================================================= dnl Check for xmoduledir -WCM_MODDIR= AC_MSG_CHECKING(for Wacom X driver module path) +WCM_OPTION_DLLOADER=yes +WCM_MODDIR= AC_ARG_WITH(xmoduledir, -AC_HELP_STRING([--with-xmoduledir], [Specify wacom_drv path explicitly. Implies --enable-dlloader]), -[ - WCM_MODDIR="$withval" -]) -if test -n "$WCM_MODDIR"; then - WCM_OPTION_DLLOADER=yes -elif test -d $WCM_XLIBDIR/xorg/modules/input; then - WCM_MODDIR=$WCM_XLIBDIR/xorg/modules/input -elif test -d $WCM_XLIBDIR/modules/input; then - WCM_MODDIR=$WCM_XLIBDIR/modules/input + AC_HELP_STRING([--with-xmoduledir], [Specify wacom_drv path explicitly. Implies --enable-dlloader]), + WCM_MODDIR="$withval") +if test -d $WCM_XLIB_DIR/xorg/modules/input; then + WCM_MODDIR=$WCM_XLIB_DIR/xorg/modules/input +elif test -d $WCM_XLIB_DIR/modules/input; then + WCM_MODDIR=$WCM_XLIB_DIR/modules/input +elif -z "$WCM_MODDIR"; then + WCM_OPTION_DLLOADER=no fi AC_MSG_RESULT($WCM_MODDIR) +dnl ======================================================= dnl Check for dlloader +AC_MSG_CHECKING(for dynamic driver loading support) AC_ARG_ENABLE(dlloader, -AC_HELP_STRING([--enable-dlloader], [Use dlloader [[default=usually]]]), - , enable_dlloader=$WCM_OPTION_DLLOADER) -#defined case -if test "$enable_dlloader" = "yes"; then - WCM_OPTION_DLLOADER=yes -else - WCM_OPTION_DLLOADER=no -fi -#usual case -if test x$enable_dlloader == x"" && test $WCM_OPTION_DLLOADER != "yes"; then - if test -f $WCM_MODDIR/wacom_drv.so; then - WCM_OPTION_DLLOADER=yes + AC_HELP_STRING([--enable-dlloader], [Use dlloader [[default=usually]]]), + WCM_OPTION_DLLOADER=$enableval) +if test "$WCM_OPTION_DLLOADER" = yes; then + if test -f $WCM_MODDIR/evdev_drv.so -o -f $WCM_MODDIR/kbd_drv.so -o -f $WCM_MODDIR/mouse_drv.so; then + WCM_OPTION_DLLOADER=yes else - WCM_OPTION_DLLOADER=no + WCM_OPTION_DLLOADER=no fi fi - -dnl Check for pixman -if test $WCM_OPTION_DLLOADER == "yes"; then - PKG_PROG_PKG_CONFIG - PKG_CHECK_MODULES(XSERVER,[xorg-server]) -fi - +AC_MSG_RESULT($WCM_OPTION_DLLOADER) AM_CONDITIONAL(WCM_DLLOADER, test "$WCM_OPTION_DLLOADER" == "yes") +dnl ======================================================= dnl Check for wacomdrv build -WCM_OPTION_WACOMDRV=no +AC_MSG_CHECKING([if wacom_drv.{o,so} should be compiled]) +WCM_OPTION_WACOMDRV=yes AC_ARG_ENABLE(wacomdrv, -AC_HELP_STRING([--enable-wacomdrv], [Enable building wacom_drv.{o,so} [[default=yes]]]), - , enable_wacomdrv=yes) -if test "$enable_wacomdrv" != "no"; then - if test "$WCM_ENV_XF86" != "yes" && test "$WCM_ENV_XORGSDK" != "yes"; then - echo "***"; echo "*** WARNING:"; - echo "*** Unable to compile wacom_drv.{o,so} " - echo "*** without Xorg SDK or XFree86 build environment" - echo "*** wacom_drv.o will not be built" - echo "***" + AC_HELP_STRING([--enable-wacomdrv], [Enable building wacom_drv.{o,so} [[default=yes]]]), + WCM_OPTION_WACOMDRV=$enableval) +if test "$WCM_OPTION_WACOMDRV" != "no"; then + if test "$WCM_ENV_XFREE86" != "yes" -a "$WCM_ENV_XORGSDK" != "yes"; then + AC_MSG_WARN([requires Xorg SDK or XFree86 build environment, wacom_drv not built]) + WCM_OPTION_WACOMDRV=no else + AC_MSG_RESULT(yes) WCM_OPTION_WACOMDRV=yes if test "$WCM_OPTION_DLLOADER" == "yes" ; then - WCM_XF86MODULES="$WCM_XF86MODULES wacom_drv.so" - WCM_EXPMODULES="$WCM_EXPMODULES wacom_drv.so" + WCM_XF86MODULES="wacom_drv.so" else - WCM_XF86MODULES="$WCM_XF86MODULES wacom_drv.o" - WCM_EXPMODULES="$WCM_EXPMODULES wacom_drv.o" + WCM_XF86MODULES="wacom_drv.o" fi fi -fi - -dnl Check for modver -AC_ARG_ENABLE(modver, -AC_HELP_STRING([--enable-modver], [Enable kernel module versioning [[default=usually]]]), - , enable_modver=$WCM_MODVER) -if test "$enable_modver" = "no"; then - WCM_OPTION_MODVER=no - WCM_MODVER="" -elif test "$enable_modver" = "yes"; then - WCM_OPTION_MODVER=yes - WCM_MODVER="-DCONFIG_MODVERSIONS -DMODVERSIONS -include $WCM_KERNELDIR/include/linux/modversions.h" else - dnl not explicitly set, go with default - if test "$WCM_OPTION_MODVER" = "yes"; then - WCM_MODVER="-DCONFIG_MODVERSIONS -DMODVERSIONS -include $WCM_KERNELDIR/include/linux/modversions.h" - else - WCM_MODVER="" - fi -fi - -dnl Check for changed field names in hid-core.c -if test "$WCM_OPTION_HID" = "yes"; then - AC_MSG_CHECKING(for updated field names in hid-core.c) - HIDCORE="$WCM_KERNELDIR/drivers/usb/hid-core.c" - if test -f "$HIDCORE"; then - PATCH_DRVALUE=`grep 'dr\\.wValue' "$HIDCORE" | wc -l` - if test "$PATCH_DRVALUE" -gt 0; then - AC_MSG_RESULT([yes, using 2.4.20 or later]) - AC_DEFINE(WCM_PATCH_DRVALUE,1,[Need the dr.wValue patch]) - WCM_PATCH_HID="(value_patch) $WCM_PATCH_HID" - else - AC_MSG_RESULT([no, using 2.4.19]) - AC_DEFINE(WCM_PATCH_DRVALUE,0,[Do not need the dr.wValue patch]) - fi - else - HIDCORE="$WCM_KERNELDIR/drivers/usb/input/hid-core.c" - if test -f "$HIDCORE"; then - AC_MSG_RESULT([yes, using $WCM_KERNEL_VER]) - else - AC_MSG_RESULT([missing, using 2.4.19]) - echo "***" - echo "*** Warning: unable to find hid-core.c in kernel tree" - echo "*** It was not possible to detect whether patches needed to be" - echo "*** applied. If the hid-core.c in this project does not build" - echo "*** correctly, you should resolve this problem first." - echo "***" - fi - AC_DEFINE(WCM_PATCH_DRVALUE,0,[Do not need the dr.wValue patch]) - fi - - AC_MSG_CHECKING(for HID_QUIRK) - HID_H="$WCM_KERNELDIR/drivers/usb/hid.h" - if test -f "$HID_H"; then - PATCH_QUIRK=`grep 'HID_QUIRK' "$HID_H" | wc -l` - if test "$PATCH_QUIRK" -gt 0; then - AC_MSG_RESULT(yes) - AC_DEFINE(WCM_PATCH_NOQUIRK,0,[Missing quirks]) - else - AC_MSG_RESULT(no) - AC_DEFINE(WCM_PATCH_NOQUIRK,1,[Missing quirks]) - WCM_PATCH_HID="(quirk_patch) $WCM_PATCH_HID" - fi - else - HID_H="$WCM_KERNELDIR/drivers/usb/input/hid.h" - if test -f "$HID_H"; then - AC_MSG_RESULT([missing, assuming quirks are OK]) - else - echo "***" - echo "*** Warning: unable to find hid.h in kernel tree" - echo "*** It was not possible to detect whether patches needed to be" - echo "*** applied. If the hid-core.c in this project does not build" - echo "*** correctly, you should resolve this problem first." - echo "***" - fi - AC_DEFINE(WCM_PATCH_NOQUIRK,0,[Missing quirks]) - fi + AC_MSG_RESULT(no) fi +dnl ======================================================= dnl Check for depflags WCM_DEPFLAGS= AC_ARG_ENABLE(mkxincludes, -AC_HELP_STRING([--enable-mkxincludes], [Enable mkxincludes, XF86 dependency builder [[default=no]]]), - , enable_mkxincludes=no) -if test "x$enable_mkxincludes" == "xyes"; then - WCM_DEPFLAGS="-MMD" -fi - -dnl Check for -fno-merge-constants if using gcc -if test "x$GCC" = "xyes"; then - AC_MSG_CHECKING(if gcc accepts -fno-merge-constants) - OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-merge-constants" - AC_TRY_COMPILE(, "int main(void) { return 0; }", - has_no_merge_constants=yes, - has_no_merge_constants=no) - CFLAGS=$OLD_CFLAGS - - if test "$has_no_merge_constants" = "yes" ; then - AC_MSG_RESULT(yes) - WCM_NO_MERGE_CONSTANTS="-fno-merge-constants" - else - AC_MSG_RESULT(no) - WCM_NO_MERGE_CONSTANTS="" - fi + AC_HELP_STRING([--enable-mkxincludes], [Enable mkxincludes, XFree86 dependency builder [[default=no]]]), + [ test "$enable_mkxincludes" = yes && WCM_DEPFLAGS="-MMD" ]) + +dnl ======================================================= +dnl Check for compiler flags if using gcc +if test "$GCC" = yes; then + OLD_CFLAGS="$CFLAGS" + AC_MSG_CHECKING(if gcc accepts -fno-merge-constants) + CFLAGS="$OLD_CFLAGS -fno-merge-constants" + AC_TRY_COMPILE(, "int main(void) { return 0; }", + [WCM_NO_MERGE_CONSTANTS="-fno-merge-constants"; AC_MSG_RESULT(yes)], + [WCM_NO_MERGE_CONSTANTS=; AC_MSG_RESULT(no)]) + + AC_MSG_CHECKING(if gcc accepts -fno-stack-protector) + CFLAGS="$OLD_CFLAGS -fno-stack-protector" + AC_TRY_COMPILE(, "int main(void) { return 0; }", + [WCM_NO_STACK_PROTECTOR="-fno-stack-protector"; AC_MSG_RESULT(yes)], + [WCM_NO_STACK_PROTECTOR=; AC_MSG_RESULT(no)]) + CFLAGS=$OLD_CFLAGS fi -dnl Check for x86_64 kernel and ARCH for kernel 2.4 -kver=`echo $WCM_KERNEL_VER | grep -c "2.4"` -if test $kver != 0; then - WCM_ARCH=`echo $WCM_ARCH | cut -f 1 -d-` - if test "$WCM_ARCH" = "x86_64"; then - WCM_OPTION_HID=no - WCM_OPTION_WACOM=no - WCM_OPTION_INPUT=no - WCM_OPTION_USBMOUSE=no - WCM_OPTION_MOUSEDEV=no - WCM_OPTION_EVDEV=no - WCM_MODULES="" - fi -fi +dnl ======================================================= +dnl Set default defines in src/include/xdrv-config.h (moved from cmd-line) +AC_DEFINE(AVOID_GLYPHBLT,,[cmdline substitute]) +AC_DEFINE(_BSD_SOURCE,,[cmdline substitute]) +AC_DEFINE(BUILDDEBUG,,[cmdline substitute]) +AC_DEFINE(DPMSExtension,,[cmdline substitute]) +AC_DEFINE(FUNCPROTO,15,[cmdline substitute]) +AC_DEFINE(GCCUSESGAS,,[cmdline substitute]) +AC_DEFINE(_GNU_SOURCE,,[cmdline substitute]) +AC_DEFINE(IN_MODULE,,[cmdline substitute]) +AC_DEFINE(LBX,,[cmdline substitute]) +AC_DEFINE(linux,,[cmdline substitute]) +AC_DEFINE(NARROWPROTO,,[cmdline substitute]) +AC_DEFINE(NDEBUG,,[cmdline substitute]) +AC_DEFINE(PIXPRIV,,[cmdline substitute]) +AC_DEFINE(_POSIX_C_SOURCE,,[cmdline substitute]) +AC_DEFINE(_POSIX_SOURCE,,[cmdline substitute]) +AC_DEFINE(RENDER,,[cmdline substitute]) +AC_DEFINE(SHAPE,,[cmdline substitute]) +AC_DEFINE(SINGLEDEPTH,,[cmdline substitute]) +AC_DEFINE(SMART_SCHEDULE,,[cmdline substitute]) +AC_DEFINE(_SVID_SOURCE,,[cmdline substitute]) +AC_DEFINE(TOGCUP,,[cmdline substitute]) +AC_DEFINE(XAPPGROUP,,[cmdline substitute]) +AC_DEFINE(X_BYTE_ORDER,X_LITTLE_ENDIAN,[cmdline substitute]) +AC_DEFINE(XCSECURITY,,[cmdline substitute]) +AC_DEFINE(XF86BIGFONT,,[cmdline substitute]) +AC_DEFINE(XF86VIDMODE,,[cmdline substitute]) +AC_DEFINE(XFree86LOADER,,[cmdline substitute]) +AC_DEFINE(XFree86Module,,[cmdline substitute]) +AC_DEFINE(XFree86Server,,[cmdline substitute]) +AC_DEFINE(XFreeXDGA,,[cmdline substitute]) +AC_DEFINE(XINPUT,,[cmdline substitute]) +AC_DEFINE(XKB,,[cmdline substitute]) +AC_DEFINE(_XOPEN_SOURCE,,[cmdline substitute]) +AC_DEFINE(XResExtension,,[cmdline substitute]) +AC_DEFINE(XvExtension,,[cmdline substitute]) +AC_DEFINE(XvMCExtension,,[cmdline substitute]) dnl Separate test output from file-generation output echo @@ -524,27 +817,23 @@ AC_SUBST(WCM_LIBS) AC_SUBST(WCM_TCLLIBS) AC_SUBST(WCM_TCLPKGS) AC_SUBST(WCM_MODULES) -AC_SUBST(WCM_XF86PROGS) AC_SUBST(WCM_XF86MODULES) -AC_SUBST(WCM_EXPPROGS) -AC_SUBST(WCM_EXPMODULES) AC_SUBST(WCM_ARCH) AC_SUBST(WCM_KSTACK) AC_SUBST(WCM_MODVER) -AC_SUBST(WCM_KERNELDIR) +AC_SUBST(WCM_KERNEL_DIR) AC_SUBST(WCM_KERNEL_VER) -AC_SUBST(WCM_LINUXWACOMDIR) -AC_SUBST(WCM_XF86DIR) -AC_SUBST(WCM_XORGSDK) -AC_SUBST(WCM_XLIBDIR) +AC_SUBST(WCM_XFREE86_DIR) +AC_SUBST(WCM_XORGSDK_DIR) AC_SUBST(WCM_MODDIR) AC_SUBST(WCM_XSERVER64) -#AC_SUBST(WCM_OPTION_DLLOADER) AC_SUBST(WCM_NO_MERGE_CONSTANTS) -AC_SUBST(WCM_LINUX_INPUT) +AC_SUBST(WCM_NO_STACK_PROTECTOR) +AC_SUBST(WCM_CLEVEL) AC_SUBST(WCM_XIDUMP_LIBS) AC_SUBST(WCM_LIBWACOMCFG_LIBS) AC_SUBST(WCM_WACOMXI_LIBS) +AC_SUBST(WCM_PREFIX) AC_SUBST(WCM_XSETWACOM_LIBS) AC_SUBST(WCM_DEPFLAGS) AC_SUBST(WCM_OPTION_WACOM) @@ -553,7 +842,7 @@ AC_SUBST(WCM_OPTION_EVDEV) AC_SUBST(WCM_OPTION_MOUSEDEV) AC_SUBST(WCM_OPTION_USBMOUSE) AC_SUBST(WCM_OPTION_INPUT) - + AC_OUTPUT(Makefile mkxincludes src/Makefile @@ -578,21 +867,17 @@ AC_OUTPUT(Makefile echo "" echo "----------------------------------------" echo " BUILD ENVIRONMENT:" -echo " architecture - $WCM_ARCH" +echo " architecture - $WCM_ARCHITECTURE" echo " linux kernel - $WCM_ISLINUX $WCM_KERNEL_VER" echo " module versioning - $WCM_OPTION_MODVER $WCM_MODVER" -echo " kernel source - $WCM_ENV_KERNEL $WCM_KERNELDIR" -if test "$WCM_ENV_XF86" == "yes"; then -echo " X SOURCE - $WCM_ENV_XF86 $WCM_XF86DIR" -else -echo " Xorg SDK - $WCM_ENV_XORGSDK $WCM_XORGSDK" -fi +echo " kernel source - $WCM_ENV_KERNEL $WCM_KERNEL_DIR" +echo " XFree86 source - $WCM_ENV_XFREE86 $WCM_XFREE86_DIR" +echo " Xorg SDK - $WCM_ENV_XORGSDK $WCM_XORGSDK_DIR" echo " XSERVER64 - $WCM_OPTION_XSERVER64" echo " dlloader - $WCM_OPTION_DLLOADER" -echo " XLib - $WCM_ENV_XLIB $WCM_XLIBDIR" -echo " TCL - $WCM_ENV_TCL $WCM_TCLDIR" -echo " TK - $WCM_ENV_TK $WCM_TKDIR" - +echo " XLib - $WCM_ENV_XLIB $WCM_XLIB_DIR" +echo " TCL - $WCM_ENV_TCL $WCM_TCL_DIR" +echo " TK - $WCM_ENV_TK $WCM_TK_DIR" echo " ncurses - $WCM_ENV_NCURSES" echo "" echo " BUILD OPTIONS:" @@ -607,7 +892,6 @@ echo " usbmouse.o - $WCM_OPTION_USBMOUSE" echo " evdev.o - $WCM_OPTION_EVDEV" echo " mousedev.o - $WCM_OPTION_MOUSEDEV" echo " input.o - $WCM_OPTION_INPUT" -echo " tabletdev.o - $WCM_OPTION_TABLETDEV" if test "$WCM_OPTION_DLLOADER" == "yes" ; then echo " wacom_drv.so - $WCM_OPTION_WACOMDRV $WCM_MODDIR $WCM_PATCH_WACOMDRV" echo " wacom_drv.o - no" @@ -618,10 +902,10 @@ fi echo "----------------------------------------" dnl Check for x86_64 kernel -kver=`echo $WCM_KERNEL_VER | grep -c "2.4"` -if test "$WCM_ARCH" = "x86_64" && test $kver != 0; then +if echo $WCM_KERNEL_VER | grep "2.4" >/dev/null && echo "$WCM_ARCHITECTURE" | grep "x86_64" >/dev/null; then echo "" - echo "***"; echo "*** Note:"; + echo "***" + echo "*** Note:" echo "*** For x86-64 kernel, we only support kernel 2.4.30 and kernel 2.6.* " echo "*** To compile Wacom related kernel 2.4.30 modules for x86-64, you need to " echo "*** copy the source files from src/2.4.30x86-64 to your kernel source tree " diff --git a/mkxincludes.in b/mkxincludes.in index e6e9cc8..50ae5dd 100755 --- a/mkxincludes.in +++ b/mkxincludes.in @@ -12,7 +12,7 @@ # of it. # -XF86_DIR=@WCM_XF86DIR@/xc +XF86_DIR=@WCM_XFREE86_DIR@/xc XF86MODS="@WCM_XF86MODULES@" DEPFLAGS=@WCM_DEPFLAGS@ diff --git a/src/2.4.22/Makefile.am b/src/2.4.22/Makefile.am index 4d64bfe..e6d2453 100644 --- a/src/2.4.22/Makefile.am +++ b/src/2.4.22/Makefile.am @@ -2,7 +2,7 @@ noinst_SCRIPTS = @WCM_MODULES@ EXTRA_SCRIPTS = wacom.o hid.o usbmouse.o evdev.o input.o mousedev.o -KERNEL_DIR=@WCM_KERNELDIR@ +KERNEL_DIR=@WCM_KERNEL_DIR@ DEBUG_FLAGS = -D__JEJ_DEBUG MODS = @WCM_MODVER@ ARCHITECTURE=@WCM_ARCH@ @@ -17,7 +17,6 @@ KCFLAGS = -Wall $(DEBUG_FLAGS) -D__KERNEL__ \ $(KSTACK) -march=$(ARCHITECTURE) NO_MERGE_CONSTANTS=@WCM_NO_MERGE_CONSTANTS@ -LINUX_INPUT=@WCM_LINUX_INPUT@ -I$(KERNEL_DIR)/include wacom.o: wacom.c Makefile $(CC) -I$(KERNEL_DIR)/include $(KCFLAGS) \ @@ -59,4 +58,4 @@ input.o: input.c Makefile -DKBUILD_BASENAME=input -c -o input.o input.c clean: - rm -f *.o core *.core
\ No newline at end of file + rm -f *.o core *.core diff --git a/src/2.4/Makefile.am b/src/2.4/Makefile.am index 4d64bfe..e6d2453 100644 --- a/src/2.4/Makefile.am +++ b/src/2.4/Makefile.am @@ -2,7 +2,7 @@ noinst_SCRIPTS = @WCM_MODULES@ EXTRA_SCRIPTS = wacom.o hid.o usbmouse.o evdev.o input.o mousedev.o -KERNEL_DIR=@WCM_KERNELDIR@ +KERNEL_DIR=@WCM_KERNEL_DIR@ DEBUG_FLAGS = -D__JEJ_DEBUG MODS = @WCM_MODVER@ ARCHITECTURE=@WCM_ARCH@ @@ -17,7 +17,6 @@ KCFLAGS = -Wall $(DEBUG_FLAGS) -D__KERNEL__ \ $(KSTACK) -march=$(ARCHITECTURE) NO_MERGE_CONSTANTS=@WCM_NO_MERGE_CONSTANTS@ -LINUX_INPUT=@WCM_LINUX_INPUT@ -I$(KERNEL_DIR)/include wacom.o: wacom.c Makefile $(CC) -I$(KERNEL_DIR)/include $(KCFLAGS) \ @@ -59,4 +58,4 @@ input.o: input.c Makefile -DKBUILD_BASENAME=input -c -o input.o input.c clean: - rm -f *.o core *.core
\ No newline at end of file + rm -f *.o core *.core diff --git a/src/2.4/hid-core.c b/src/2.4/hid-core.c index cf50906..d1b6b63 100644 --- a/src/2.4/hid-core.c +++ b/src/2.4/hid-core.c @@ -27,7 +27,7 @@ * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic */ -#include "../../config.h" +#include "../include/kernel-config.h" /* * WARNING: THIS IS NOT PART OF THE OFFICIAL KERNEL TREE @@ -85,6 +85,14 @@ static char *hid_types[] = {"Device", "Pointer", "Mouse", "Device", "Joystick", "Gamepad", "Keyboard", "Keypad", "Multi-Axis Controller"}; +/* Need these two later, needs to be defined for older kernels */ +#ifndef HID_QUIRK_IGNORE +#define HID_QUIRK_IGNORE 0x04 +#endif +#ifndef HID_QUIRK_NOGET +#define HID_QUIRK_NOGET 0x08 +#endif + /* * Register a new report for a device. */ @@ -1117,14 +1125,6 @@ void hid_init_reports(struct hid_device *hid) #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204 #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 -/* JEJ - added for 2.4.18 compatibility */ -#if WCM_PATCH_NOQUIRK -#define HID_QUIRK_INVERT 0x01 -#define HID_QUIRK_NOTOUCH 0x02 -#define HID_QUIRK_IGNORE 0x04 -#define HID_QUIRK_NOGET 0x08 -#endif - struct hid_blacklist { __u16 idVendor; __u16 idProduct; diff --git a/src/2.6.10/Makefile.in b/src/2.6.10/Makefile.in index 12023ae..2657b92 100644 --- a/src/2.6.10/Makefile.in +++ b/src/2.6.10/Makefile.in @@ -57,7 +57,7 @@ endif # WCM_OPTION_WACOM else # We were called from command line PWD := $(shell pwd) -KDIR := @WCM_KERNELDIR@ +WCM_KERNEL_DIR := @WCM_KERNEL_DIR@ WCM_OPTION_WACOM := @WCM_OPTION_WACOM@ WCM_OPTION_HID := @WCM_OPTION_HID@ @@ -70,15 +70,15 @@ all: # Copy hid-stuff from kernel-dir to local dir ifeq ($(WCM_OPTION_HID),yes) @for i in $(COPY_FROM_KERNEL_TREE); do \ - if test ! -f "$$i" && test -f $(KDIR)/drivers/usb/input/$$i ; then \ - cp $(KDIR)/drivers/usb/input/$$i .; \ + if test ! -f "$$i" && test -f $(WCM_KERNEL_DIR)/drivers/usb/input/$$i ; then \ + cp $(WCM_KERNEL_DIR)/drivers/usb/input/$$i .; \ fi; \ done endif @echo ' Building linuxwacom drivers for 2.6 kernel.' @echo '***Note: Drivers not enabled as modules in your kernel config but requested through configure are NOT built' - $(MAKE) -C $(KDIR) M=$(PWD) + $(MAKE) -C $(WCM_KERNEL_DIR) M=$(PWD) endif # End kbuild check diff --git a/src/2.6.11/Makefile.in b/src/2.6.11/Makefile.in index c5af401..fe4d249 100644 --- a/src/2.6.11/Makefile.in +++ b/src/2.6.11/Makefile.in @@ -58,7 +58,7 @@ endif # WCM_OPTION_WACOM else # We were called from command line PWD := $(shell pwd) -KDIR := @WCM_KERNELDIR@ +WCM_KERNEL_DIR := @WCM_KERNEL_DIR@ WCM_OPTION_WACOM := @WCM_OPTION_WACOM@ WCM_OPTION_HID := @WCM_OPTION_HID@ @@ -71,8 +71,8 @@ all: # Copy hid-stuff from kernel-dir to local dir ifeq ($(WCM_OPTION_HID),yes) @for i in $(COPY_FROM_KERNEL_TREE); do \ - if test ! -f "$$i" && test -f $(KDIR)/drivers/usb/input/$$i ; then \ - cp $(KDIR)/drivers/usb/input/$$i .; \ + if test ! -f "$$i" && test -f $(WCM_KERNEL_DIR)/drivers/usb/input/$$i ; then \ + cp $(WCM_KERNEL_DIR)/drivers/usb/input/$$i .; \ fi; \ done endif @@ -84,7 +84,7 @@ ifeq ($(WCM_OPTION_WACOM),yes) endif @echo ' Building linuxwacom drivers for 2.6 kernel.' @echo '***Note: Drivers not enabled as modules in your kernel config but requested through configure are NOT built' - $(MAKE) -C $(KDIR) M=$(PWD) + $(MAKE) -C $(WCM_KERNEL_DIR) M=$(PWD) endif # End kbuild check diff --git a/src/2.6.13/Makefile.in b/src/2.6.13/Makefile.in index c5af401..fe4d249 100644 --- a/src/2.6.13/Makefile.in +++ b/src/2.6.13/Makefile.in @@ -58,7 +58,7 @@ endif # WCM_OPTION_WACOM else # We were called from command line PWD := $(shell pwd) -KDIR := @WCM_KERNELDIR@ +WCM_KERNEL_DIR := @WCM_KERNEL_DIR@ WCM_OPTION_WACOM := @WCM_OPTION_WACOM@ WCM_OPTION_HID := @WCM_OPTION_HID@ @@ -71,8 +71,8 @@ all: # Copy hid-stuff from kernel-dir to local dir ifeq ($(WCM_OPTION_HID),yes) @for i in $(COPY_FROM_KERNEL_TREE); do \ - if test ! -f "$$i" && test -f $(KDIR)/drivers/usb/input/$$i ; then \ - cp $(KDIR)/drivers/usb/input/$$i .; \ + if test ! -f "$$i" && test -f $(WCM_KERNEL_DIR)/drivers/usb/input/$$i ; then \ + cp $(WCM_KERNEL_DIR)/drivers/usb/input/$$i .; \ fi; \ done endif @@ -84,7 +84,7 @@ ifeq ($(WCM_OPTION_WACOM),yes) endif @echo ' Building linuxwacom drivers for 2.6 kernel.' @echo '***Note: Drivers not enabled as modules in your kernel config but requested through configure are NOT built' - $(MAKE) -C $(KDIR) M=$(PWD) + $(MAKE) -C $(WCM_KERNEL_DIR) M=$(PWD) endif # End kbuild check diff --git a/src/2.6.14/Makefile.in b/src/2.6.14/Makefile.in index 966aa34..432f8e8 100644 --- a/src/2.6.14/Makefile.in +++ b/src/2.6.14/Makefile.in @@ -58,7 +58,7 @@ endif # WCM_OPTION_WACOM else # We were called from command line PWD := $(shell pwd) -KDIR := @WCM_KERNELDIR@ +WCM_KERNEL_DIR := @WCM_KERNEL_DIR@ WCM_OPTION_WACOM := @WCM_OPTION_WACOM@ WCM_OPTION_HID := @WCM_OPTION_HID@ @@ -71,8 +71,8 @@ all: # Copy hid-stuff from kernel-dir to local dir ifeq ($(WCM_OPTION_HID),yes) @for i in $(COPY_FROM_KERNEL_TREE); do \ - if test ! -f "$$i" && test -f $(KDIR)/drivers/usb/input/$$i ; then \ - cp $(KDIR)/drivers/usb/input/$$i .; \ + if test ! -f "$$i" && test -f $(WCM_KERNEL_DIR)/drivers/usb/input/$$i ; then \ + cp $(WCM_KERNEL_DIR)/drivers/usb/input/$$i .; \ fi; \ done endif @@ -86,7 +86,7 @@ ifeq ($(WCM_OPTION_WACOM),yes) endif @echo ' Building linuxwacom drivers for 2.6 kernel.' @echo '***Note: Drivers not enabled as modules in your kernel config but requested through configure are NOT built' - $(MAKE) -C $(KDIR) M=$(PWD) + $(MAKE) -C $(WCM_KERNEL_DIR) M=$(PWD) endif # End kbuild check diff --git a/src/2.6.15/Makefile.in b/src/2.6.15/Makefile.in index 2f98798..c46dc7d 100644 --- a/src/2.6.15/Makefile.in +++ b/src/2.6.15/Makefile.in @@ -58,7 +58,7 @@ endif # WCM_OPTION_WACOM else # We were called from command line PWD := $(shell pwd) -KDIR := @WCM_KERNELDIR@ +WCM_KERNEL_DIR := @WCM_KERNEL_DIR@ WCM_OPTION_WACOM := @WCM_OPTION_WACOM@ WCM_OPTION_HID := @WCM_OPTION_HID@ @@ -71,8 +71,8 @@ all: # Copy hid-stuff from kernel-dir to local dir ifeq ($(WCM_OPTION_HID),yes) @for i in $(COPY_FROM_KERNEL_TREE); do \ - if test ! -f "$$i" && test -f $(KDIR)/drivers/usb/input/$$i ; then \ - cp $(KDIR)/drivers/usb/input/$$i .; \ + if test ! -f "$$i" && test -f $(WCM_KERNEL_DIR)/drivers/usb/input/$$i ; then \ + cp $(WCM_KERNEL_DIR)/drivers/usb/input/$$i .; \ fi; \ done endif @@ -85,7 +85,7 @@ ifeq ($(WCM_OPTION_WACOM),yes) endif @echo ' Building linuxwacom drivers for 2.6 kernel.' @echo '***Note: Drivers not enabled as modules in your kernel config but requested through configure are NOT built' - $(MAKE) -C $(KDIR) M=$(PWD) + $(MAKE) -C $(WCM_KERNEL_DIR) M=$(PWD) endif # End kbuild check diff --git a/src/2.6.16/Makefile.in b/src/2.6.16/Makefile.in index 5eea2a3..8a3da2f 100644 --- a/src/2.6.16/Makefile.in +++ b/src/2.6.16/Makefile.in @@ -58,7 +58,7 @@ endif # WCM_OPTION_WACOM else # We were called from command line PWD := $(shell pwd) -KDIR := @WCM_KERNELDIR@ +WCM_KERNEL_DIR := @WCM_KERNEL_DIR@ WCM_OPTION_WACOM := @WCM_OPTION_WACOM@ WCM_OPTION_HID := @WCM_OPTION_HID@ @@ -71,15 +71,15 @@ all: # Copy hid-stuff from kernel-dir to local dir ifeq ($(WCM_OPTION_HID),yes) @for i in $(COPY_FROM_KERNEL_TREE); do \ - if test ! -f "$$i" && test -f $(KDIR)/drivers/usb/input/$$i ; then \ - cp $(KDIR)/drivers/usb/input/$$i .; \ + if test ! -f "$$i" && test -f $(WCM_KERNEL_DIR)/drivers/usb/input/$$i ; then \ + cp $(WCM_KERNEL_DIR)/drivers/usb/input/$$i .; \ fi; \ done endif @echo ' Building linuxwacom drivers for 2.6 kernel.' @echo '***Note: Drivers not enabled as modules in your kernel config but requested through configure are NOT built' - $(MAKE) -C $(KDIR) M=$(PWD) + $(MAKE) -C $(WCM_KERNEL_DIR) M=$(PWD) endif # End kbuild check diff --git a/src/2.6.18/Makefile.in b/src/2.6.18/Makefile.in index 081bee5..391f026 100755 --- a/src/2.6.18/Makefile.in +++ b/src/2.6.18/Makefile.in @@ -16,7 +16,7 @@ endif # WCM_OPTION_WACOM else # We were called from command line PWD := $(shell pwd) -KDIR := @WCM_KERNELDIR@ +WCM_KERNEL_DIR := @WCM_KERNEL_DIR@ WCM_OPTION_WACOM := @WCM_OPTION_WACOM@ export WCM_OPTION_WACOM @@ -30,7 +30,7 @@ ifeq ($(WCM_OPTION_WACOM),yes) endif @echo ' Building linuxwacom drivers for 2.6 kernel.' @echo '***Note: Drivers not enabled as modules in your kernel config but requested through configure are NOT built' - $(MAKE) -C $(KDIR) M=$(PWD) + $(MAKE) -C $(WCM_KERNEL_DIR) M=$(PWD) endif # End kbuild check @@ -39,14 +39,6 @@ endif # End kbuild check clean: rm -rf *.o *.ko *.mod.* .[a-z]* core *.i -# also remove copied stuff -distclean: clean - @for i in $(COPY_FROM_KERNEL_TREE); do \ - if test -f "$$i"; then \ - rm -f $$i ; \ - fi; \ - done - EMPTY_AUTOMAKE_TARGETS = distdir install install-data install-exec uninstall install-info EMPTY_AUTOMAKE_TARGETS += installdirs check dvi pdf ps info html tags ctags mostlyclean distclean maintainer-clean .PHONY: $(EMPTY_AUTOMAKE_TARGETS) diff --git a/src/2.6.19/Makefile.in b/src/2.6.19/Makefile.in index 0f92ec6..4b034e1 100755 --- a/src/2.6.19/Makefile.in +++ b/src/2.6.19/Makefile.in @@ -16,7 +16,7 @@ endif # WCM_OPTION_WACOM else # We were called from command line PWD := $(shell pwd) -KDIR := @WCM_KERNELDIR@ +WCM_KERNEL_DIR := @WCM_KERNEL_DIR@ WCM_OPTION_WACOM := @WCM_OPTION_WACOM@ export WCM_OPTION_WACOM @@ -28,7 +28,7 @@ ifeq ($(WCM_OPTION_WACOM),yes) endif @echo ' Building linuxwacom drivers for 2.6 kernel.' @echo '***Note: Drivers not enabled as modules in your kernel config but requested through configure are NOT built' - $(MAKE) -C $(KDIR) M=$(PWD) + $(MAKE) -C $(WCM_KERNEL_DIR) M=$(PWD) endif # End kbuild check @@ -37,14 +37,6 @@ endif # End kbuild check clean: rm -rf *.o *.ko *.mod.* .[a-z]* core *.i -# also remove copied stuff -distclean: clean - @for i in $(COPY_FROM_KERNEL_TREE); do \ - if test -f "$$i"; then \ - rm -f $$i ; \ - fi; \ - done - EMPTY_AUTOMAKE_TARGETS = distdir install install-data install-exec uninstall install-info EMPTY_AUTOMAKE_TARGETS += installdirs check dvi pdf ps info html tags ctags mostlyclean distclean maintainer-clean .PHONY: $(EMPTY_AUTOMAKE_TARGETS) diff --git a/src/2.6.22/Makefile.in b/src/2.6.22/Makefile.in index 1e68b69..0278d1a 100755 --- a/src/2.6.22/Makefile.in +++ b/src/2.6.22/Makefile.in @@ -16,7 +16,7 @@ endif # WCM_OPTION_WACOM else # We were called from command line PWD := $(shell pwd) -KDIR := @WCM_KERNELDIR@ +WCM_KERNEL_DIR := @WCM_KERNEL_DIR@ WCM_OPTION_WACOM := @WCM_OPTION_WACOM@ export WCM_OPTION_WACOM @@ -29,7 +29,7 @@ ifeq ($(WCM_OPTION_WACOM),yes) endif @echo ' Building linuxwacom drivers for 2.6 kernel.' @echo '***Note: Drivers not enabled as modules in your kernel config but requested through configure are NOT built' - $(MAKE) -C $(KDIR) M=$(PWD) + $(MAKE) -C $(WCM_KERNEL_DIR) M=$(PWD) endif # End kbuild check @@ -38,14 +38,6 @@ endif # End kbuild check clean: rm -rf *.o *.ko *.mod.* .[a-z]* core *.i -# also remove copied stuff -distclean: clean - @for i in $(COPY_FROM_KERNEL_TREE); do \ - if test -f "$$i"; then \ - rm -f $$i ; \ - fi; \ - done - EMPTY_AUTOMAKE_TARGETS = distdir install install-data install-exec uninstall install-info EMPTY_AUTOMAKE_TARGETS += installdirs check dvi pdf ps info html tags ctags mostlyclean distclean maintainer-clean .PHONY: $(EMPTY_AUTOMAKE_TARGETS) diff --git a/src/2.6.8/Makefile.in b/src/2.6.8/Makefile.in index 12023ae..2657b92 100644 --- a/src/2.6.8/Makefile.in +++ b/src/2.6.8/Makefile.in @@ -57,7 +57,7 @@ endif # WCM_OPTION_WACOM else # We were called from command line PWD := $(shell pwd) -KDIR := @WCM_KERNELDIR@ +WCM_KERNEL_DIR := @WCM_KERNEL_DIR@ WCM_OPTION_WACOM := @WCM_OPTION_WACOM@ WCM_OPTION_HID := @WCM_OPTION_HID@ @@ -70,15 +70,15 @@ all: # Copy hid-stuff from kernel-dir to local dir ifeq ($(WCM_OPTION_HID),yes) @for i in $(COPY_FROM_KERNEL_TREE); do \ - if test ! -f "$$i" && test -f $(KDIR)/drivers/usb/input/$$i ; then \ - cp $(KDIR)/drivers/usb/input/$$i .; \ + if test ! -f "$$i" && test -f $(WCM_KERNEL_DIR)/drivers/usb/input/$$i ; then \ + cp $(WCM_KERNEL_DIR)/drivers/usb/input/$$i .; \ fi; \ done endif @echo ' Building linuxwacom drivers for 2.6 kernel.' @echo '***Note: Drivers not enabled as modules in your kernel config but requested through configure are NOT built' - $(MAKE) -C $(KDIR) M=$(PWD) + $(MAKE) -C $(WCM_KERNEL_DIR) M=$(PWD) endif # End kbuild check diff --git a/src/2.6.9/Makefile.in b/src/2.6.9/Makefile.in index 12023ae..2657b92 100644 --- a/src/2.6.9/Makefile.in +++ b/src/2.6.9/Makefile.in @@ -57,7 +57,7 @@ endif # WCM_OPTION_WACOM else # We were called from command line PWD := $(shell pwd) -KDIR := @WCM_KERNELDIR@ +WCM_KERNEL_DIR := @WCM_KERNEL_DIR@ WCM_OPTION_WACOM := @WCM_OPTION_WACOM@ WCM_OPTION_HID := @WCM_OPTION_HID@ @@ -70,15 +70,15 @@ all: # Copy hid-stuff from kernel-dir to local dir ifeq ($(WCM_OPTION_HID),yes) @for i in $(COPY_FROM_KERNEL_TREE); do \ - if test ! -f "$$i" && test -f $(KDIR)/drivers/usb/input/$$i ; then \ - cp $(KDIR)/drivers/usb/input/$$i .; \ + if test ! -f "$$i" && test -f $(WCM_KERNEL_DIR)/drivers/usb/input/$$i ; then \ + cp $(WCM_KERNEL_DIR)/drivers/usb/input/$$i .; \ fi; \ done endif @echo ' Building linuxwacom drivers for 2.6 kernel.' @echo '***Note: Drivers not enabled as modules in your kernel config but requested through configure are NOT built' - $(MAKE) -C $(KDIR) M=$(PWD) + $(MAKE) -C $(WCM_KERNEL_DIR) M=$(PWD) endif # End kbuild check diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 1f88ba3..60cd5f9 100755 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -1,11 +1,10 @@ -bin_PROGRAMS = @WCM_PROGS@ @WCM_XF86PROGS@ +bin_PROGRAMS = @WCM_PROGS@ lib_LTLIBRARIES = libwacomcfg.la wacomcfgdir = $(includedir)/wacomcfg wacomcfg_HEADERS = wacomcfg.h AM_CFLAGS = -Wall -pedantic -DEPFLAGS = @WCM_DEPFLAGS@ # These identify which programs, libraries, and headers could # potentially be built or installed depending on the results of @@ -17,7 +16,9 @@ wacdump_SOURCES = wacdump.c wacscrn.c wacscrn.h \ wactablet.c wactablet.h \ wacserial.c wacserial.h \ wacusb.c wacusb.h +if WCM_ENV_NCURSES wacdump_LDADD = -lncurses +endif xidump_SOURCES = xidump.c wacscrn.c wacscrn.h xidump_LDFLAGS = @WCM_XIDUMP_LIBS@ diff --git a/src/util/wacdump.c b/src/util/wacdump.c index d04ced1..52bd518 100755 --- a/src/util/wacdump.c +++ b/src/util/wacdump.c @@ -36,6 +36,8 @@ ** ****************************************************************************/ +#include "../include/util-config.h" + #include "wactablet.h" #include "wacscrn.h" @@ -47,10 +49,6 @@ #include <unistd.h> #include <time.h> -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #define WACDUMP_VER "0.7.4" /* from linux/input.h */ diff --git a/src/util/wacomcfg.c b/src/util/wacomcfg.c index d2c5bc5..47938fc 100755 --- a/src/util/wacomcfg.c +++ b/src/util/wacomcfg.c @@ -29,15 +29,12 @@ ** ****************************************************************************/ +#include "../include/util-config.h" #include "wacomcfg.h" #include "../include/Xwacom.h" /* Hopefully it will be included in XFree86 someday, but * in the meantime, we are expecting it in the local * directory. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdio.h> /* debugging only, we've got no business output text */ #include <ctype.h> #include <stdlib.h> diff --git a/src/util/wacscrn.c b/src/util/wacscrn.c index 6944fe8..79dd11b 100755 --- a/src/util/wacscrn.c +++ b/src/util/wacscrn.c @@ -19,9 +19,7 @@ ** ****************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +#include "../include/util-config.h" #include <stdio.h> #include <stdlib.h> diff --git a/src/util/wactablet.c b/src/util/wactablet.c index f4ae85d..4f683b5 100755 --- a/src/util/wactablet.c +++ b/src/util/wactablet.c @@ -20,6 +20,8 @@ ** ****************************************************************************/ +#include "../include/util-config.h" + #include "wactablet.h" #include "wacserial.h" #include "wacusb.h" @@ -33,10 +35,6 @@ #include <assert.h> #include <stdarg.h> -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #ifdef WCM_ENABLE_LINUXINPUT #include <linux/input.h> #endif diff --git a/src/util/wacusb.c b/src/util/wacusb.c index 7bfa6d7..3591115 100755 --- a/src/util/wacusb.c +++ b/src/util/wacusb.c @@ -20,6 +20,8 @@ ** ****************************************************************************/ +#include "../include/util-config.h" + #include "wacusb.h" #include <stdio.h> @@ -31,10 +33,6 @@ #include <sys/ioctl.h> #include <assert.h> -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - /***************************************************************************** ** Begin USB Linux Input Subsystem *****************************************************************************/ diff --git a/src/util/xidump.c b/src/util/xidump.c index 9fccd44..47e6220 100755 --- a/src/util/xidump.c +++ b/src/util/xidump.c @@ -43,9 +43,7 @@ #define XIDUMP_VERSION "0.7.7" -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +#include "../include/util-config.h" /***************************************************************************** ** XInput diff --git a/src/util/xsetwacom.c b/src/util/xsetwacom.c index ef7b600..ced0020 100755 --- a/src/util/xsetwacom.c +++ b/src/util/xsetwacom.c @@ -36,14 +36,12 @@ #define XSETWACOM_VERSION "0.1.4" +#include "../include/util-config.h" + #include "wacomcfg.h" #include "../include/Xwacom.h" /* give us raw access to parameter values */ #include "wcmAction.h" -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <stdio.h> #include <stdlib.h> #include <ctype.h> diff --git a/src/wacomxi/Makefile.am b/src/wacomxi/Makefile.am index 3f728df..8d4c714 100644 --- a/src/wacomxi/Makefile.am +++ b/src/wacomxi/Makefile.am @@ -2,10 +2,10 @@ AM_CFLAGS = -Wall # WacomXI Install if WACOMXI_INSTALL -tcllibdir = @WCM_WACOMXI_LIBDIR@/TkXInput +tcllibdir = $(libdir)/TkXInput tcllib_HEADERS = pkgIndex.tcl tcllib_LTLIBRARIES = libwacomxi.la -cpldir = @WCM_WACOMXI_BINDIR@ +cpldir = $(bindir) cpl_SCRIPTS = wacomcpl wacomcpl-exec endif @@ -14,4 +14,4 @@ EXTRA_DIST = wacomcpl-exec # Source dependencies libwacomxi_la_SOURCES = wacomxi.c wacomxi.h libwacomxi_la_LDFLAGS = -no-undefined -libwacomxi_la_LIBADD = @WCM_WACOMXI_LIBS@ +libwacomxi_la_LIBADD = $(libdir) diff --git a/src/wacomxi/wacomcpl-exec b/src/wacomxi/wacomcpl-exec index 48eef15..179f774 100755 --- a/src/wacomxi/wacomcpl-exec +++ b/src/wacomxi/wacomcpl-exec @@ -938,7 +938,7 @@ proc addMenu { curb } { if { $opt == "" } { set opt $curb } if { ![string compare $type "pad"] } { # values 30 or larger are special functions - if { ($opt > 8 && $opt < 14) } { + if { ($opt > 8 && $opt < 30) } { set opt [ expr ($opt-8) ] } } diff --git a/src/wacomxi/wacomcpl.in b/src/wacomxi/wacomcpl.in index b89b0bc..d137fcf 100755 --- a/src/wacomxi/wacomcpl.in +++ b/src/wacomxi/wacomcpl.in @@ -13,8 +13,8 @@ # (eg. [list [list foo] bar]) and it seems to work as expected. # Trailing space seems to be necessary. # -WACOMXI_BINDIR=@WCM_WACOMXI_BINDIR@ -WACOMXI_LIBDIR=@WCM_WACOMXI_LIBDIR@ +WACOMXI_BINDIR=@WCM_PREFIX@/bin +WACOMXI_LIBDIR=@WCM_PREFIX@/lib export TCLLIBPATH="[list $TCLLIBPATH $WACOMXI_LIBDIR ]" echo "wacomcpl: using TCLLIBPATH=\"$TCLLIBPATH\"" $WACOMXI_BINDIR/wacomcpl-exec diff --git a/src/xdrv/Makefile.am b/src/xdrv/Makefile.am index 8c66e83..a4666bb 100755 --- a/src/xdrv/Makefile.am +++ b/src/xdrv/Makefile.am @@ -3,9 +3,6 @@ noinst_SCRIPTS = @WCM_XF86MODULES@ x86moduledir = @WCM_MODDIR@ x86module_DATA = @WCM_XF86MODULES@ -AM_CFLAGS = -Wall -pedantic -DEPFLAGS = @WCM_DEPFLAGS@ - # These identify which programs, libraries, and headers could # potentially be built or installed depending on the results of # the configuration. @@ -17,40 +14,31 @@ EXTRA_DIST = xf86Wacom.c wcmXCommand.c xf86Wacom.h \ wcmFilter.c wcmFilter.h wcmSerial.h \ ../include/Xwacom.h -KERNEL_DIR =@WCM_KERNELDIR@ -XF86_DIR =@WCM_XF86DIR@ -XORGSDK_DIR =@WCM_XORGSDK@ -DEBUG_FLAGS = -D__JEJ_DEBUG -ARCHITECTURE =@WCM_ARCH@ -XSERVER64 =@WCM_XSERVER64@ - if WCM_ENV_XORGSDK -DRIVER_INCLUDES = -I$(XORGSDK_DIR) $(X_CFLAGS) -DWCM_XORG +DRIVER_INCLUDES = -I$(WCM_XORGSDK_DIR) $(X_CFLAGS) endif -if WCM_ENV_XF86 +if WCM_ENV_XFREE86 DRIVER_INCLUDES = \ - -I$(XF86_DIR)/programs/Xserver/hw/xfree86/common \ - -I$(XF86_DIR)/programs/Xserver/hw/xfree86/loader \ - -I$(XF86_DIR)/programs/Xserver/hw/xfree86/os-support \ - -I$(XF86_DIR)/programs/Xserver/include \ - -I$(XF86_DIR)/programs/Xserver/mi \ - -I$(XF86_DIR)/exports/include/X11 \ - -I$(XF86_DIR)/include/extensions \ - -I$(XF86_DIR) \ - -I$(XF86_DIR)/exports/include -DWCM_XFREE86 + -I$(WCM_XFREE86_DIR)/programs/Xserver/hw/xfree86/common \ + -I$(WCM_XFREE86_DIR)/programs/Xserver/hw/xfree86/loader \ + -I$(WCM_XFREE86_DIR)/programs/Xserver/hw/xfree86/os-support \ + -I$(WCM_XFREE86_DIR)/programs/Xserver/include \ + -I$(WCM_XFREE86_DIR)/programs/Xserver/mi \ + -I$(WCM_XFREE86_DIR)/exports/include/X11 \ + -I$(WCM_XFREE86_DIR)/include/extensions \ + -I$(WCM_XFREE86_DIR) \ + -I$(WCM_XFREE86_DIR)/exports/include endif NO_MERGE_CONSTANTS=@WCM_NO_MERGE_CONSTANTS@ - -LINUX_INPUT=@WCM_LINUX_INPUT@ +NO_STACK_PROTECTOR=@WCM_NO_STACK_PROTECTOR@ +WCM_CLEVEL=@WCM_CLEVEL@ if WCM_DLLOADER DLLOADER=-fPIC endif -CFLAGS += $(WCM_CFLAGS_STACK_PROTECTOR) - XF86OBJS = xf86Wacom.o wcmSerial.o wcmUSB.o wcmISDV4.o \ wcmXCommand.o wcmCommon.o wcmCompat.o wcmConfig.o \ wcmFilter.o @@ -66,21 +54,10 @@ wcmConfig.o: wcmConfig.c wcmFilter.h wcmFilter.o: wcmFilter.c wcmFilter.h $(XF86OBJS): xf86Wacom.h ../include/Xwacom.h Makefile - $(CC) $(CFLAGS) $(DEPFLAGS) $(DLLOADER) -pipe -ansi \ + $(CC) $(CFLAGS) $(WCM_DEPFLAGS) $(DLLOADER) -pipe $(WCM_CLEVEL) \ -pedantic -Wall -Wpointer-arith $(NO_MERGE_CONSTANTS) \ - -I$(srcdir) $(DRIVER_INCLUDES) -Dlinux \ - -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE \ - -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE \ - -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP -DXCSECURITY \ - -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPIXPRIV \ - -DRENDER -DGCCUSESGAS -DAVOID_GLYPHBLT -DSINGLEDEPTH \ - -DXFreeXDGA -DXvExtension -DXFree86LOADER \ - -DXFree86Server -DXF86VIDMODE -DXvMCExtension \ - -DSMART_SCHEDULE -DBUILDDEBUG -DXResExtension \ - -DX_BYTE_ORDER=X_LITTLE_ENDIAN $(XSERVER64) \ - -DNDEBUG -DFUNCPROTO=15 \ - $(XSERVER_CFLAGS) \ - -DNARROWPROTO -DIN_MODULE -DXFree86Module $(LINUX_INPUT) \ + $(NO_STACK_PROTECTOR) -I$(srcdir) $(DRIVER_INCLUDES) \ + $(WCM_XSERVER64) $(XSERVER_CFLAGS) \ -o $@ -c $(srcdir)/$(subst .o,.c,$@) if WCM_DLLOADER diff --git a/src/xdrv/wcmCommon.c b/src/xdrv/wcmCommon.c index 05a41bf..faf4710 100755 --- a/src/xdrv/wcmCommon.c +++ b/src/xdrv/wcmCommon.c @@ -1,6 +1,6 @@ /* * Copyright 1995-2002 by Frederic Lepied, France. <Lepied@XFree86.org> - * Copyright 2002-2007 by Ping Cheng, Wacom Technology. <pingc@wacom.com> + * Copyright 2002-2008 by Ping Cheng, Wacom Technology. <pingc@wacom.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,7 +34,7 @@ WacomDeviceClass* wcmDeviceClasses[] = { -#ifdef LINUX_INPUT +#ifdef WCM_ENABLE_LINUXINPUT &gWacomUSBDevice, #endif &gWacomISDV4Device, @@ -54,6 +54,64 @@ static void sendAButton(LocalDevicePtr local, int button, int mask, int rx, int ry, int rz, int v3, int v4, int v5); /***************************************************************************** + * xf86WcmMappingFactor -- + * calculate the proper tablet to screen mapping factor according to the + * screen/desktop size and the tablet size + ****************************************************************************/ + +void xf86WcmMappingFactor(LocalDevicePtr local) +{ + WacomDevicePtr priv = (WacomDevicePtr) local->private; + int i = 0, minX = 0, minY = 0, maxX = 0, maxY = 0; + + DBG(10, priv->debugLevel, ErrorF("xf86WcmMappingFactor \n")); + + priv->sizeX = priv->bottomX - priv->topX - 2*priv->tvoffsetX; + priv->sizeY = priv->bottomY - priv->topY - 2*priv->tvoffsetY; + priv->maxWidth = 0, priv->maxHeight = 0; + + if ( ((priv->twinview != TV_NONE) || /* TwinView & whole desktop */ + /* stay in one screen at a time (multimonitor) */ + !priv->common->wcmMMonitor || + /* always stay in the configured screen */ + (screenInfo.numScreens > 1 && priv->screen_no != -1)) + && (priv->flags & ABSOLUTE_FLAG) ) + { + priv->maxWidth = priv->screenBottomX[priv->currentScreen] - + priv->screenTopX[priv->currentScreen]; + priv->maxHeight = priv->screenBottomY[priv->currentScreen] - + priv->screenTopY[priv->currentScreen]; + } + else + { + /* count the whole desktop when no specific screen is defined or + * tool is in relative mode + */ + for (i = 0; i < priv->numScreen; i++) + { + if (priv->screenTopX[i] < minX) + minX = priv->screenTopX[i]; + if (priv->screenTopY[i] < minY) + minY = priv->screenTopY[i]; + if (priv->screenBottomX[i] > maxX) + maxX = priv->screenBottomX[i]; + if (priv->screenBottomY[i] > maxY) + maxY = priv->screenBottomY[i]; + } + priv->maxWidth = maxX - minX; + priv->maxHeight = maxY - minY; + } + DBG(10, priv->debugLevel, ErrorF("xf86WcmMappingFactor" + " Active tablet area x=%d y=%d map to maxWidth =%d maxHeight =%d\n", + priv->sizeX, priv->sizeY, priv->maxWidth, priv->maxHeight)); + + priv->factorX = (double)priv->maxWidth / (double)priv->sizeX; + priv->factorY = (double)priv->maxHeight / (double)priv->sizeY; + DBG(2, priv->debugLevel, ErrorF("X factor = %.3g, Y factor = %.3g\n", + priv->factorX, priv->factorY)); +} + +/***************************************************************************** * xf86WcmSetScreen -- * set to the proper screen according to the converted (x,y). * this only supports for horizontal setup now. @@ -64,118 +122,101 @@ static void sendAButton(LocalDevicePtr local, int button, int mask, static void xf86WcmSetScreen(LocalDevicePtr local, int *value0, int *value1) { WacomDevicePtr priv = (WacomDevicePtr) local->private; - int screenToSet = 0; - int totalWidth = 0, maxHeight = 0, leftPadding = 0; - int i, x, y, v0 = *value0, v1 = *value1; - double sizeX = priv->bottomX - priv->topX - 2*priv->tvoffsetX; - double sizeY = priv->bottomY - priv->topY - 2*priv->tvoffsetY; + int screenToSet = -1, letfPadding = 0, topPadding = 0; + int i, j, x, y, v0 = *value0, v1 = *value1; DBG(6, priv->debugLevel, ErrorF("xf86WcmSetScreen " - "v0=%d v1=%d\n", *value0, *value1)); + "v0=%d v1=%d currentScreen=%d\n", *value0, + *value1, priv->currentScreen)); if (!(local->flags & (XI86_ALWAYS_CORE | XI86_CORE_POINTER))) return; - if (!(priv->flags & ABSOLUTE_FLAG)) + if (priv->screen_no != -1) + priv->currentScreen = priv->screen_no; + else if (priv->currentScreen == -1) { + /* Get the current screen that the cursor is in */ #if defined WCM_XFREE86 || GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0 - priv->currentScreen = miPointerCurrentScreen()->myNum; + if (miPointerCurrentScreen()) + priv->currentScreen = miPointerCurrentScreen()->myNum; #else - priv->currentScreen = miPointerGetScreen(local->dev)->myNum; + if (miPointerGetScreen(local->dev)) + priv->currentScreen = miPointerGetScreen(local->dev)->myNum; #endif - for (i = 0; i < priv->numScreen; i++) - totalWidth += screenInfo.screens[i]->width; - - maxHeight = screenInfo.screens[priv->currentScreen]->height; - priv->factorX = totalWidth / sizeX; - priv->factorY = maxHeight / sizeY; - DBG(10, priv->debugLevel, ErrorF( - "xf86WcmSetScreen current=%d ToSet=%d\n", - priv->currentScreen, screenToSet)); - return; - } - - if (priv->twinview == TV_NONE) - { - v0 = v0 > priv->bottomX ? priv->bottomX - priv->topX : - v0 < priv->topX ? 0 : v0 - priv->topX; - v1 = v1 > priv->bottomY ? priv->bottomY - priv->topY : - v1 < priv->topY ? 0 : v1 - priv->topY; - } + + } else if (priv->currentScreen == -1) /* tool on the tablet */ + priv->currentScreen = 0; - /* set factorX and factorY for single screen setup since - * Top X Y and Bottom X Y can be changed while driver is running - */ - if (screenInfo.numScreens == 1 || !priv->common->wcmMMonitor) + if (priv->twinview != TV_NONE && priv->screen_no == -1 && (priv->flags & ABSOLUTE_FLAG)) { - if (priv->twinview != TV_NONE) + if (priv->twinview == TV_LEFT_RIGHT) { - if (priv->screen_no == -1) - { - if (priv->twinview == TV_LEFT_RIGHT) - { - if (v0 > priv->bottomX - priv->tvoffsetX && v0 <= priv->bottomX) - priv->currentScreen = 1; - if (v0 > priv->topX && v0 <= priv->topX + priv->tvoffsetX) - priv->currentScreen = 0; - } - if (priv->twinview == TV_ABOVE_BELOW) - { - if (v1 > priv->bottomY - priv->tvoffsetY && v1 <= priv->bottomY) - priv->currentScreen = 1; - if (v1 > priv->topY && v1 <= priv->topY + priv->tvoffsetY) - priv->currentScreen = 0; - } - } - else - priv->currentScreen = priv->screen_no; - priv->factorX = priv->tvResolution[2*priv->currentScreen] / sizeX; - priv->factorY = priv->tvResolution[2*priv->currentScreen+1] / sizeY; + if (v0 > priv->bottomX - priv->tvoffsetX && v0 <= priv->bottomX) + priv->currentScreen = 1; + if (v0 > priv->topX && v0 <= priv->topX + priv->tvoffsetX) + priv->currentScreen = 0; } - else + if (priv->twinview == TV_ABOVE_BELOW) { - /* tool on the tablet when driver starts */ -#if defined WCM_XFREE86 || GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0 - if (miPointerCurrentScreen()) - priv->currentScreen = miPointerCurrentScreen()->myNum; -#else - if (miPointerGetScreen(local->dev)) - priv->currentScreen = miPointerGetScreen(local->dev)->myNum; -#endif - priv->factorX = screenInfo.screens[priv->currentScreen]->width / sizeX; - priv->factorY = screenInfo.screens[priv->currentScreen]->height / sizeY; + if (v1 > priv->bottomY - priv->tvoffsetY && v1 <= priv->bottomY) + priv->currentScreen = 1; + if (v1 > priv->topY && v1 <= priv->topY + priv->tvoffsetY) + priv->currentScreen = 0; } - return; } + xf86WcmMappingFactor(local); + if (!(priv->flags & ABSOLUTE_FLAG) || screenInfo.numScreens == 1 || !priv->common->wcmMMonitor) + return; + + v0 = v0 > priv->bottomX ? priv->bottomX - priv->topX : + v0 < priv->topX ? 0 : v0 - priv->topX; + v1 = v1 > priv->bottomY ? priv->bottomY - priv->topY : + v1 < priv->topY ? 0 : v1 - priv->topY; + if (priv->screen_no == -1) { for (i = 0; i < priv->numScreen; i++) { - totalWidth += screenInfo.screens[i]->width; - if (maxHeight < screenInfo.screens[i]->height) - maxHeight = screenInfo.screens[i]->height; - } - for (i = 0; i < priv->numScreen; i++) - { - if (v0 * totalWidth <= (leftPadding + - screenInfo.screens[i]->width) * sizeX) + if (v0 * priv->factorX >= priv->screenTopX[i] && + v0 * priv->factorX < priv->screenBottomX[i] - 0.5) { - screenToSet = i; - break; + + for (j = 0; j < priv->numScreen; j++) + { + if (v1 * priv->factorY >= priv->screenTopY[j] && + v1 * priv->factorY <= priv->screenBottomY[j] - 0.5) + { + if (j == i) + { + screenToSet = i; + break; + } + } + } + + if (screenToSet != -1) + break; } - leftPadding += screenInfo.screens[i]->width; + } + if (screenToSet != -1) + { + letfPadding = priv->screenTopX[screenToSet]; + topPadding = priv->screenBottomX[screenToSet]; + } + else + { + DBG(3, priv->debugLevel, ErrorF("xf86WcmSetScreen Error: " + "Can not find valid screen (currentScreen=%d)\n", + priv->currentScreen)); + return; } } - else - { + else screenToSet = priv->screen_no; - totalWidth = screenInfo.screens[screenToSet]->width; - maxHeight = screenInfo.screens[screenToSet]->height; - } - priv->factorX = totalWidth/sizeX; - priv->factorY = maxHeight/sizeY; - x = (v0 - sizeX * leftPadding / totalWidth) * priv->factorX + 0.5; - y = v1 * priv->factorY + 0.5; + + x = (double)v0 * priv->factorX - letfPadding + 0.5; + y = (double)v1 * priv->factorY - topPadding + 0.5; if (x >= screenInfo.screens[screenToSet]->width) x = screenInfo.screens[screenToSet]->width - 1; @@ -184,8 +225,8 @@ static void xf86WcmSetScreen(LocalDevicePtr local, int *value0, int *value1) xf86XInputSetScreen(local, screenToSet, x, y); DBG(10, priv->debugLevel, ErrorF("xf86WcmSetScreen" - " current=%d ToSet=%d\n", - priv->currentScreen, screenToSet)); + " current=%d ToSet=%d\n", + priv->currentScreen, screenToSet)); priv->currentScreen = screenToSet; } @@ -897,16 +938,6 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds) } } -#if defined WCM_XORG && GET_ABI_MAJOR(ABI_XINPUT_VERSION) > 0 - /* Ugly hack for Xorg 7.3, which doesn't call xf86WcmDevConvert - * for coordinate conversion at the moment */ - /* The +-0.4 is to increase the sensitivity in relative mode. - * Must be sensitive to which way the tool is moved or one way - * will get a severe penalty for small movements. */ - x = (int)((double)(x - priv->topX) * priv->factorX + (x>=0?0.4:-0.4)); - y = (int)((double)(y - priv->topY) * priv->factorY + (y>=0?0.4:-0.4)); -#endif - if (type != PAD_ID) { /* coordinates are ready we can send events */ @@ -925,6 +956,22 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds) if (!is_absolute) x *= priv->factorY / priv->factorX; +#if defined WCM_XORG && GET_ABI_MAJOR(ABI_XINPUT_VERSION) > 0 + /* Ugly hack for Xorg 7.3, which doesn't call xf86WcmDevConvert + * for coordinate conversion at the moment */ + /* The +-0.4 is to increase the sensitivity in relative mode. + * Must be sensitive to which way the tool is moved or one way + * will get a severe penalty for small movements. */ + x = (int)((double)(x - priv->topX) * priv->factorX + (x>=0?0.4:-0.4)); + y = (int)((double)(y - priv->topY) * priv->factorY + (y>=0?0.4:-0.4)); + + /* map to a specific screen */ + if (priv->screen_no != -1 || priv->twinview != TV_NONE) + { + x += priv->screenTopX[priv->currentScreen]; + y += priv->screenTopY[priv->currentScreen]; + } +#endif sendCommonEvents(local, ds, x, y, z, v3, v4, v5); if(!(priv->flags & BUTTONS_ONLY_FLAG)) @@ -1143,7 +1190,7 @@ void xf86WcmEvent(WacomCommonPtr common, unsigned int channel, ds.discard_first, ds.proximity, ds.sample, pChannel->nSamples)); -#ifdef LINUX_INPUT +#ifdef WCM_ENABLE_LINUXINPUT /* Discard the first 2 USB packages due to events delay */ if ( (pChannel->nSamples < 2) && (common->wcmDevCls == &gWacomUSBDevice) && ds.device_type != PAD_ID ) { diff --git a/src/xdrv/wcmConfig.c b/src/xdrv/wcmConfig.c index a40884b..7dcaef0 100755 --- a/src/xdrv/wcmConfig.c +++ b/src/xdrv/wcmConfig.c @@ -107,6 +107,8 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag) priv->topY = 0; /* Y top */ priv->bottomX = 0; /* X bottom */ priv->bottomY = 0; /* Y bottom */ + priv->sizeX = 0; /* active X size */ + priv->sizeY = 0; /* active Y size */ priv->factorX = 0.0; /* X factor */ priv->factorY = 0.0; /* Y factor */ priv->common = common; /* common info pointer */ @@ -146,21 +148,23 @@ LocalDevicePtr xf86WcmAllocate(char* name, int flag) for (j=0; j<256; j++) priv->keys[i][j] = 0; - priv->nbuttons = MAX_BUTTONS; /* Default number of buttons */ - priv->relup = 5; /* Default relative wheel up event */ - priv->reldn = 4; /* Default relative wheel down event */ + priv->nbuttons = MAX_BUTTONS; /* Default number of buttons */ + priv->relup = 5; /* Default relative wheel up event */ + priv->reldn = 4; /* Default relative wheel down event */ priv->wheelup = IsPad (priv) ? 5 : 0; /* Default absolute wheel up event */ priv->wheeldn = IsPad (priv) ? 4 : 0; /* Default absolute wheel down event */ - priv->striplup = 4; /* Default left strip up event */ - priv->stripldn = 5; /* Default left strip down event */ - priv->striprup = 4; /* Default right strip up event */ - priv->striprdn = 5; /* Default right strip down event */ - priv->naxes = 6; /* Default number of axes */ - priv->debugLevel = 0; /* debug level */ + priv->striplup = 4; /* Default left strip up event */ + priv->stripldn = 5; /* Default left strip down event */ + priv->striprup = 4; /* Default right strip up event */ + priv->striprdn = 5; /* Default right strip down event */ + priv->naxes = 6; /* Default number of axes */ + priv->debugLevel = 0; /* debug level */ priv->numScreen = screenInfo.numScreens; /* configured screens count */ - priv->currentScreen = 0; /* current screen in display */ + priv->currentScreen = -1; /* current screen in display */ + priv->maxWidth = 0; /* max active screen width */ + priv->maxHeight = 0; /* max active screen height */ priv->twinview = TV_NONE; /* not using twinview gfx */ priv->tvoffsetX = 0; /* none X edge offset for TwinView setup */ priv->tvoffsetY = 0; /* none Y edge offset for TwinView setup */ @@ -574,7 +578,7 @@ static LocalDevicePtr xf86WcmInit(InputDriverPtr drv, IDevPtr dev, int flags) common->wcmFlags |= RAW_FILTERING_FLAG; } -#ifdef LINUX_INPUT +#ifdef WCM_ENABLE_LINUXINPUT if (xf86SetBoolOption(local->options, "USB", (common->wcmDevCls == &gWacomUSBDevice))) { diff --git a/src/xdrv/wcmUSB.c b/src/xdrv/wcmUSB.c index 1fad776..c8a8aaa 100755 --- a/src/xdrv/wcmUSB.c +++ b/src/xdrv/wcmUSB.c @@ -20,7 +20,7 @@ #include "xf86Wacom.h" #include "wcmFilter.h" -#ifdef LINUX_INPUT +#ifdef WCM_ENABLE_LINUXINPUT #include <sys/utsname.h> @@ -969,4 +969,4 @@ static void usbParseChannel(LocalDevicePtr local, int channel, int serial) xf86WcmEvent(common, channel, ds); } -#endif /* LINUX_INPUT */ +#endif /* WCM_ENABLE_LINUXINPUT */ diff --git a/src/xdrv/wcmXCommand.c b/src/xdrv/wcmXCommand.c index effd6e1..9a84742 100644 --- a/src/xdrv/wcmXCommand.c +++ b/src/xdrv/wcmXCommand.c @@ -29,7 +29,7 @@ #include "wcmFilter.h" extern void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes); -extern void xf86WcmInitialTVScreens(LocalDevicePtr local); +extern void xf86WcmInitialScreens(LocalDevicePtr local); /***************************************************************************** * xf86WcmSetPadCoreMode @@ -89,6 +89,7 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) /* Area definition is ok */ xf86ReplaceIntOption(local->options, "TopX", value); priv->topX = xf86SetIntOption(local->options, "TopX", 0); + xf86WcmMappingFactor(local); xf86WcmInitialCoordinates(local, 0); } break; @@ -107,6 +108,7 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) /* Area definition is ok */ xf86ReplaceIntOption(local->options, "TopY", value); priv->topY = xf86SetIntOption(local->options, "TopY", 0); + xf86WcmMappingFactor(local); xf86WcmInitialCoordinates(local, 1); } break; @@ -125,6 +127,7 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) /* Area definition is ok */ xf86ReplaceIntOption(local->options, "BottomX", value); priv->bottomX = xf86SetIntOption(local->options, "BottomX", 0); + xf86WcmMappingFactor(local); xf86WcmInitialCoordinates(local, 0); } break; @@ -143,6 +146,7 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) /* Area definition is ok */ xf86ReplaceIntOption(local->options, "BottomY", value); priv->bottomY = xf86SetIntOption(local->options, "BottomY", 0); + xf86WcmMappingFactor(local); xf86WcmInitialCoordinates(local, 1); } break; @@ -211,23 +215,22 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) { int is_absolute = priv->flags & ABSOLUTE_FLAG; if ((value < 0) || (value > 1)) return BadValue; - if (value == is_absolute) - break; - - if (IsPad(priv)) - return xf86WcmSetPadCoreMode(local); + if (value != is_absolute) + { + if (IsPad(priv)) + return xf86WcmSetPadCoreMode(local); - if (value) - { - priv->flags |= ABSOLUTE_FLAG; - xf86ReplaceStrOption(local->options, "Mode", "Absolute"); - xf86WcmInitialCoordinates(local, 0); - xf86WcmInitialCoordinates(local, 1); - } - else - { - priv->flags &= ~ABSOLUTE_FLAG; - xf86ReplaceStrOption(local->options, "Mode", "Relative"); + if (value) + { + priv->flags |= ABSOLUTE_FLAG; + xf86ReplaceStrOption(local->options, "Mode", "Absolute"); + } + else + { + priv->flags &= ~ABSOLUTE_FLAG; + xf86ReplaceStrOption(local->options, "Mode", "Relative"); + } + xf86WcmMappingFactor(local); xf86WcmInitialCoordinates(local, 0); xf86WcmInitialCoordinates(local, 1); } @@ -259,27 +262,29 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) xf86WcmSetParam (local, XWACOM_PARAM_BOTTOMY, common->wcmMaxY); break; case XWACOM_PARAM_MMT: - if ((value != 0) && (value != 1)) return BadValue; - common->wcmMMonitor = value; - if (value) - { - xf86ReplaceStrOption(local->options, "MMonitor", "on"); - } - else + if ((value != 0) && (value != 1)) + return BadValue; + else if (common->wcmMMonitor != value) { - xf86ReplaceStrOption(local->options, "MMonitor", "off"); + common->wcmMMonitor = value; + if (value) + xf86ReplaceStrOption(local->options, "MMonitor", "on"); + else + xf86ReplaceStrOption(local->options, "MMonitor", "off"); + + xf86WcmMappingFactor(local); } break; case XWACOM_PARAM_TPCBUTTON: - if ((value != 0) && (value != 1)) return BadValue; - priv->common->wcmTPCButton = value; - if (value) - { - xf86ReplaceStrOption(local->options, "TPCButton", "on"); - } - else + if ((value != 0) && (value != 1)) + return BadValue; + else if (common->wcmMMonitor != value) { - xf86ReplaceStrOption(local->options, "TPCButton", "off"); + common->wcmTPCButton = value; + if (value) + xf86ReplaceStrOption(local->options, "TPCButton", "on"); + else + xf86ReplaceStrOption(local->options, "TPCButton", "off"); } break; case XWACOM_PARAM_CURSORPROX: @@ -287,24 +292,22 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) { if ((value > 255) || (value < 0)) return BadValue; - xf86ReplaceIntOption(local->options, "CursorProx",value); - common->wcmCursorProxoutDist = value; + else if (common->wcmCursorProxoutDist != value) + { + xf86ReplaceIntOption(local->options, "CursorProx",value); + common->wcmCursorProxoutDist = value; + } } break; case XWACOM_PARAM_SCREEN_NO: - if ( (priv->twinview == TV_NONE && - screenInfo.numScreens == 1) - || value < -1 || - (priv->twinview == TV_NONE && - value >= screenInfo.numScreens) - || (priv->twinview != TV_NONE - && value > 1) ) + if (value < -1 || value >= priv->numScreen) return BadValue; else if (priv->screen_no != value) { priv->screen_no = value; if (priv->twinview != TV_NONE) { + xf86WcmInitialScreens(local); if (priv->screen_no == -1) { if (priv->twinview == TV_LEFT_RIGHT) @@ -318,6 +321,12 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) priv->tvoffsetY = 0; } } + if (priv->screen_no != -1) + priv->currentScreen = priv->screen_no; + xf86WcmInitialScreens(local); + xf86WcmMappingFactor(local); + xf86WcmInitialCoordinates(local, 0); + xf86WcmInitialCoordinates(local, 1); xf86ReplaceIntOption(local->options, "ScreenNo", value); } break; @@ -327,6 +336,10 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) if ((value > 2) || (value < 0) || screenInfo.numScreens != 1) return BadValue; priv->twinview = value; + xf86WcmInitialScreens(local); + xf86WcmMappingFactor(local); + xf86WcmInitialCoordinates(local, 0); + xf86WcmInitialCoordinates(local, 1); switch(value) { case TV_NONE: xf86ReplaceStrOption(local->options, "TwinView", "None"); @@ -340,7 +353,6 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) default: return BadValue; } - xf86WcmInitialTVScreens(local); } break; case XWACOM_PARAM_TVRESOLUTION0: @@ -356,6 +368,7 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) { rX = priv->tvResolution[0]; rY = priv->tvResolution[1]; + sNum++; } else { @@ -377,6 +390,8 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) return BadValue; priv->tvResolution[sNum++] = value & 0xffff; priv->tvResolution[sNum] = (value >> 16) & 0xffff; + xf86WcmInitialScreens(local); + xf86WcmMappingFactor(local); DBG(10, priv->debugLevel, ErrorF("xf86WcmSetParam " "to ResX=%d ResY=%d \n", value & 0xffff, (value >> 16) & 0xffff)); @@ -487,6 +502,7 @@ static int xf86WcmSetParam(LocalDevicePtr local, int param, int value) break; } + xf86WcmMappingFactor(tmppriv->local); xf86WcmInitialCoordinates(tmppriv->local, 0); xf86WcmInitialCoordinates(tmppriv->local, 1); @@ -717,10 +733,7 @@ static int xf86WcmGetParam(LocalDevicePtr local, int param) case XWACOM_PARAM_STOPX7: { int sn = (param - XWACOM_PARAM_STOPX0) / 4; - int numS = screenInfo.numScreens; - if (priv->twinview != TV_NONE) - numS = 2; - if (sn >= numS) + if (sn >= priv->numScreen) return -1; else return priv->screenTopX[sn]; @@ -735,10 +748,7 @@ static int xf86WcmGetParam(LocalDevicePtr local, int param) case XWACOM_PARAM_STOPY7: { int sn = (param - XWACOM_PARAM_STOPY0) / 4; - int numS = screenInfo.numScreens; - if (priv->twinview != TV_NONE) - numS = 2; - if (sn >= numS) + if (sn >= priv->numScreen) return -1; else return priv->screenTopY[sn]; @@ -753,10 +763,7 @@ static int xf86WcmGetParam(LocalDevicePtr local, int param) case XWACOM_PARAM_SBOTTOMX7: { int sn = (param - XWACOM_PARAM_SBOTTOMX0) / 4; - int numS = screenInfo.numScreens; - if (priv->twinview != TV_NONE) - numS = 2; - if (sn >= numS) + if (sn >= priv->numScreen) return -1; else return priv->screenBottomX[sn]; @@ -771,10 +778,7 @@ static int xf86WcmGetParam(LocalDevicePtr local, int param) case XWACOM_PARAM_SBOTTOMY7: { int sn = (param - XWACOM_PARAM_SBOTTOMY0) / 4; - int numS = screenInfo.numScreens; - if (priv->twinview != TV_NONE) - numS = 2; - if (sn >= numS) + if (sn >= priv->numScreen) return -1; else return priv->screenBottomY[sn]; @@ -843,10 +847,7 @@ static int xf86WcmGetParam(LocalDevicePtr local, int param) case XWACOM_PARAM_SCREEN_NO: return priv->screen_no; case XWACOM_PARAM_NUMSCREEN: - if (priv->twinview == TV_NONE) - return screenInfo.numScreens; - else - return 2; + return priv->numScreen; } DBG(10, priv->debugLevel, ErrorF("xf86WcmGetParam invalid param %d\n", param)); return -1; @@ -859,10 +860,7 @@ static int xf86WcmGetParam(LocalDevicePtr local, int param) static int xf86WcmGetDefaultScreenInfo(LocalDevicePtr local, int param) { WacomDevicePtr priv = (WacomDevicePtr)local->private; - int numS = screenInfo.numScreens, i = 0; - - if (priv->twinview != TV_NONE) - numS = 2; + int numS = priv->numScreen; switch (param) { @@ -878,17 +876,8 @@ static int xf86WcmGetDefaultScreenInfo(LocalDevicePtr local, int param) int sn = (param - XWACOM_PARAM_STOPX0) / 4; if (sn >= numS) return -1; - else if (priv->twinview == TV_ABOVE_BELOW) - return 0; - else if (priv->twinview == TV_LEFT_RIGHT) - return (sn ? priv->tvResolution[0] : 0); else - { - int x = 0; - for (i = 0; i<sn; i++) - x += screenInfo.screens[i]->width; - return x; - } + return priv->screenTopX[sn]; } case XWACOM_PARAM_STOPY0: case XWACOM_PARAM_STOPY1: @@ -902,17 +891,8 @@ static int xf86WcmGetDefaultScreenInfo(LocalDevicePtr local, int param) int sn = (param - XWACOM_PARAM_STOPY0) / 4; if (sn >= numS) return -1; - else if (priv->twinview == TV_ABOVE_BELOW) - return (sn ? priv->tvResolution[1] : 0); - else if (priv->twinview == TV_LEFT_RIGHT) - return 0; else - { - int y = 0; - for (i = 0; i<sn; i++) - y += screenInfo.screens[i]->height; - return y; - } + return priv->screenTopY[sn]; } case XWACOM_PARAM_SBOTTOMX0: case XWACOM_PARAM_SBOTTOMX1: @@ -926,10 +906,8 @@ static int xf86WcmGetDefaultScreenInfo(LocalDevicePtr local, int param) int sn = (param - XWACOM_PARAM_SBOTTOMX0) / 4; if (sn >= numS) return -1; - else if (priv->twinview != TV_NONE) - return (sn ? priv->tvResolution[2] : priv->tvResolution[0]); else - return screenInfo.screens[i]->width; + return priv->screenBottomX[sn]; } case XWACOM_PARAM_SBOTTOMY0: case XWACOM_PARAM_SBOTTOMY1: @@ -943,12 +921,11 @@ static int xf86WcmGetDefaultScreenInfo(LocalDevicePtr local, int param) int sn = (param - XWACOM_PARAM_SBOTTOMY0) / 4; if (sn >= numS) return -1; - else if (priv->twinview != TV_NONE) - return (sn ? priv->tvResolution[3] : priv->tvResolution[1]); else - return screenInfo.screens[i]->height; + return priv->screenBottomY[sn]; } } + DBG(10, priv->debugLevel, ErrorF("xf86WcmGetDefaultScreenInfo invalid param %d\n", param)); return -1; } @@ -1047,6 +1024,7 @@ int xf86WcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) { priv->flags |= ABSOLUTE_FLAG; xf86ReplaceStrOption(local->options, "Mode", "Absolute"); + xf86WcmMappingFactor(local); xf86WcmInitialCoordinates(local, 0); xf86WcmInitialCoordinates(local, 1); } @@ -1054,6 +1032,7 @@ int xf86WcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) { priv->flags &= ~ABSOLUTE_FLAG; xf86ReplaceStrOption(local->options, "Mode", "Relative"); + xf86WcmMappingFactor(local); xf86WcmInitialCoordinates(local, 0); xf86WcmInitialCoordinates(local, 1); } diff --git a/src/xdrv/xf86Wacom.c b/src/xdrv/xf86Wacom.c index c1554af..32cf6ea 100755 --- a/src/xdrv/xf86Wacom.c +++ b/src/xdrv/xf86Wacom.c @@ -1,6 +1,6 @@ /* * Copyright 1995-2002 by Frederic Lepied, France. <Lepied@XFree86.org> - * Copyright 2002-2007 by Ping Cheng, Wacom Technology. <pingc@wacom.com> + * Copyright 2002-2008 by Ping Cheng, Wacom Technology. <pingc@wacom.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -59,9 +59,10 @@ * 2007-10-25 47-pc0.7.9-1 - Support multimonitors in both horizonal and vertical settings * 2007-11-21 47-pc0.7.9-3 - Updated TwinView screen switch offset * 2007-12-07 47-pc0.7.9-4 - Support Cintiq 12WX and Bamboo + * 2007-12-20 47-pc0.7.9-5 - multimonitor support update */ -static const char identification[] = "$Identification: 47-0.7.9-4 $"; +static const char identification[] = "$Identification: 47-0.7.9-5 $"; /****************************************************************************/ @@ -77,6 +78,7 @@ static Bool xf86WcmDevConvert(LocalDevicePtr local, int first, int num, int v0, int v1, int v2, int v3, int v4, int v5, int* x, int* y); static Bool xf86WcmDevReverseConvert(LocalDevicePtr local, int x, int y, int* valuators); +static void xf86WcmInitialTVScreens(LocalDevicePtr local); extern Bool usbWcmInit(LocalDevicePtr pDev); extern int usbWcmGetRanges(LocalDevicePtr local); extern int xf86WcmDevChangeControl(LocalDevicePtr local, xDeviceCtl* control); @@ -104,7 +106,6 @@ static int xf86WcmInitArea(LocalDevicePtr local) WacomDevicePtr priv = (WacomDevicePtr)local->private; WacomToolAreaPtr area = priv->toolarea, inlist; WacomCommonPtr common = priv->common; - int totalWidth = 0, maxHeight = 0; double screenRatio, tabletRatio; DBG(10, priv->debugLevel, ErrorF("xf86WcmInitArea\n")); @@ -134,6 +135,9 @@ static int xf86WcmInitArea(LocalDevicePtr local) area->bottomY = priv->bottomY = common->wcmMaxY; } + if (priv->twinview != TV_NONE) + priv->numScreen = 2; + if (priv->screen_no != -1 && (priv->screen_no >= priv->numScreen || priv->screen_no < 0)) { @@ -145,38 +149,16 @@ static int xf86WcmInitArea(LocalDevicePtr local) } } - /* Calculate the ratio according to KeepShape, TopX and TopY */ - if (priv->screen_no != -1) - { - priv->currentScreen = priv->screen_no; - if (priv->twinview == TV_NONE) - { - totalWidth = screenInfo.screens[priv->currentScreen]->width; - maxHeight = screenInfo.screens[priv->currentScreen]->height; - } - else - { - totalWidth = priv->tvResolution[2*priv->currentScreen]; - maxHeight = priv->tvResolution[2*priv->currentScreen+1]; - } - } - else - { - int i; - for (i = 0; i < priv->numScreen; i++) - { - totalWidth += screenInfo.screens[i]->width; - if (maxHeight < screenInfo.screens[i]->height) - maxHeight=screenInfo.screens[i]->height; - } - } + /* need maxWidth and maxHeight for keepshape */ + xf86WcmMappingFactor(local); /* Maintain aspect ratio */ if (priv->flags & KEEP_SHAPE_FLAG) { - screenRatio = totalWidth / (double)maxHeight; - tabletRatio = ((double)(common->wcmMaxX - priv->topX)) / - (common->wcmMaxY - priv->topY); + + screenRatio = ((double)priv->maxWidth / (double)priv->maxHeight); + tabletRatio = ((double)(common->wcmMaxX - priv->topX) / + (double)(common->wcmMaxY - priv->topY)); DBG(2, priv->debugLevel, ErrorF("screenRatio = %.3g, " "tabletRatio = %.3g\n", screenRatio, tabletRatio)); @@ -193,16 +175,11 @@ static int xf86WcmInitArea(LocalDevicePtr local) screenRatio / tabletRatio + priv->topX; area->bottomY = priv->bottomY = common->wcmMaxY; } + /* active tablet size has been changed */ + xf86WcmMappingFactor(local); } /* end keep shape */ - priv->factorX = totalWidth - / (double)(priv->bottomX - priv->topX - 2*priv->tvoffsetX); - priv->factorY = maxHeight - / (double)(priv->bottomY - priv->topY - 2*priv->tvoffsetY); - DBG(2, priv->debugLevel, ErrorF("X factor = %.3g, Y factor = %.3g\n", - priv->factorX, priv->factorY)); - inlist = priv->tool->arealist; /* The first one in the list is always valid */ @@ -277,7 +254,7 @@ void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes) #if defined WCM_XORG && GET_ABI_MAJOR(ABI_XINPUT_VERSION) > 0 /* Ugly hack for Xorg 7.3, which doesn't call xf86WcmDevConvert * for coordinate conversion at the moment */ - if (priv->flags & ABSOLUTE_FLAG) tabletSize -= topx; + if (priv->flags & ABSOLUTE_FLAG) tabletSize -= topx - priv->tvoffsetX; topx = 0; tabletSize = (int)((double)tabletSize * priv->factorX + 0.5); resolution = (int)((double)resolution * priv->factorX + 0.5); @@ -304,7 +281,7 @@ void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes) #if defined WCM_XORG && GET_ABI_MAJOR(ABI_XINPUT_VERSION) > 0 /* Ugly hack for Xorg 7.3, which doesn't call xf86WcmDevConvert * for coordinate conversion at the moment */ - if (priv->flags & ABSOLUTE_FLAG) tabletSize -= topy; + if (priv->flags & ABSOLUTE_FLAG) tabletSize -= topy - priv->tvoffsetY; topy = 0; tabletSize = (int)((double)tabletSize * priv->factorY + 0.5); resolution = (int)((double)resolution * priv->factorY + 0.5); @@ -319,17 +296,18 @@ void xf86WcmInitialCoordinates(LocalDevicePtr local, int axes) * xf86WcmInitialTVScreens ****************************************************************************/ -void xf86WcmInitialTVScreens(LocalDevicePtr local) +static void xf86WcmInitialTVScreens(LocalDevicePtr local) { WacomDevicePtr priv = (WacomDevicePtr)local->private; - priv->tvoffsetX = 0; - priv->tvoffsetY = 0; if (priv->twinview == TV_NONE) return; + priv->numScreen = 2; + if (priv->twinview == TV_LEFT_RIGHT) { + /* it does not need the offset if always map to a specific screen */ if (priv->screen_no == -1) priv->tvoffsetX = 60; @@ -344,9 +322,11 @@ void xf86WcmInitialTVScreens(LocalDevicePtr local) } else if (priv->twinview == TV_ABOVE_BELOW) { + /* it does not need the offset if always map to a specific screen */ if (priv->screen_no == -1) priv->tvoffsetY = 60; + /* default resolution */ if(!priv->tvResolution[0]) { priv->tvResolution[0] = screenInfo.screens[0]->width; @@ -394,17 +374,23 @@ void xf86WcmInitialScreens(LocalDevicePtr local) WacomDevicePtr priv = (WacomDevicePtr)local->private; int i; + priv->tvoffsetX = 0; + priv->tvoffsetY = 0; if (priv->twinview != TV_NONE) + { + xf86WcmInitialTVScreens(local); return; + } /* initial screen info */ + priv->numScreen = screenInfo.numScreens; priv->screenTopX[0] = 0; priv->screenTopY[0] = 0; priv->screenBottomX[0] = 0; priv->screenBottomY[0] = 0; for (i=0; i<screenInfo.numScreens; i++) { -#ifdef _XSERV_GLOBAL_H_ +#ifdef WCM_XORG priv->screenTopX[i] = dixScreenOrigins[i].x; priv->screenTopY[i] = dixScreenOrigins[i].y; priv->screenBottomX[i] = dixScreenOrigins[i].x; @@ -416,8 +402,11 @@ void xf86WcmInitialScreens(LocalDevicePtr local) #else if (i > 0) { + /* only support left to right in this case */ priv->screenTopX[i] = priv->screenBottomX[i-1]; - priv->screenTopY[i] = priv->screenBottomY[i-1]; + priv->screenTopY[i] = 0; + priv->screenBottomX[i] = priv->screenTopX[i]; + priv->screenBottomY[i] = 0; } #endif priv->screenBottomX[i] += screenInfo.screens[i]->width; @@ -459,6 +448,9 @@ static int xf86WcmRegisterX11Devices (LocalDevicePtr local) IsPad(priv) ? "pad" : "eraser", nbbuttons, nbkeys, nbaxes)); + /* initialize screen bounding rect */ + xf86WcmInitialScreens(local); + if (xf86WcmInitArea(local) == FALSE) { return FALSE; @@ -556,12 +548,6 @@ static int xf86WcmRegisterX11Devices (LocalDevicePtr local) xf86MotionHistoryAllocate(local); #endif - /* initialize screen bounding rect */ - if (priv->twinview != TV_NONE) - xf86WcmInitialTVScreens(local); - else - xf86WcmInitialScreens(local); - /* x */ xf86WcmInitialCoordinates(local, 0); @@ -863,7 +849,8 @@ static int xf86WcmDevProc(DeviceIntPtr pWcm, int what) /***************************************************************************** * xf86WcmDevConvert -- * Convert X & Y valuators so core events can be generated with - * coordinates that are scaled and suitable for screen resolution. ****************************************************************************/ + * coordinates that are scaled and suitable for screen resolution. + ****************************************************************************/ static Bool xf86WcmDevConvert(LocalDevicePtr local, int first, int num, int v0, int v1, int v2, int v3, int v4, int v5, int* x, int* y) @@ -871,7 +858,8 @@ static Bool xf86WcmDevConvert(LocalDevicePtr local, int first, int num, WacomDevicePtr priv = (WacomDevicePtr) local->private; double temp; - DBG(6, priv->debugLevel, ErrorF("xf86WcmDevConvert v0=%d v1=%d \n", v0, v1)); + DBG(6, priv->debugLevel, ErrorF("xf86WcmDevConvert v0=%d v1=%d on screen %d \n", + v0, v1, priv->currentScreen)); if (first != 0 || num == 1) return FALSE; @@ -881,94 +869,29 @@ static Bool xf86WcmDevConvert(LocalDevicePtr local, int first, int num, if (priv->flags & ABSOLUTE_FLAG) { + v0 = v0 > priv->bottomX - priv->tvoffsetX ? priv->sizeX : + v0 < priv->topX + priv->tvoffsetX ? + 0 : v0 - priv->topX - priv->tvoffsetX; + v1 = v1 > priv->bottomY - priv->tvoffsetY ? priv->sizeY : + v1 < priv->topY + priv->tvoffsetY ? + 0 : v1 - priv->topY - priv->tvoffsetY; + + int leftPadding = 0; + int topPadding = 0; if (priv->twinview == TV_NONE) { - v0 = v0 > priv->bottomX ? priv->bottomX - priv->topX : - v0 < priv->topX ? 0 : v0 - priv->topX; - v1 = v1 > priv->bottomY ? priv->bottomY - priv->topY : - v1 < priv->topY ? 0 : v1 - priv->topY; - - if (priv->common->wcmMMonitor) + if (priv->screen_no == -1) { - int i, totalWidth, leftPadding = 0; - if (priv->screen_no == -1) - { - for (i = 0; i < priv->currentScreen; i++) - leftPadding += screenInfo.screens[i]->width; - for (totalWidth = leftPadding; i < priv->numScreen; i++) - totalWidth += screenInfo.screens[i]->width; - } - else - { - leftPadding = 0; - totalWidth = screenInfo.screens[priv->currentScreen]->width; - } - v0 -= (priv->bottomX - priv->topX) * leftPadding - / (double)totalWidth + 0.5; + leftPadding = priv->screenTopX[priv->currentScreen]; + topPadding = priv->screenTopY[priv->currentScreen]; } + *x = - leftPadding; + *y = - topPadding; } else { - v0 -= priv->topX - priv->tvoffsetX; - v1 -= priv->topY - priv->tvoffsetY; - if (priv->twinview == TV_LEFT_RIGHT) - { - if (v0 > priv->bottomX - priv->tvoffsetX && priv->screen_no == -1) - { - if (priv->currentScreen == 0) - v0 = priv->bottomX - priv->tvoffsetX; - else - { - v0 -= priv->bottomX - priv->topX - 2*priv->tvoffsetX; - if (v0 > priv->bottomX - priv->tvoffsetX) - v0 = 2*(priv->bottomX - priv->tvoffsetX) - v0; - } - } - if (priv->currentScreen == 1) - { - *x = priv->tvResolution[0] + priv->tvResolution[2] - * v0 / (priv->bottomX - priv->topX - 2*priv->tvoffsetX); - *y = v1 * priv->tvResolution[3] / - (priv->bottomY - priv->topY - 2*priv->tvoffsetY) + 0.5; - } - else - { - *x = priv->tvResolution[0] * v0 - / (priv->bottomX - priv->topX - 2*priv->tvoffsetX); - *y = v1 * priv->tvResolution[1] / - (priv->bottomY - priv->topY - 2*priv->tvoffsetY) + 0.5; - } - } - if (priv->twinview == TV_ABOVE_BELOW) - { - if (v1 > priv->bottomY - priv->tvoffsetY && priv->screen_no == -1) - { - if (priv->currentScreen == 0) - v1 = priv->bottomY - priv->tvoffsetY; - else - { - v1 -= priv->bottomY - priv->topY - 2*priv->tvoffsetY; - if (v1 > priv->bottomY - priv->tvoffsetY) - v1 = 2*(priv->bottomY - priv->tvoffsetY) - v1; - } - } - if (priv->currentScreen == 1) - { - *x = v0 * priv->tvResolution[2] / - (priv->bottomX - priv->topX - 2*priv->tvoffsetX) + 0.5; - *y = priv->tvResolution[1] + - priv->tvResolution[3] * v1 / - (priv->bottomY - priv->topY - 2*priv->tvoffsetY); - } - else - { - *x = v0 * priv->tvResolution[0] / - (priv->bottomX - priv->topX - 2*priv->tvoffsetX) + 0.5; - *y = priv->tvResolution[1] * v1 / - (priv->bottomY - priv->topY - 2*priv->tvoffsetY); - } - } - return TRUE; + *x = priv->screenTopX[priv->currentScreen]; + *y = priv->screenTopY[priv->currentScreen]; } } temp = ((double)v0 * priv->factorX + 0.5); @@ -984,7 +907,8 @@ static Bool xf86WcmDevConvert(LocalDevicePtr local, int first, int num, * xf86WcmDevReverseConvert -- * Convert X and Y to valuators in relative mode where the position of * the core pointer must be translated into device cootdinates before - * the extension and core events are generated in Xserver. ****************************************************************************/ + * the extension and core events are generated in Xserver. + ****************************************************************************/ static Bool xf86WcmDevReverseConvert(LocalDevicePtr local, int x, int y, int* valuators) diff --git a/src/xdrv/xf86Wacom.h b/src/xdrv/xf86Wacom.h index 805cf60..1f47026 100755 --- a/src/xdrv/xf86Wacom.h +++ b/src/xdrv/xf86Wacom.h @@ -1,6 +1,6 @@ /* * Copyright 1995-2002 by Frederic Lepied, France. <Lepied@XFree86.org> - * Copyright 2002-2007 by Ping Cheng, Wacom Technology. <pingc@wacom.com> + * Copyright 2002-2008 by Ping Cheng, Wacom Technology. <pingc@wacom.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -22,6 +22,7 @@ /****************************************************************************/ +#include "../include/xdrv-config.h" #include <xf86Version.h> #include "../include/Xwacom.h" @@ -29,7 +30,7 @@ * Linux Input Support ****************************************************************************/ -#ifdef LINUX_INPUT +#ifdef WCM_ENABLE_LINUXINPUT #include <asm/types.h> #include <linux/input.h> @@ -43,7 +44,7 @@ #define MAX_USB_EVENTS 32 -#endif /* LINUX_INPUT */ +#endif /* WCM_ENABLE_LINUXINPUT */ /* max number of input events to read in one read call */ #define MAX_EVENTS 50 @@ -63,19 +64,9 @@ #if !defined(DGUX) # include <xisb.h> /* X.org recently kicked out the libc-wrapper */ -# if defined WCM_XORG -# undef NEED_XF86_TYPES /* defined (or not) in xorg-server.h*/ -# include <xorg-server.h> -/* Xorg 6.x, 7.0, 7.1, and 7.2 uses version 6.xx or 7.xx, - * Xorg 7.3 have dropped down to 1.4... */ -# if XORG_VERSION_CURRENT < ((1) * 10000000) + ((4) * 100000) + ((99) * 1000) -# include <xf86_ansic.h> -# elif XORG_VERSION_CURRENT >= ((6) * 10000000) -# include <xf86_ansic.h> -# else -# include <string.h> -# include <errno.h> -# endif +# ifdef WCM_NO_LIBCWRAPPER +# include <string.h> +# include <errno.h> # else # include <xf86_ansic.h> # endif @@ -277,6 +268,8 @@ struct _WacomDeviceRec int topY; /* Y top */ int bottomX; /* X bottom */ int bottomY; /* Y bottom */ + int sizeX; /* active X size */ + int sizeY; /* active Y size */ double factorX; /* X factor */ double factorY; /* Y factor */ unsigned int serial; /* device serial number */ @@ -285,6 +278,8 @@ struct _WacomDeviceRec int screenTopY[32]; /* top cordinate of the associated screen */ int screenBottomX[32]; /* right cordinate of the associated screen */ int screenBottomY[32]; /* bottom cordinate of the associated screen */ + int maxWidth; /* max active screen width */ + int maxHeight; /* max active screen height */ int button[MAX_BUTTONS];/* buttons assignments */ unsigned keys[MAX_BUTTONS][256]; /* keystrokes assigned to buttons */ int relup; @@ -444,7 +439,7 @@ struct _WacomDeviceClass void (*Read)(LocalDevicePtr local); /* reads device */ }; -#ifdef LINUX_INPUT +#ifdef WCM_ENABLE_LINUXINPUT extern WacomDeviceClass gWacomUSBDevice; #endif @@ -458,7 +453,7 @@ struct _WacomDeviceClass #define TILT_REQUEST_FLAG 1 #define TILT_ENABLED_FLAG 2 #define RAW_FILTERING_FLAG 4 -#ifdef LINUX_INPUT +#ifdef WCM_ENABLE_LINUXINPUT /* set if the /dev/input driver should wait for SYN_REPORT events as the end of record indicator */ #define USE_SYN_REPORTS_FLAG 8 @@ -527,7 +522,7 @@ struct _WacomCommonRec int bufpos; /* position with buffer */ unsigned char buffer[BUFFER_SIZE]; /* data read from device */ -#ifdef LINUX_INPUT +#ifdef WCM_ENABLE_LINUXINPUT int wcmLastToolSerial; int wcmEventCnt; struct input_event wcmEvents[MAX_USB_EVENTS]; /* events for current change */ @@ -538,7 +533,7 @@ struct _WacomCommonRec #define HANDLE_TILT(comm) ((comm)->wcmFlags & TILT_ENABLED_FLAG) #define RAW_FILTERING(comm) ((comm)->wcmFlags & RAW_FILTERING_FLAG) -#ifdef LINUX_INPUT +#ifdef WCM_ENABLE_LINUXINPUT #define USE_SYN_REPORTS(comm) ((comm)->wcmFlags & USE_SYN_REPORTS_FLAG) #endif @@ -636,5 +631,8 @@ Bool xf86WcmAreaListOverlap(WacomToolAreaPtr area, WacomToolAreaPtr list); /* Change pad's mode according to it core event status */ int xf86WcmSetPadCoreMode(LocalDevicePtr local); +/* calculate the proper tablet to screen mapping factor */ +void xf86WcmMappingFactor(LocalDevicePtr local); + /****************************************************************************/ #endif /* __XF86WACOM_H */ |