Commit Graph

1339 Commits

Author SHA1 Message Date
Peter Hutterer
7ccca8e7d8 Don't allow for scroll distances of 0 (#49965)
It'll either hang the server or blow up with divisions by 0, whichever one
comes first.

X.Org Bug 49965 <http://bugs.freedesktop.org/show_bug.cgi?id=49965>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit 6d47d334d8)
2012-05-18 09:20:18 +10:00
Peter Hutterer
f8d970e191 Reset hw->x/y to INT_MIN and skip HandleState until we have x/y events
The driver assumes x/y is always valid but after coming from a resume we may
get a few events with either ABS_X or ABS_Y (not both). Thus we process with
hw->x == 0 and hw->y == somevalue, causing cursor jumps when calculating
deltas whenver the real hw->x comes in.

Fix this by resetting hw->x/y to INT_MIN and skip state processing until
both axes are available.

For clickpads, this means handling of data will be delayed until we get
at least one motion on each axis. Button presses won't be recognised either
until that happens. It requires some skill to not trigger motion on both
axes, even more to press a button without doing so.

For non-clickpads, handling of motion events will be delayed likewise. If a
physical button is pressed immediately after resume we have to assume deltas
of x/y.
- If the next event is a new touch, it will have ABS_X/ABS_Y set anyway
- If the finger was already down, a button event is generated, and the
  finger has generated ABS_X or ABS_Y only before the event, the next event
  containing the missing data will cause a jump. The fix for this is more
  invasive and this is quite a corner-case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit cd569377cd)
2012-05-18 09:20:16 +10:00
Chase Douglas
739175d198 Reset open slots array on device disable
The open slots array is used for clickpad cumulative delta computation.
If the array is not reset and becomes corrupted during the device
disable/enable cycle, the cumulative deltas may be wrong. This manifests
as jumpy cursor behavior on some clickpads after suspend/resume.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 0054b144f3)
2012-05-17 09:56:53 +10:00
Chun Yang
67a02d676c Fix coasting for negative ScrollDelta
Fix the coasting direction for when VertScrollDelta or HorizScrollDelta is
negative.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=49966

Regression introduced in 0de4445ff8

Signed-off-by: Chun Yang <Chuck.Yang@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 53557a5cab)
2012-05-16 11:52:35 +10:00
Chase Douglas
23e87b57bb Ignore pre-existing touches
If a touch is physically active when the device is enabled, then all
events for that touch must be ignored. In particular, we cannot close
the touch or we will decrement touch count counters below zero. If these
counters go below zero memory corruption can occur.

Note that a device is disabled and enabled every time the user types on
the keyboard if synclient is used to disable the trackpad while typing.
This is a very common option.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 55fc42e7c9)
2012-05-16 11:52:35 +10:00
Peter Hutterer
23065a974e Avoid out-of-bounds access by running num_active_touches < 0 (#49439)
If a touch is active during driver init, the slot will be set to
SLOTSTATE_CLOSE when it finishes. That could decrease num_active_touches to
less than 0, causing out-of-bounds access.

X.Org Bug 49439 <http://bugs.freedesktop.org/show_bug.cgi?id=49439>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit 77d766b1d5)
2012-05-16 11:52:35 +10:00
Peter Hutterer
e0f5688994 synaptics 1.6.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
xf86-input-synaptics-1.6.1
2012-05-11 11:20:14 +10:00
Peter Hutterer
7f2d9d8820 tools: coasting speed is not capped at 20, cap it at 255
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 0352c67fa2)
2012-05-11 11:20:14 +10:00
Peter Hutterer
ace20a02c3 Fix coasting speed trigger
CoastingSpeed is defined as scrolls/s. The previous code just used
delta/seconds which depended on the device coordinate range and exceeded the
default CoastingSpeed at almost any scroll event.

Divide the estimated delta by the scroll distance to get the accurate
scrolls/s number. Since that now changes the contents of what's in
coast_speed_y, change the users of that too.

http://bugzilla.redhat.com/813686

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 0de4445ff8)
2012-05-11 10:39:13 +10:00
Peter Hutterer
04d24116db Don't check for soft buttons if a button is already down
Moving into a different soft button's area during drag-n-drop would trigger
a click of that button.

We only have the current button state and we mess with it, so the conditions
for a possible clickpad soft-button event are:
- hw->left is down now
- none of left|right|middle were down before. since we change hw->left to
  hw->right/left we need to check all three

If hw->left is down but one of the other buttons was already down, copy that
button state and continue.

http://bugzilla.redhat.com/819348

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
(cherry picked from commit a1d6784d79)
2012-05-11 10:27:58 +10:00
Peter Hutterer
4e8ddb3a6f whitespace fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-10 09:21:19 +10:00
Peter Hutterer
d1eebac72e tools: undo indentation in synclient's parameter list
more more readable this way

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-10 09:21:14 +10:00
Peter Hutterer
0434d77766 Indent consistently
x-indent-all.sh from xorg/util/modular as of
c2d630fab65dbe3409af3947f6f442782ddb026f

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-10 09:21:10 +10:00
Peter Hutterer
a1162f8032 synaptics 1.6.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
xf86-input-synaptics-1.6.0
2012-05-03 08:06:32 +10:00
Peter Hutterer
52e194b76c Fix coasting for negative scroll directions
1874094f0e introduced negative scroll
directions. Coasting assumed always-positive increments and triggered an
endless scrolling loop.

Reported-by: Matthias Clasen <mclasen@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-03 08:05:29 +10:00
Peter Hutterer
6f086b86e4 Fail if no backends can be found
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-02 10:45:00 +10:00
Niveditha Rau
655d3100fc Include a build for solaris
Signed-off-by: Niveditha Rau <niveditha.rau@oracle.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-05-02 10:45:00 +10:00
Peter Hutterer
d13e83b921 Force SLOTSTATE_EMPTY on DeviceOff
SLOTSTATE_OPEN_EMPTY on resume leads to erroneously detected touches.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-02 10:44:55 +10:00
Peter Hutterer
cc595bd323 Reset all hardware state on DEVICE_OFF (#49161)
Reset all state on DeviceOff to avoid stuck buttons on resume.

X.Org Bug 49161 <http://bugs.freedesktop.org/show_bug.cgi?id=49161>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-05-01 12:41:09 +10:00
Peter Hutterer
e19fff64f7 man: fix hyphenation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-30 09:30:53 +10:00
Peter Hutterer
3cc828b476 man: drop mention of shm configuration
SHM is for debugging only now, not configuration.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-30 09:28:39 +10:00
Peter Hutterer
085662e9fe synaptics 1.5.99.904
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
xf86-input-synaptics-1.5.99.904
2012-04-27 09:20:56 +10:00
Peter Hutterer
58581bfbec Reset scroll delta when no finger is touching
Provides for a more consistent scrolling experience, otherwise delta
leftovers may trigger extra events even when the actual scrolling action
stays the same.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-04-26 16:22:37 +10:00
Peter Hutterer
1a76d9f00e Don't unconditionally divide by scroll_dist_vert (#46617)
Regression introduced in cddab79c40.

If an event has a delta of less than scroll_dist_vert, the delta is
unconditionally divided by the distance, leaving some remainder close to 0
and never actually triggering the scroll amount.

Fix this by working with the increment, not the normalised values.

X.Org Bug 46617 <http://bugs.freedesktop.org/show_bug.cgi?id=46617>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-04-26 16:13:41 +10:00
Peter Hutterer
ba31b09ba8 ClickPad is most definitely a bool option.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-04-26 12:56:35 +10:00
Peter Hutterer
f0c2f1d82a Init num_touches to 0 on start
We implicitly rely on this already since we calloc the struct. Do it
expliclity on DeviceOn().

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-04-26 12:54:08 +10:00
Peter Hutterer
9ecf505c64 Reset touch state on DeviceOff (#49161)
Don't leave touches lingering around during suspend.

Test case:
1) leave finger on touchpad
2) xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0
3) lift fingers
4) xinput set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1

X.Org Bug 49161 <http://bugs.freedesktop.org/show_bug.cgi?id=49161>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-04-26 10:29:38 +10:00
Chase Douglas
f300adb027 Update src/synproto.c license to the preferred MIT/X11 license
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-24 10:26:04 +10:00
Peter Hutterer
5a176dc23d Don't release the button on TS_3 if TapAndDrag is disabled (#31854)
TS_3 is second tap down. Unconditionally set the button as down, later, in
HandleTapProcessing we have the required conditions to reset it to TS_START
and TBS_BUTTON_UP.

Meanwhile, TBS_BUTTON_DOWN stays down, so the second tap is counted and sent
as button event. This restores double-tapping if TapAndDrag is disabled.

X.Org Bug 31854 <http://bugs.freedesktop.org/show_bug.cgi?id=31854>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-20 11:13:16 +10:00
Peter Hutterer
0322d30184 Print millis as unsigned int
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-20 11:12:58 +10:00
Peter Hutterer
3822d58777 Ensure hw millis are monotonic (#48777)
The eventcomm backend takes the timestamp from the kernel, but the timer
uses the timer's "now". This timestamp may be later than the one from the
next event we read from the kernel, causing a negative dtime in get_delta()
and a cursor jump by (unsigned int)-1.

Ensure that the new event's timestamp is at least the last used one.

X.Org Bug 48777 <http://bugs.freedesktop.org/show_bug.cgi?id=48777>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Gavin Troy <gavtroy@gmail.com>
2012-04-20 09:23:11 +10:00
Peter Hutterer
11d8929647 man: move ClickPad documentation into a single area
Having to read only one section is a tad easier than collecting the separate
options.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-04-19 08:07:19 +10:00
Chow Loong Jin
1c155f6448 Fix coasting friction
As a result of commit 5a1612d449, coasting speed
was bumped up to a different scale by removing the divisor during the
calculation of initial coasting speed. This caused coasting friction to have
little to no effect, resulting in coasting that lasted virtually forever using
the default coasting friction value of 50.

This patch multiplies the scroll_dist_{horiz,vert} which was previously used as
a divisor for initial coasting speed to the coasting friction before deducting
it at each step, thus bringing coasting friction back under control.

Signed-off-by: Chow Loong Jin <hyperair@debian.org>
Tested-by: <Magnus.Kessler@gmx.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-17 13:33:13 +10:00
Pierre Lulé
50124d3ddf Stop coasting when two-finger scroll begins
There is currently a problem that can lead the coasting to continue while scrolling in a particular situation :
with
 Option "VertTwoFingerScroll" "on"
 Option "CornerCoasting" "0"
 Option "CoastingSpeed" "10"
 Option "CoastingFriction" "50"
 Option "CornerCoasting" "0"
If you scroll down with two finger then raise a finger, coasting will start. But if you put down that finger and try to
scroll up, the inertia will still scroll down while you scroll up. This can look like a very particular situation, but
happens to me often while scrolling in a big document.

This (awfully simple) patch stop coasting when detecting two-finger scroll.

Signed-off-by: Pierre Lulé <pierre@lule.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-17 13:31:53 +10:00
Peter Hutterer
d90003383c synaptics 1.5.99.903
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
xf86-input-synaptics-1.5.99.903
2012-04-16 16:47:38 +10:00
Alyssa Hung
1874094f0e Support inverted scroll direction.
This patch allows scroll direction to be inverted by allowing
VertScrollDelta and HorizScrollDelta to be set to negative values. This
enables behaviour that is consistent with modern touchscreen devices,
where the content scrolls in the same direction as the user's finger
movement.

Signed-off-by: Alyssa Hung <ahung@isisview.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-16 11:44:14 +10:00
Chase Douglas
38b93b71c8 Use maximum number of touches reported by evdev
This resolves a regression from da461b9165
where three touch tap and click actions on certain devices no longer
work.

Some devices report a higher touch count than the number of touches they
can provide data for. For example, many Synaptics touchpads can report
up to five touches, but only provide data for two of them. We need to be
able to report the correct number of touches for these devices when
there are three touches. Using the maximum of the reported touch count
and the number of touches provided ensures the count is accurate for all
device types.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-13 13:40:54 +10:00
Pierre Lulé
5a1612d449 Fix coasting speed
Fixes a bug introduced in commit 2603ad69b9
(Use the scroll distances as increment for scrolling valuator axes)

Since this commit, scroll distance was set with SetScrollValuator function
but it was still used as a divisor to calculate coasting,
thus making coasting too slow. (at least on my computer)

Deleting the divisor fixes the issue.

A report of the same bug : https://bugs.archlinux.org/task/28955

Signed-off-by: Pierre Lulé <pierre@lule.fr>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-13 13:27:46 +10:00
Peter Hutterer
f68ddd9be4 Don't count fingers twice when guessing distance (#48316)
A finger may be closer than the required distance to more than one finger.
e.g. for fingers A, B, C, AB, AC and BC may trigger the check and count
C twice -resulting in a 4 finger click.

Avoid double-counting by marking those fingers already close enough to a
previous finger to avoid overcounting.

X.Org Bug 48316 <http://bugs.freedesktop.org/show_bug.cgi?id=48316>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-04-13 08:26:28 +10:00
Peter Hutterer
c745604461 tools: skip non-existing properties
If a property doesn't exist on a device, skip it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-04-11 11:10:06 +10:00
Peter Hutterer
8e297cb586 Replace hardcoded max number of touches with a define.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-04-11 07:52:58 +10:00
Chase Douglas
3f9794a8a0 Check touch record bounds before access
We guess ten simultaneous touches if the device does not tell us. The
Linux drivers for the Apple multitouch trackpads do not tell the number
of simultaneous touches, but they can do more than ten. When this
occurs, the array index into the touch records will be invalid. We must
not process the touch or else we will segfault.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-10 11:16:07 +10:00
Chase Douglas
4c87455f3e Do not perform a tap action when more than three touches
Though this looks like a behavior change, it really isn't since the
maximum tap_max_fingers that was previously possible was already handled.
The only real change is that if a tap is recognized but the
tap_max_fingers is zero, a tap will no longer be emitted. This shouldn't
happen in the real world.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-26 11:58:40 +10:00
Chase Douglas
da461b9165 Count number of multitouch touches for multitouch finger count
The evdev protocol only goes up to three touches for non-multitouch
devices. If you perform a four touch tap, the finger count will only go
up to three touches if you roll your fingers, or will always be 0 if all
four touches land at the same time.

This change ensures the correct finger count is reported.

Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-26 11:58:09 +10:00
Peter Hutterer
bc95d90be1 Define various EVIOCGPROP bits if non-existent
And make the ioctl conditional.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-26 07:43:04 +10:00
Peter Hutterer
291fdc6980 conf: the bcm5974 doesn't have Apple in the product name
But it's still a single-button device from the known fruit manufacturer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-24 19:51:36 +10:00
Peter Hutterer
4a80c0dc38 synaptics 1.5.99.902
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
xf86-input-synaptics-1.5.99.902
2012-03-23 10:38:20 +10:00
Peter Hutterer
b6779458bc conf: enable right-button click by default on non-Apple clickpads
The right-half of the bottom 18% of the touchpad are enabled as right button
by default. On Apple touchpads (these don't have marking for the right
button) disable them by default.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-23 08:31:46 +10:00
Peter Hutterer
c9cf8827b1 use xf86SetStrOption for SoftButtonAreas
This way the option is reported in the log when parsed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-23 08:26:50 +10:00
Peter Hutterer
cea97dd5e0 Allow soft button areas to be specified in % of the touchpad
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-22 14:51:10 +10:00