summaryrefslogtreecommitdiff
path: root/src/synaptics.c
AgeCommit message (Collapse)Author
2012-05-03Fix coasting for negative scroll directionsPeter Hutterer
1874094f0e99d8db319f6cf769ce5a25c9bc490c 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-02Force SLOTSTATE_EMPTY on DeviceOffPeter Hutterer
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-01Reset all hardware state on DEVICE_OFF (#49161)Peter Hutterer
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-04-26Reset scroll delta when no finger is touchingPeter Hutterer
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-26Don't unconditionally divide by scroll_dist_vert (#46617)Peter Hutterer
Regression introduced in cddab79c408db3b13905a2be72aff4f7bf1406f8. 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-26ClickPad is most definitely a bool option.Peter Hutterer
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-04-26Reset touch state on DeviceOff (#49161)Peter Hutterer
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-20Don't release the button on TS_3 if TapAndDrag is disabled (#31854)Peter Hutterer
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-20Print millis as unsigned intPeter Hutterer
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-04-20Ensure hw millis are monotonic (#48777)Peter Hutterer
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-17Fix coasting frictionChow Loong Jin
As a result of commit 5a1612d4496b51682c9043aa064025c545249de6, 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-17Stop coasting when two-finger scroll beginsPierre Lulé
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-16Support inverted scroll direction.Alyssa Hung
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-13Fix coasting speedPierre Lulé
Fixes a bug introduced in commit 2603ad69b997c999404ecc441e0d64ea2cc22018 (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-13Don't count fingers twice when guessing distance (#48316)Peter Hutterer
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-11Replace hardcoded max number of touches with a define.Peter Hutterer
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-26Do not perform a tap action when more than three touchesChase Douglas
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-23use xf86SetStrOption for SoftButtonAreasPeter Hutterer
This way the option is reported in the log when parsed. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-22Allow soft button areas to be specified in % of the touchpadPeter Hutterer
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-22Include open but unchanged touches when guessing clickfingersChase Douglas
On a clickpad, when the button is pressed the clickfinger guessing will only work properly if all touches have new data to report. If a touch has not changed, then it will not be counted. This leads to inaccurate finger counts. This change ensures that all active touches are counted. Note that the X and Y valuators of active but unchanged touches are still valid. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-22Fix clickfinger actions when buttons other than 1 are reportedChase Douglas
The "old" logical state now holds the clickfinger action button. In order to check for proper clickpad press transition, we need to check if any of the left, middle, and right logical button states are pressed. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-22Fix clickfinger actions when middle button emulation is enabledChase Douglas
When MBE is enabled, a physical left button press is delayed until a timeout is reached. This results in the logical left button being depressed while the physical left button is pressed. The physical state is stored as the "old" hw state, and it is used for detecting a transition from depressed to pressed for clickfinger actions. Since the "old" hw state shows the left button pressed, but the current logical state shows the left button unpressed, when the MBE timeout fires and we set the logical left button pressed the transition check fails. Since the "old" hw state is only used for clickfinger left button press transitions, redefining it to hold the previous logical hw state is sufficient for fixing the bug and should not cause any regressions. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-20Fix inverted circular scrolling directionPeter Hutterer
Introduced in 26831a6eeac6762ad4d99532f62ebbab0827de10. In said commit, the old-style button events were changed to delta accumulation. Alas, for circular scrolling, a positive delta is up whereas for everything else a positive delta is down. Reported-by: Thomas Bächler <thomas@archlinux.org> Tested-by: Thomas Bächler <thomas@archlinux.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-14Soft buttons are only available on clickpad devices, disable them otherwise.Peter Hutterer
If the clickpad support is runtime enabled/disabled, the property appears/disappears accordingly. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-14Ignore motion during touch count changes on semi-mt devicesChase Douglas
Semi-mt devices do not track touches. The locations of touches are unknown, we only have the bounding box of two of them. When the number of fingers changes, the bounding box coordinates may change as well, but the cumulative relative motion updates at that instant are invalid. To work around this, ignore changes in cumulative relative motion if the touch count changes. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-14Add soft button areas propertyChase Douglas
Some clickpad devices have button areas painted on them. Set this property to the area of the right and middle buttons to enable proper click actions when clicking in the areas. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-14Calculate touch data for semi-mt devices, but don't send touch eventsChase Douglas
Previously, all touch data from semi-mt devices was ignored because the X server doesn't support them. However, the touch data must be used for proper clickpad handling. Instead of ignoring semi-mt device touch events, mark the device as being semi-mt and allow initialization of the touch state. The touches will then be used in calculating the cumulative_d{x,y} values that are needed for clickpad support. When handling the touch data for X event processing, simply skip over reporting the touches. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-14Disable scrolling when beginning a clickpad pressChase Douglas
There really isn't a point to scrolling while a clickpad is pressed. In particular, the clickpad button areas and the horizontal edge scrolling areas overlap, so horizontal edge scrolling must be disabled. Also, performing two finger scrolling while a third finger presses the button would require us to inhibit touch events until four touches are present. That is enough reason to disable two finger scrolling as well. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-14Enable clickpad click and drag with two fingersChase Douglas
Use cumulative relative touch motion when the clickpad is pressed. If more than one touch is active, assume one of the touches is designated solely for pressing the clickpad button. Thus, decrement the number of reported touches. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-14Guess the number of clickpad ClickFingers based on finger distancePeter Hutterer
The actual distance should be done in cm, based on touchpad resolution etc. That is left as an exercise for the reader. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-14Disable middle mouse button emulation on clickpadsPeter Hutterer
Because, well, really, how? Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-14Add clickpad device propertyChase Douglas
Add it as a writable device property. We may not know how to probe some clickpads so allow the user to override it. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-14Add a BTN_EMULATED_FLAG to mark emulated buttons on clickfingersPeter Hutterer
And when copying the hardware state, don't copy those buttons that were set through emulation. This is a temporary fix only, we should add new fields to the hw struct that represent the various features as they are enabled/disabled and then treat them accordingly. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-14Only handle ClickFingers on left button press eventsPeter Hutterer
ClickFingers doesn't need to be handled on every state, only when the actual button state changes. This is a break from the previous behaviour which allowed pressing the button followed by a two-finger tap to trigger the ClickFinger2 action. Let's see if anyone complains. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-14Add an old_hw_state field to remember the last valuesPeter Hutterer
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-14Move resetting hw state to separate function.Peter Hutterer
No functional changes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-14Move filtering into a separate functionPeter Hutterer
No functional changes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-14If the middle button timeout is 0, don't even attempt to emulate.Peter Hutterer
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-13Don't use linear regression when calculating touchpad motion deltasChase Douglas
The results depend on the data rate of the device. A device with a higher data rate, and thus lower individual deltas, will behave differently with the regression calculation. This can be verified on Synaptics semi-mt clickpads. The data rate is halved when two or more touches are on the device. When trying to press a button and drag the cursor with another touch, the motion will feel faster than dragging with only one touch on the device. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-03-09Fix horiz/vert scroll delta mixupPeter Hutterer
No effect as both have the same value anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-05Implement a workaround for Elantech touchpadsPeter Zotov
All Elantech touchpads report the number of fingers explicitly, and at least the v3 version of the hardware can report any pressure values down to zero. This interferes with the tap detection hysteresis, which is required for dumb touchpads. This commit implements a vendor-specific workaround for Elantech touchpads which sets the FingerLow and FingerHigh options to 1 by default, effectively disabling the hysteresis mechanism. Signed-off-by: Peter Zotov <whitequark@whitequark.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2012-03-05Fix scoll increment for non-smooth scrolling (#46617)Peter Hutterer
Introduced in 2603ad69b997c999404ecc441e0d64ea2cc22018. Previously, the delta was incremented by (actual delta/scroll dist), button clicks where then sent while (delta-- >= 1). After 2603ad69b997c999404ecc441e0d64ea2cc22018, the delta was incremented by the delta only, scroll dist was used as increment in the smooth scrolling information. On non-smooth-scrolling servers, the driver would now send too many events. Restore the old behaviour by dividing by the scroll distance before entering the button click loop. X.Org Bug 46617 <http://bugs.freedesktop.org/show_bug.cgi?id=46617> Tested-by: Peter Zotov <whitequark@whitequark.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-23Update touch state when device is off tooChase Douglas
If the device is turned off, usually by syndaemon to disable the touchpad while the typing, the touch state will not be updated with the latest hardware state changes. If a touch begins while the device is off and ends while the device is on, then the touch count will be decremented without any previous increment. A similar effect will occur if the device is on when the touch begins, but off when the touch ends. If the touch count goes negative, the index into the touch slot mask array will be out of bounds. This can corrupt memory and cause random crashes. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-02-21Revert "Don't store fake events in the motion history"Peter Hutterer
This commit introduced a regression. On some touchpads, the pointer keeps moving in the last direction when the finger movement stops but the finger is left on the touchpad. Cause appears to be get_delta() which calculates the deltas based on the motion history but has no control flow for the lack of fake motion events in the history after this commit. Thus, under some conditions, the delta is always non-zero as the history does not change. Reproducer attached to bug https://bugs.freedesktop.org/show_bug.cgi?id=45278#c11 X.Org Bug 45278 <http://bugs.freedesktop.org/show_bug.cgi?id=45278> This reverts commit c8b098214b44cf0585d78c460401ea7d143769f3. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Acked-by: Daniel Stone <daniel@fooishbar.org>
2012-02-11Filter touch events if two-finger scrolling is enabledChase Douglas
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-02-11Filter touch events if tap actions are enabledChase Douglas
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-02-11Filter touch events if click actions are enabledChase Douglas
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-02-11Move X touch event processing into synaptics.cChase Douglas
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-02-11Add open_slots array to SynapticsPrivateChase Douglas
Initialize touch stuff in a separate function for readability. 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-02-11Add touch valuator mask to hw state structureChase Douglas
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>