summaryrefslogtreecommitdiff
path: root/src/evdev-mt-touchpad-gestures.c
Commit message (Collapse)AuthorAgeFilesLines
* touchpad: drop thumb handling from gesturesPeter Hutterer2015-07-161-19/+0
| | | | | | | | | | | Thumb detection interfered with gestures a fair bit but it shouldn't. A pinch gesture with a thumb is a fairly natural move so we shouldn't cancel that. A swipe gesture with a thumb on the touchpad - well, don't do that. No need for code here. Reported-by: Carlos Garnacho <carlosg@gnome.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
* touchpad: add gesture state debug helperPeter Hutterer2015-07-131-0/+21
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* touchpad: add pressure-based thumb-detectionPeter Hutterer2015-07-091-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | All touchpad recordings seen so far show that a value above 100 is definitely a thumb or a palm. Values below are harder to discern, and the same isn't true for touchpads supporting ABS_PRESSURE instead of ABS_MT_PRESSURE. The handling of a touch is as outlined in tp_thumb_detect: * thumbs are ignored for pointer motion * thumbs cancel gestures * thumbs are ignored for clickfinger count * edge scrolling doesn't care either way * software buttons don't care either way * tap: only if thumb on begin The handling of thumbs while tapping is the simplest approach only, more to come in follow-up patches. Note that "thumb" is the synonym for "this touch is too big to be a fingertip". Which means that a light thumb touch will still be counted as a finger. The side-effect here is that thumbs resting a the bottom edge of the touchpad will almost certainly not trigger the pressure threshold because most of the thumb is off the touchpad. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* gestures: check for valid types on the gesture event APIPeter Hutterer2015-07-061-1/+2
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* touchpad: split tp_gesture_stop into stop and cancelPeter Hutterer2015-07-061-5/+17
| | | | | | No functional changes Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* touchpad: Allow querying whether a gesture ended normally or was cancelledHans de Goede2015-07-061-12/+8
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* touchpad: Implement pinch gesture supportHans de Goede2015-07-061-8/+276
| | | | | | | | | | | Implement touchpad pinch (and rotate) gesture support. Note that two two-finger scrolling tests are slightly tweaked to assure that there is enough touch movement to allow the scroll-or-pinch detect code to do its work. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
* touchpad: Add support for swipe gesturesHans de Goede2015-07-061-0/+39
| | | | | | | | Add support for swipe gestures. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
* Drop motion normalization of unaccelerated deltasPeter Hutterer2015-07-021-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simply doesn't work for low-dpi mice. Normalizing a 400dpi mouse to a 1000dpi mouse forces a minimum movement of 2.5 units and the resulting pixel jumps. It is impossible for the caller to detect whether the jump was caused by a single motion or multiple motion events. This is technically an API break, but not really. The accelerated data was already relatively meaningless, even if normalized as the data did not correspond predictably to any input motion (unless you know the implementation acceleration function in the caller). So we can drop the mention from there without expecting any ill effects in the caller. The unaccelerated data was useless for low-dpi mice and could only be used to measure the physical distance of the mouse movement - something not used in any caller we're aware of (if needed, we can add that functionality as a separate call). Dropping motion normalization for unaccelerated deltas also restores true dpi capabilities to users of that API, mostly games that want to make use of high-dpi mice. This is a simplified patch, the normalization is still in place for most of libinput, it merely carries the original coordinates in the event itself. In the case of touchpads, the coordinates are unnormalized into the x-axis coordinate space as per the documentation. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* COPYING: Update boilerplate from MIT X11 to MIT Expat licensePeter Hutterer2015-06-161-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | To quote Bryce Harrington from [1]: "MIT has released software under several slightly different licenses, including the old 'X11 License' or 'MIT License'. Some code under this license was in fact included in X.org's Xserver in the past. However, X.org now prefers the MIT Expat License as the standard (which, confusingly, is also referred to as the 'MIT License'). See http://cgit.freedesktop.org/xorg/xserver/tree/COPYING When Wayland started, it was Kristian Høgsberg's intent to license it compatibly with X.org. "I wanted Wayland to be usable (license-wise) whereever X was usable." But, the text of the older X11 License was taken for Wayland, rather than X11's current standard. This patch corrects this by swapping in the intended text." libinput is a fork of weston and thus inherited the original license intent and the license boilerplate itself. See this thread on wayland-devel here for a discussion: http://lists.freedesktop.org/archives/wayland-devel/2015-May/022301.html [1] http://lists.freedesktop.org/archives/wayland-devel/2015-June/022552.html Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com> Acked-by: Jonas Ådahl <jadahl@gmail.com>
* touchpad: Only use slot 0 deltas for 2fg scrolling on semi-mt touchpadsHans de Goede2015-04-271-1/+11
| | | | | | | | | | | | | | | | | | | | | Some semi-mt model touchpads have a better accuracy for slot 0 then for slot 1 (they only have 2), so on semi-mt models only use the movement of the touch in slot 0 for 2fg scrolling, rather then the average movement of the 2 touches. This fixes 2fg scrolling being choppy / jumpy in some cases. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=89683 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Also needed: change the touchpad scroll source test to use more separate events. The current litest semi-mt touch implementation only moves the first touch on every second move. With 5 movements this isn't enough to fill the motion history and generate events, so double it to 10 so we're guaranteed to get scroll events. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* touchpad: don't post 2fg scrolling when edge scrolling is enabledPeter Hutterer2015-04-211-0/+6
| | | | | | | https://bugs.freedesktop.org/show_bug.cgi?id=90070 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* touchpad: rename real_touches to num_slotsPeter Hutterer2015-04-091-1/+1
| | | | | | | | | Less ambiguous since real_touches can be interpreted to "current number of real touches as opposed to fake touches". Which it isn't, this variable holds the number of slots. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* Change tp_filter_motion to normalized_coordsHans de Goede2015-03-251-4/+4
| | | | | | | | Change tp_filter_motion to use normalized_coords, rather then having it take separate x and y values. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* Add a normalized_is_zero helper functionHans de Goede2015-03-251-3/+2
| | | | | | | Add a normalized_is_zero helper function, and use it where applicable. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* Use typesafe coords in motion eventsPeter Hutterer2015-03-171-6/+4
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* Use typesafe coordinates for scrolling eventsPeter Hutterer2015-03-171-1/+1
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* touchpad: switch delta handling to typesafe coordinatesPeter Hutterer2015-03-171-29/+31
| | | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
* touchpad: Refactor tp_get_*_touches_deltaHans de Goede2015-02-231-16/+9
| | | | | | | | The two tp_get_*_touches_delta functions are almost identical, refactor them into one function. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* touchpad: Do not use fake touches when getting the average touches deltaHans de Goede2015-02-231-2/+4
| | | | | | | | Only look at real touches when getting the average touches delta, otherwise the touch used to populate the fake touches gets an unfair weighing factor. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* touchpad: Move gesture handling code to evdev-mt-touchpad-gestures.cHans de Goede2015-02-231-1/+93
| | | | | | | Just moving some code around, no functional changes. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
* touchpad: Gesture support preparationHans de Goede2015-02-231-0/+146
Handle everything which is not handled by the tap, (soft)button or edge-scroll code/statemachines in a unified way. Everything is treated as a X-finger gesture now, and the action to take on finger movement is decided by the gesture.finger_count setting. Pointer control now simply is seen as a 1 finger gesture, and 2fg scrolling as a 2fg gesture. This removed the need for special-casing things like switching back to pointer mode when lifting a finger in 2fg scrolling mode, and also lays the groundwork for adding 3+ fg gesture support. Note that 1 test-case needs to be updated to wait for the finger mode switching when switching mode while a gesture has already been started. This is actually an improvement as this stops sending spurious pointer motion events at the end of 2fg scrolling when not lifting both fingers at exactly the same time. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>