From: HyungKyu Song Date: Fri, 15 Feb 2013 14:59:37 +0000 (+0900) Subject: Tizen 2.0 Release X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ee6d09e6d929120f764bdec22fa296377f5933d;p=profile%2Fivi%2Fxserver-xorg-input-evdev-multitouch.git Tizen 2.0 Release --- diff --git a/10-diamondtouch.fdi b/10-diamondtouch.fdi new file mode 100644 index 0000000..dc0bc15 --- /dev/null +++ b/10-diamondtouch.fdi @@ -0,0 +1,10 @@ + + + + + + + evdevmultitouch + + + diff --git a/10-logitech.fdi b/10-logitech.fdi new file mode 100644 index 0000000..4151d70 --- /dev/null +++ b/10-logitech.fdi @@ -0,0 +1,13 @@ + + + + + + + + evdevmultitouchmultitouch + + + + + diff --git a/10-stantum.fdi b/10-stantum.fdi new file mode 100644 index 0000000..33d080d --- /dev/null +++ b/10-stantum.fdi @@ -0,0 +1,11 @@ + + + + + + + evdevmultitouch + + + + diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e903784 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Sung-Jin Park +Sangjin Lee diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..b76958b --- /dev/null +++ b/COPYING @@ -0,0 +1,115 @@ +Various copyright notices found in this driver: + +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +Copyright © 2004-2008 Red Hat, Inc. + +Permission to use, copy, modify, distribute, and sell this software +and its documentation for any purpose is hereby granted without +fee, provided that the above copyright notice appear in all copies +and that both that copyright notice and this permission notice +appear in supporting documentation, and that the name of Red Hat +not be used in advertising or publicity pertaining to distribution +of the software without specific, written prior permission. Red +Hat makes no representations about the suitability of this software +for any purpose. It is provided "as is" without express or implied +warranty. + +THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN +NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Copyright 2005 Sun Microsystems, Inc. All rights reserved. + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the copyright holders shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from the copyright holders. + +Copyright © 2008 University of South Australia +copyrights taken from xf86-input-mouse, partly valid for this driver. +Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. +Copyright 1993 by David Dawes +Copyright 2002 by SuSE Linux AG, Author: Egbert Eich +Copyright 1994-2002 by The XFree86 Project, Inc. +Copyright 2002 by Paul Elliott + +Permission to use, copy, modify, distribute, and sell this software +and its documentation for any purpose is hereby granted without +fee, provided that the above copyright notice appear in all copies +and that both that copyright notice and this permission notice +appear in supporting documentation, and that the name of the authors +not be used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. The authors make no +representations about the suitability of this software for any +purpose. It is provided "as is" without express or implied +warranty. + +THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN +NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, +NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + +Copyright 2005 Adam Jackson. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +on the rights to use, copy, modify, merge, publish, distribute, sub +license, and/or sell copies of the Software, and to permit persons to whom +the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..7b3990f --- /dev/null +++ b/ChangeLog @@ -0,0 +1,6 @@ +[Title] SEL Verification - Fix a bug that causes SEGV when X server tries to remove a multitouch device +[Issue#] S1-7024 +[Problem] A segmentation fault was made when X server tries to remove a multitouch device. +[Cause] X multitouch driver tries to free a pointer(device name) which was not allocated by malloc. +[Solution] Allocate a pointer by malloc() for the device name. +[SCMRequest] N/A diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..d23f650 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,40 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +AUTOMAKE_OPTIONS = foreign + +# Ensure headers are installed below $(prefix) for distcheck +DISTCHECK_CONFIGURE_FLAGS = --with-sdkdir='$${includedir}/xorg' + +SUBDIRS = src man include + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = xorg-evdev-multitouch.pc + +EXTRA_DIST = ChangeLog + +MAINTAINERCLEANFILES=ChangeLog + +.PHONY: ChangeLog + +ChangeLog: + $(CHANGELOG_CMD) + +dist-hook: ChangeLog diff --git a/README b/README new file mode 100644 index 0000000..3b3e134 --- /dev/null +++ b/README @@ -0,0 +1,20 @@ +xf86-input-evdevmultitouch - Generic Linux input driver for the Xorg X server + +Please submit bugs & patches to the Xorg bugzilla: + + https://bugs.freedesktop.org/enter_bug.cgi?product=xorg + +All questions regarding this software should be directed at the +Xorg mailing list: + + http://lists.freedesktop.org/mailman/listinfo/xorg + +The master development code repository can be found at: + + git://anongit.freedesktop.org/git/xorg/driver/xf86-input-evdevmultitouch + + http://cgit.freedesktop.org/xorg/driver/xf86-input-evdevmultitouch + +For more information on the git code manager, see: + + http://wiki.x.org/wiki/GitPage diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..904cd67 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd $srcdir + +autoreconf -v --install || exit 1 +cd $ORIGDIR || exit $? + +$srcdir/configure --enable-maintainer-mode "$@" diff --git a/configure.ac b/configure.ac new file mode 100755 index 0000000..5dabddc --- /dev/null +++ b/configure.ac @@ -0,0 +1,87 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Process this file with autoconf to produce a configure script + +AC_PREREQ(2.57) +AC_INIT([xf86-input-evdev-multitouch], + 2.3.1, + [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], + xf86-input-evdev-multitouch) + +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_AUX_DIR(.) +AM_INIT_AUTOMAKE([dist-bzip2]) + +AM_MAINTAINER_MODE + +# Require xorg-macros: XORG_DEFAULT_OPTIONS +m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.3 or later before running autoconf/autogen])]) +XORG_MACROS_VERSION(1.3) +AM_CONFIG_HEADER([config.h]) + +# Checks for programs. +AC_DISABLE_STATIC +AC_PROG_LIBTOOL +AC_PROG_CC +XORG_DEFAULT_OPTIONS + +AH_TOP([#include "xorg-server.h"]) + +AC_ARG_WITH(xorg-module-dir, + AC_HELP_STRING([--with-xorg-module-dir=DIR], + [Default xorg module directory [[default=$libdir/xorg/modules]]]), + [moduledir="$withval"], + [moduledir="$libdir/xorg/modules"]) +inputdir=${moduledir}/input +AC_SUBST(inputdir) + +# Checks for pkg-config packages. We need to be able to override sdkdir +# to satisfy silly distcheck requirements. +PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES) +XORG_CFLAGS="$CWARNFLAGS $XORG_CFLAGS" +AC_ARG_WITH([sdkdir], [], + [sdkdir="$withval"], + [sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`]) +AC_SUBST([sdkdir]) + +# Checks for libraries. +#PKG_CHECK_MODULES(HAL,hal) +#AC_SUBST(HAL_CFLAGS) +#AC_SUBST(HAL_LIBS) + +#CFLAGS="$CFLAGS $XORG_CFLAGS $HAL_CFLAGS"' -I$(top_srcdir)/src' +#LIBS="$LIBS $XORG_LIBS $HAL_LIBS" +CFLAGS="$CFLAGS $XORG_CFLAGS"' -I$(top_srcdir)/src' +LIBS="$LIBS $XORG_LIBS" +AC_SUBST(CFLAGS) +AC_SUBST(LIBS) + +# Checks for header files. +AC_HEADER_STDC + +DRIVER_NAME=evdevmultitouch +AC_SUBST([DRIVER_NAME]) + +AC_OUTPUT([Makefile + src/Makefile + man/Makefile + include/Makefile + xorg-evdev-multitouch.pc]) diff --git a/include/Makefile.am b/include/Makefile.am new file mode 100644 index 0000000..1f93750 --- /dev/null +++ b/include/Makefile.am @@ -0,0 +1,2 @@ +EXTRA_DIST = evdevmultitouch-properties.h +sdk_HEADERS = evdevmultitouch-properties.h diff --git a/include/evdevmultitouch-properties.h b/include/evdevmultitouch-properties.h new file mode 100755 index 0000000..0be50c0 --- /dev/null +++ b/include/evdevmultitouch-properties.h @@ -0,0 +1,95 @@ +/* + * xserver-xorg-input-evdev-multitouch + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Sung-Jin Park + * Sangjin LEE + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of Red Hat + * not be used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. Red + * Hat makes no representations about the suitability of this software + * for any purpose. It is provided "as is" without express or implied + * warranty. + * + * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Copyright © 2008 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of Red Hat + * not be used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. Red + * Hat makes no representations about the suitability of this software + * for any purpose. It is provided "as is" without express or implied + * warranty. + * + * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Authors: + * Peter Hutterer (peter.hutterer@redhat.com) + */ + + +#ifndef _EVDEVMULTITOUCH_PROPERTIES_H_ +#define _EVDEVMULTITOUCH_PROPERTIES_H_ + +/* Middle mouse button emulation */ +/* BOOL */ +#define EVDEVMULTITOUCH_PROP_MIDBUTTON "EvdevMultitouch Middle Button Emulation" +/* CARD32 */ +#define EVDEVMULTITOUCH_PROP_MIDBUTTON_TIMEOUT "EvdevMultitouch Middle Button Timeout" + +/* Wheel emulation */ +/* BOOL */ +#define EVDEVMULTITOUCH_PROP_WHEEL "EvdevMultitouch Wheel Emulation" +/* CARD8, 4 values [x up, x down, y up, y down], 0 to disable a value*/ +#define EVDEVMULTITOUCH_PROP_WHEEL_AXES "EvdevMultitouch Wheel Emulation Axes" +/* CARD16 */ +#define EVDEVMULTITOUCH_PROP_WHEEL_INERTIA "EvdevMultitouch Wheel Emulation Inertia" +/* CARD16 */ +#define EVDEVMULTITOUCH_PROP_WHEEL_TIMEOUT "EvdevMultitouch Wheel Emulation Timeout" +/* CARD8, value range 0-32, 0 to always scroll */ +#define EVDEVMULTITOUCH_PROP_WHEEL_BUTTON "EvdevMultitouch Wheel Emulation Button" + +/* Drag lock */ +/* CARD8, either 1 value or pairs, value range 0-32, 0 to disable a value*/ +#define EVDEVMULTITOUCH_PROP_DRAGLOCK "EvdevMultitouch Drag Lock Buttons" + +/* Axis inversion */ +/* BOOL, 2 values [x, y], 1 inverts axis */ +#define EVDEVMULTITOUCH_PROP_INVERT_AXES "EvdevMultitouch Axis Inversion" + +/* Reopen attempts. */ +/* CARD8 */ +#define EVDEVMULTITOUCH_PROP_REOPEN "EvdevMultitouch Reopen Attempts" + +/* Run-time calibration */ +/* CARD32, 4 values [minx, maxx, miny, maxy], or no values for unset */ +#define EVDEVMULTITOUCH_PROP_CALIBRATION "EvdevMultitouch Axis Calibration" + +/* Swap x and y axis. */ +/* BOOL */ +#define EVDEVMULTITOUCH_PROP_SWAP_AXES "EvdevMultitouch Axes Swap" + +#endif diff --git a/man/Makefile.am b/man/Makefile.am new file mode 100644 index 0000000..276f2f0 --- /dev/null +++ b/man/Makefile.am @@ -0,0 +1,57 @@ +# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation. +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the copyright holders shall +# not be used in advertising or otherwise to promote the sale, use or +# other dealings in this Software without prior written authorization +# from the copyright holders. +# + +drivermandir = $(DRIVER_MAN_DIR) + +driverman_PRE = @DRIVER_NAME@.man + +driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@) + +EXTRA_DIST = @DRIVER_NAME@.man + +CLEANFILES = $(driverman_DATA) + +SED = sed + +# Strings to replace in man pages +XORGRELSTRING = @PACKAGE_STRING@ + XORGMANNAME = X Version 11 + +MAN_SUBSTS = \ + -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \ + -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \ + -e 's|__xservername__|Xorg|g' \ + -e 's|__xconfigfile__|xorg.conf|g' \ + -e 's|__projectroot__|$(prefix)|g' \ + -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \ + -e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \ + -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \ + -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \ + -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g' + +SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man + +.man.$(DRIVER_MAN_SUFFIX): + sed $(MAN_SUBSTS) < $< > $@ diff --git a/man/evdevmultitouch.man b/man/evdevmultitouch.man new file mode 100644 index 0000000..abd31e2 --- /dev/null +++ b/man/evdevmultitouch.man @@ -0,0 +1,231 @@ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH EVDEVMULTITOUCHh __drivermansuffix__ __vendorversion__ +.SH NAME +evdevmultitouch \- Generic Linux input driver +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qevdevmultitouch\*q" +.BI " Option \*qDevice\*q \*q" devpath \*q +.BI " Option \*qEmulate3Buttons\*q \*q" True \*q +.BI " Option \*qEmulate3Timeout\*q \*q" 50 \*q +.BI " Option \*qGrabDevice\*q \*q" False \*q +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B evdevmultitouch +is an __xservername__ input driver for Linux\'s generic event devices. It +therefore supports all input devices that the kernel knows about, including +most mice and keyboards. +.PP +The +.B evdevmultitouch +driver can serve as both a pointer and a keyboard input device, and may be +used as both the core keyboard and the core pointer. Multiple input devices +are supported by multiple instances of this driver, with one Load +directive for evdevmultitouch in the Module section of your __xconfigfile__ for each +input device that will use this driver. +.PP +.SH SUPPORTED HARDWARE +In general, any input device that the kernel has a driver for can be accessed +through the +.B evdevmultitouch +driver. See the Linux kernel documentation for a complete list. +.PP +.SH CONFIGURATION DETAILS +Please refer to __xconfigfile__(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +The following driver +.B Options +are supported: +.TP 7 +.BI "Option \*qButtonMapping\*q \*q" string \*q +Sets the button mapping for this device. The mapping is a space-separated list +of button mappings that correspond in order to the physical buttons on the +device (i.e. the first number is the mapping for button 1, etc.). The default +mapping is "1 2 3 ... 32". A mapping of 0 deactivates the button. Multiple +buttons can have the same mapping. +For example, a left-handed mouse with deactivated scroll-wheel would use a +mapping of "3 2 1 0 0". Invalid mappings are ignored and the default mapping +is used. Buttons not specified in the user's mapping use the default mapping. +.TP 7 +.BI "Option \*qDevice\*q \*q" string \*q +Specifies the device through which the device can be accessed. This will +generally be of the form \*q/dev/input/eventX\*q, where X is some integer. +The mapping from device node to hardware is system-dependent. +.TP 7 +.BI "Option \*qDragLockButtons\*q \*q" "L1 B2 L3 B4" \*q +Sets \*qdrag lock buttons\*q that simulate holding a button down, so +that low dexterity people do not have to hold a button down at the +same time they move a mouse cursor. Button numbers occur in pairs, +with the lock button number occurring first, followed by the button +number that is the target of the lock button. Property: "EvdevMultitouch +Drag Lock Buttons". +.TP 7 +.BI "Option \*qDragLockButtons\*q \*q" "M1" \*q +Sets a \*qmaster drag lock button\*q that acts as a \*qMeta Key\*q +indicating that the next button pressed is to be +\*qdrag locked\*q. Property: "EvdevMultitouch Drag Lock Buttons". +.TP 7 +.TP 7 +.BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q +Enable/disable the emulation of the third (middle) mouse button for mice +which only have two physical buttons. The third button is emulated by +pressing both buttons simultaneously. Default: on, until a middle mouse +button event is registered. Property: "EvdevMultitouch Middle Button Emulation". +.TP 7 +.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q +Sets the timeout (in milliseconds) that the driver waits before deciding +if two buttons where pressed "simultaneously" when 3 button emulation is +enabled. Default: 50. Property: "EvdevMultitouch Middle Button Timeout". +.BI "Option \*qEmulateWheel\*q \*q" boolean \*q +Enable/disable "wheel" emulation. Wheel emulation means emulating button +press/release events when the mouse is moved while a specific real button +is pressed. Wheel button events (typically buttons 4 and 5) are +usually used for scrolling. Wheel emulation is useful for getting wheel-like +behaviour with trackballs. It can also be useful for mice with 4 or +more buttons but no wheel. See the description of the +.BR EmulateWheelButton , +.BR EmulateWheelInertia , +.BR EmulateWheelTimeout , +.BR XAxisMapping , +and +.B YAxisMapping +options. Default: off. Property "EvdevMultitouch Wheel Emulation". +.TP 7 +.BI "Option \*qEmulateWheelButton\*q \*q" integer \*q +Specifies which button must be held down to enable wheel emulation mode. +While this button is down, X and/or Y pointer movement will generate button +press/release events as specified for the +.B XAxisMapping +and +.B YAxisMapping +settings. If the button is 0 and +.BR EmulateWheel +is on, any motion of the device is converted into wheel events. Default: 4. +Property: "EvdevMultitouch Wheel Emulation Button". +.TP 7 +.BI "Option \*qEmulateWheelInertia\*q \*q" integer \*q +Specifies how far (in pixels) the pointer must move to generate button +press/release events in wheel emulation mode. Default: 10. Property: "EvdevMultitouch +Wheel Emulation Inertia". +.TP 7 +.BI "Option \*qEmulateWheelTimeout\*q \*q" integer \*q +Specifies the time in milliseconds the +.BR EmulateWheelButton +must be pressed before wheel emulation is started. If the +.BR EmulateWheelButton +is released before this timeout, the original button press/release event +is sent. Default: 200. Property: "EvdevMultitouch Wheel Emulation Timeout". +.TP 7 +.BI "Option \*qGrabDevice\*q \*q" boolean \*q +Force a grab on the event device. Doing so will ensure that no other driver +can initialise the same device and it will also stop the device from sending +events to /dev/kbd or /dev/input/mice. Events from this device will not be +sent to virtual devices (e.g. rfkill or the Macintosh mouse button emulation). +Default: disabled. +.TP 7 +.BI "Option \*qInvertX\*q \*q" Bool \*q +.TP 7 +.BI "Option \*qInvertY\*q \*q" Bool \*q +Invert the given axis. Default: off. Property: "EvdevMultitouch Axis Inversion". +.TP 7 +.BI "Option \*qIgnoreRelativeAxes\*q \*q" Bool \*q +.TP 7 +.BI "Option \*qIgnoreAbsoluteAxes\*q \*q" Bool \*q +Ignore the specified type of axis. Default: unset. The X server cannot deal +with devices that have both relative and absolute axes. EvdevMultitouch tries to guess +wich axes to ignore given the device type and disables absolute axes for +mice and relative axes for tablets, touchscreens and touchpad. These options +allow to forcibly disable an axis type. Mouse wheel axes are exempt and will +work even if relative axes are ignored. No property, this configuration must +be set in the configuration. +.br +If either option is set to False, the driver will not ignore the specified +axes regardless of the presence of other axes. This may trigger buggy +behavior and events from this axis are always forwarded. Users are +discouraged from setting this option. +.TP 7 +.BI "Option \*qReopenAttempts\*q \*q" integer \*q +Number of reopen attempts after a read error occurs on the device (e.g. after +waking up from suspend). In between each attempt is a 100ms wait. Default: 10. +.TP 7 +.BI "Option \*qCalibration\*q \*q" "min-x max-x min-y max-y" \*q +Calibrates the X and Y axes for devices that need to scale to a different +coordinate system than reported to the X server. This feature is required +for devices that need to scale to a different coordinate system than +originally reported by the kernel (e.g. touchscreens). The scaling to the +custom coordinate system is done in-driver and the X server is unaware of +the transformation. Property: "EvdevMultitouch Axis Calibration". +.TP 7 +.BI "Option \*qSwapAxes\*q \*q" Bool \*q +Swap x/y axes. Default: off. Property: "EvdevMultitouch Axes Swap". +.TP 7 +.BI "Option \*qXAxisMapping\*q \*q" "N1 N2" \*q +Specifies which buttons are mapped to motion in the X direction in wheel +emulation mode. Button number +.I N1 +is mapped to the negative X axis motion and button number +.I N2 +is mapped to the positive X axis motion. Default: no mapping. Property: +"EvdevMultitouch Wheel Emulation Axes". +.TP 7 +.BI "Option \*qYAxisMapping\*q \*q" "N1 N2" \*q +Specifies which buttons are mapped to motion in the Y direction in wheel +emulation mode. Button number +.I N1 +is mapped to the negative Y axis motion and button number +.I N2 +is mapped to the positive Y axis motion. Default: "4 5". Property: +"EvdevMultitouch Wheel Emulation Axes". + +.SH SUPPORTED PROPERTIES +The following properties are provided by the +.B evdevmultitouch +driver. +.TP 7 +.BI "EvdevMultitouch Axis Calibration" +4 32-bit values, order min-x, max-x, min-y, max-y or 0 values to disable +in-driver axis calibration. +.TP 7 +.BI "EvdevMultitouch Axis Inversion" +2 boolean values (8 bit, 0 or 1), order X, Y. 1 inverts the axis. +.TP 7 +.BI "EvdevMultitouch Axes Swap" +1 boolean value (8 bit, 0 or 1). 1 swaps x/y axes. +.TP 7 +.BI "EvdevMultitouch Drag Lock Buttons" +8-bit. Either 1 value or pairs of values. Value range 0-32, 0 disables a +value. +.TP 7 +.BI "EvdevMultitouch Middle Button Emulation" +1 boolean value (8 bit, 0 or 1). +.TP 7 +.BI "EvdevMultitouch Middle Button Timeout" +1 16-bit positive value. +.TP 7 +.BI "EvdevMultitouch Wheel Emulation" +1 boolean value (8 bit, 0 or 1). +.TP 7 +.BI "EvdevMultitouch Wheel Emulation Axes" +4 8-bit values, order X up, X down, Y up, Y down. 0 disables a value. +.TP 7 +.BI "EvdevMultitouch Wheel Emulation Button" +1 8-bit value, allowed range 0-32, 0 disables the button. +.TP 7 +.BI "EvdevMultitouch Wheel Emulation Inertia" +1 16-bit positive value. +.TP 7 +.BI "EvdevMultitouch Wheel Emulation Timeout" +1 16-bit positive value. + +.SH AUTHORS +Kristian Høgsberg. +.SH "SEE ALSO" +__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__), +README.mouse. diff --git a/packaging/xorg-x11-drv-evdev-multitouch.spec b/packaging/xorg-x11-drv-evdev-multitouch.spec new file mode 100644 index 0000000..5a99f83 --- /dev/null +++ b/packaging/xorg-x11-drv-evdev-multitouch.spec @@ -0,0 +1,64 @@ +#sbs-git:slp/pkgs/xorg/driver/xserver-xorg-input-evdev-multitouch xserver-xorg-input-evdev-multitouch 2.3.2 b89f300e6969a0b8cef3bbe5720ec5300baf4ad3 +Name: xorg-x11-drv-evdev-multitouch +Summary: X.Org evdev multitouch input driver. +Version: 2.3.2 +Release: 2 +Group: TO_BE/FILLED_IN +License: TO BE FILLED IN +Source0: %{name}-%{version}.tar.gz +BuildRequires: pkgconfig(xorg-macros) +BuildRequires: pkgconfig(xorg-server) +BuildRequires: pkgconfig(xproto) +BuildRequires: pkgconfig(randrproto) +BuildRequires: pkgconfig(inputproto) +BuildRequires: pkgconfig(kbproto) +BuildRequires: pkgconfig(resourceproto) +BuildRequires: pkgconfig(xkbfile) + +%description +X.Org X server -- evdev input multitouch driver This package provides the driver for input devices using evdev, the Linux + kernel's event delivery mechanism. This driver allows for multiple keyboards + and mice to be treated as separate input devices. + . + More information about X.Org can be found at: + + + + . + This package is built from the evdev multitouch driver module. + +%package devel +Summary: Development files for xorg evdev multitouch driver +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +This package contains xorg evdev multitouch development files + +%prep +%setup -q + +%build +export CFLAGS+=" -Wall -g -D_F_SUPPORT_PREFERRED_NAME_ -D_F_GESTURE_EXTENSION_ " + +%autogen --disable-static +%configure --disable-static +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}/usr/share/license +cp -af COPYING %{buildroot}/usr/share/license/%{name} +%make_install + + +%files +%defattr(-,root,root,-) +/usr/lib/xorg/modules/input/evdevmultitouch_drv.so +/usr/share/license/%{name} + +%files devel +%defattr(-,root,root,-) +/usr/include/xorg/evdevmultitouch-properties.h +/usr/lib/pkgconfig/xorg-evdev-multitouch.pc +/usr/share/man/man4/evdevmultitouch.4.gz diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..16bdf00 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,40 @@ +# Copyright 2005 Adam Jackson. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# on the rights to use, copy, modify, merge, publish, distribute, sub +# license, and/or sell copies of the Software, and to permit persons to whom +# the Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL +# ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +# this is obnoxious: +# -module lets us name the module exactly how we want +# -avoid-version prevents gratuitous .0.0.0 version numbers on the end +# _ladir passes a dummy rpath to libtool so the thing will actually link +# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. +AM_CFLAGS = $(XORG_CFLAGS) + +@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la +@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version +@DRIVER_NAME@_drv_ladir = @inputdir@ + +INCLUDES=-I$(top_srcdir)/include/ + +@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c \ + @DRIVER_NAME@.h \ + emuMB.c \ + emuWheel.c \ + draglock.c + diff --git a/src/draglock.c b/src/draglock.c new file mode 100755 index 0000000..c7a983d --- /dev/null +++ b/src/draglock.c @@ -0,0 +1,329 @@ +/* + * + * xserver-xorg-input-evdev-multitouch + * + * Contact: Sung-Jin Park + * Sangjin LEE + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + * Copyright 1993 by David Dawes + * Copyright 2002 by SuSE Linux AG, Author: Egbert Eich + * Copyright 1994-2002 by The XFree86 Project, Inc. + * Copyright 2002 by Paul Elliott + * (Ported from xf86-input-mouse, above copyrights taken from there) + * Copyright © 2008 University of South Australia + * Copyright 2008 by Chris Salch + * Copyright 2008 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of the authors + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. The authors make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +/* Draglock code */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#include +#include "evdevmultitouch.h" + +#ifdef HAVE_PROPERTIES +static Atom prop_dlock = 0; /* Drag lock buttons. */ +#endif + +void EvdevMultitouchDragLockLockButton(InputInfoPtr pInfo, unsigned int button); + + +/* Setup and configuration code */ +void +EvdevMultitouchDragLockPreInit(InputInfoPtr pInfo) +{ + EvdevMultitouchPtr pEvdevMultitouch = (EvdevMultitouchPtr)pInfo->private; + char *option_string = NULL; + int meta_button = 0; + int lock_button = 0; + char *next_num = NULL; + char *end_str = NULL; + BOOL pairs = FALSE; + + option_string = xf86CheckStrOption(pInfo->options, "DragLockButtons",NULL); + + if (!option_string) + return; + + next_num = option_string; + + /* Loop until we hit the end of our option string */ + while (next_num != NULL) { + lock_button = 0; + meta_button = strtol(next_num, &end_str, 10); + + /* check to see if we found anything */ + if (next_num != end_str) { + /* setup for the next number */ + next_num = end_str; + } else { + /* we have nothing more to parse, drop out of the loop */ + next_num = NULL; + } + + /* Check for a button to lock if we have a meta button */ + if (meta_button != 0 && next_num != NULL ) { + lock_button = strtol(next_num, &end_str, 10); + + /* check to see if we found anything */ + if (next_num != end_str) { + /* setup for the next number */ + next_num = end_str; + } else { + /* we have nothing more to parse, drop out of the loop */ + next_num = NULL; + } + } + + /* Ok, let the user know what we found on this look */ + if (meta_button != 0) { + if (lock_button == 0) { + if (!pairs) { + /* We only have a meta button */ + pEvdevMultitouch->dragLock.meta = meta_button; + + xf86Msg(X_CONFIG, "%s: DragLockButtons : " + "%i as meta\n", + pInfo->name, meta_button); + } else { + xf86Msg(X_ERROR, "%s: DragLockButtons : " + "Incomplete pair specifying button pairs %s\n", + pInfo->name, option_string); + } + } else { + + /* Do bounds checking to make sure we don't crash */ + if ((meta_button <= EVDEVMULTITOUCH_MAXBUTTONS) && (meta_button > 0 ) && + (lock_button <= EVDEVMULTITOUCH_MAXBUTTONS) && (lock_button >= 0)) { + + xf86Msg(X_CONFIG, "%s: DragLockButtons : %i -> %i\n", + pInfo->name, meta_button, lock_button); + + pEvdevMultitouch->dragLock.lock_pair[meta_button - 1] = lock_button; + pairs=TRUE; + } else { + /* Let the user know something was wrong + with this pair of buttons */ + xf86Msg(X_CONFIG, "%s: DragLockButtons : " + "Invalid button pair %i -> %i\n", + pInfo->name, meta_button, lock_button); + } + } + } else { + xf86Msg(X_ERROR, "%s: Found DragLockButtons " + "with invalid lock button string : '%s'\n", + pInfo->name, option_string); + + /* This should be the case anyhow, just make sure */ + next_num = NULL; + } + + /* Check for end of string, to avoid annoying error */ + if (next_num != NULL && *next_num == '\0') + next_num = NULL; + } +} + +/* Updates DragLock button state and fires button event messges */ +void +EvdevMultitouchDragLockLockButton(InputInfoPtr pInfo, unsigned int button) +{ + EvdevMultitouchPtr pEvdevMultitouch = (EvdevMultitouchPtr)pInfo->private; + BOOL state = 0; + + /* update button state */ + state = pEvdevMultitouch->dragLock.lock_state[button - 1] ? FALSE : TRUE; + pEvdevMultitouch->dragLock.lock_state[button - 1] = state; + + EvdevMultitouchQueueButtonEvent(pInfo, button, state); +} + +/* Filter button presses looking for either a meta button or the + * control of a button pair. + * + * @param button button number (1 for left, 3 for right) + * @param value TRUE if button press, FALSE if release + * + * @return TRUE if the event was swallowed here, FALSE otherwise. + */ +BOOL +EvdevMultitouchDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value) +{ + EvdevMultitouchPtr pEvdevMultitouch = (EvdevMultitouchPtr)pInfo->private; + + if (button == 0) + return FALSE; + + /* Do we have a single meta key or + several button pairings? */ + if (pEvdevMultitouch->dragLock.meta != 0) { + + if (pEvdevMultitouch->dragLock.meta == button) { + + /* setup up for button lock */ + if (value) + pEvdevMultitouch->dragLock.meta_state = TRUE; + + return TRUE; + } else if (pEvdevMultitouch->dragLock.meta_state) { /* waiting to lock */ + + pEvdevMultitouch->dragLock.meta_state = FALSE; + + EvdevMultitouchDragLockLockButton(pInfo, button); + + return TRUE; + } + } else if (pEvdevMultitouch->dragLock.lock_pair[button - 1] && value) { + /* A meta button in a meta/lock pair was pressed */ + EvdevMultitouchDragLockLockButton(pInfo, pEvdevMultitouch->dragLock.lock_pair[button - 1]); + return TRUE; + } + + /* Eat events for buttons that are locked */ + if (pEvdevMultitouch->dragLock.lock_state[button - 1]) + return TRUE; + + return FALSE; +} + +#ifdef HAVE_PROPERTIES +/** + * Set the drag lock property. + * If only one value is supplied, then this is used as the meta button. + * If more than one value is supplied, then each value is the drag lock button + * for the pair. 0 disables a pair. + * i.e. to set bt 3 to draglock button 1, supply 0,0,1 + */ +static int +EvdevMultitouchDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val, + BOOL checkonly) +{ + InputInfoPtr pInfo = dev->public.devicePrivate; + EvdevMultitouchPtr pEvdevMultitouch = pInfo->private; + + if (atom == prop_dlock) + { + int i; + + if (val->format != 8 || val->type != XA_INTEGER) + return BadMatch; + + /* Don't allow changes while a lock is active */ + if (pEvdevMultitouch->dragLock.meta) + { + if (pEvdevMultitouch->dragLock.meta_state) + return BadAccess; + } else + { + for (i = 0; i < EVDEVMULTITOUCH_MAXBUTTONS; i++) + if (pEvdevMultitouch->dragLock.lock_state[i]) + return BadValue; + } + + if (val->size == 0) + return BadMatch; + else if (val->size == 1) + { + int meta = *((CARD8*)val->data); + if (meta > EVDEVMULTITOUCH_MAXBUTTONS) + return BadValue; + + if (!checkonly) + { + pEvdevMultitouch->dragLock.meta = meta; + memset(pEvdevMultitouch->dragLock.lock_pair, 0, sizeof(pEvdevMultitouch->dragLock.lock_pair)); + } + } else if ((val->size % 2) == 0) + { + CARD8* vals = (CARD8*)val->data; + + for (i = 0; i < val->size && i < EVDEVMULTITOUCH_MAXBUTTONS; i++) + if (vals[i] > EVDEVMULTITOUCH_MAXBUTTONS) + return BadValue; + + if (!checkonly) + { + pEvdevMultitouch->dragLock.meta = 0; + memset(pEvdevMultitouch->dragLock.lock_pair, 0, sizeof(pEvdevMultitouch->dragLock.lock_pair)); + + for (i = 0; i < val->size && i < EVDEVMULTITOUCH_MAXBUTTONS; i += 2) + pEvdevMultitouch->dragLock.lock_pair[vals[i] - 1] = vals[i + 1]; + } + } else + return BadMatch; + } + + return Success; +} + +/** + * Initialise property for drag lock buttons setting. + */ +void +EvdevMultitouchDragLockInitProperty(DeviceIntPtr dev) +{ + InputInfoPtr pInfo = dev->public.devicePrivate; + EvdevMultitouchPtr pEvdevMultitouch = pInfo->private; + + if (!dev->button) /* don't init prop for keyboards */ + return; + + prop_dlock = MakeAtom(EVDEVMULTITOUCH_PROP_DRAGLOCK, strlen(EVDEVMULTITOUCH_PROP_DRAGLOCK), TRUE); + if (pEvdevMultitouch->dragLock.meta) + { + XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8, + PropModeReplace, 1, &pEvdevMultitouch->dragLock.meta, + FALSE); + } else { + int highest = 0; + int i; + CARD8 pair[EVDEVMULTITOUCH_MAXBUTTONS] = {0}; + + for (i = 0; i < EVDEVMULTITOUCH_MAXBUTTONS; i++) + { + if (pEvdevMultitouch->dragLock.lock_pair[i]) + highest = i; + pair[i] = pEvdevMultitouch->dragLock.lock_pair[i]; + } + + XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8, PropModeReplace, + highest + 1, pair, FALSE); + } + + XISetDevicePropertyDeletable(dev, prop_dlock, FALSE); + + XIRegisterPropertyHandler(dev, EvdevMultitouchDragLockSetProperty, NULL, NULL); +} + +#endif diff --git a/src/emuMB.c b/src/emuMB.c new file mode 100755 index 0000000..6d03e83 --- /dev/null +++ b/src/emuMB.c @@ -0,0 +1,429 @@ +/* + * + * xserver-xorg-input-evdev-multitouch + * + * Contact: Sung-Jin Park + * Sangjin LEE + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + * Copyright 1993 by David Dawes + * Copyright 2002 by SuSE Linux AG, Author: Egbert Eich + * Copyright 1994-2002 by The XFree86 Project, Inc. + * Copyright 2002 by Paul Elliott + * (Ported from xf86-input-mouse, above copyrights taken from there) + * Copyright © 2008 University of South Australia + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of the authors + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. The authors make no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied + * warranty. + * + * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +/* Middle mouse button emulation code. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#include +#include "evdevmultitouch.h" + +enum { + MBEMU_DISABLED = 0, + MBEMU_ENABLED, + MBEMU_AUTO +}; + +#ifdef HAVE_PROPERTIES +static Atom prop_mbemu = 0; /* Middle button emulation on/off property */ +static Atom prop_mbtimeout = 0; /* Middle button timeout property */ +#endif +/* + * Lets create a simple finite-state machine for 3 button emulation: + * + * We track buttons 1 and 3 (left and right). There are 11 states: + * 0 ground - initial state + * 1 delayed left - left pressed, waiting for right + * 2 delayed right - right pressed, waiting for left + * 3 pressed middle - right and left pressed, emulated middle sent + * 4 pressed left - left pressed and sent + * 5 pressed right - right pressed and sent + * 6 released left - left released after emulated middle + * 7 released right - right released after emulated middle + * 8 repressed left - left pressed after released left + * 9 repressed right - right pressed after released right + * 10 pressed both - both pressed, not emulating middle + * + * At each state, we need handlers for the following events + * 0: no buttons down + * 1: left button down + * 2: right button down + * 3: both buttons down + * 4: emulate3Timeout passed without a button change + * Note that button events are not deltas, they are the set of buttons being + * pressed now. It's possible (ie, mouse hardware does it) to go from (eg) + * left down to right down without anything in between, so all cases must be + * handled. + * + * a handler consists of three values: + * 0: action1 + * 1: action2 + * 2: new emulation state + * + * action > 0: ButtonPress + * action = 0: nothing + * action < 0: ButtonRelease + * + * The comment preceeding each section is the current emulation state. + * The comments to the right are of the form + *