summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2019-07-17touchpad: stricter thumb detection if no pressure/sizeMatt Mayfield1-1/+3
2019-07-17touchpad: don't detect speed-based thumbs if there's already a thumbMatt Mayfield1-1/+2
2019-07-17touchpad: revamp thumb detectionMatt Mayfield5-137/+265
Instead of a simple yes/no/maybe for thumbs, have a more extensive state machine that keeps track of the thumb. Since we only support one thumb anyway, the tracking moves to the tp_dispatch struct. Test case changes: touchpad_clickfinger_3fg_tool_position: with better thumb detection we can now handle this properly and expect a right button (2fg) press for the test case touchpad_thumb_no_doublethumb_with_timeout: two thumbs are now always two fingers, so let's switch to axis events here Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15test: only run the speed finger tests when the touchpad has thumb detectionPeter Hutterer1-1/+1
2019-07-15touchpad: only log edge scroll state changes when the state actually changesPeter Hutterer1-6/+7
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15touchpad: add a helper function for supressing a thumbPeter Hutterer3-2/+11
Only sets the state to YES at the moment, will do more in the future. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15gestures: Improve thumb detection, allow one finger scrollMatt Mayfield1-20/+39
Check if there's a thumb if we have two touches. If one finger moves but the thumb remains still, we assume that one is really a thumb. But if the thumb moves while the finger is still, let's assume this is a 2-finger scroll. Extracted from Matt Mayfield's thumb detection patchset
2019-07-15gestures: fast-track scroll/swipe detection when gestures are offPeter Hutterer1-2/+3
We can't detect pinch when gestures are off anyway, so we don't need to check the finger distances. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15gestures: improvements to pinch detectionMatt Mayfield1-5/+8
Only bias towards scrolling if the fingers are in the position past the timeout.
2019-07-15gestures: improve scroll responsiveness for vertically aligned touchesMatt Mayfield1-0/+11
Put some basic location checks in, if the fingers are next to each other and vertically close, assume scroll over swipe. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>:
2019-07-15touchpad: basic thumb detection within gesturesMatt Mayfield1-49/+76
When a touchpad has thumb detection enabled, avoid false-positive gestures involving a resting thumb by using two thresholds: inner and outer. While both touches remain inside their inner thresholds, remain in UNKNOWN state to allow for accurate gesture detection even with no timeout. If both touches move outside their inner thresholds, start a pinch or swipe/scroll gesture according to direction, as usual. If one touch moves outside its outer threshold while the other has not yet exceeded its inner threshold, and thumb detection is enabled, then if one touch is >20mm lower, mark it as a thumb and cancel the gesture. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15touchpad: rename the thumb detection methodsPeter Hutterer3-5/+12
No functional changes, just prep work for a later patch where the thumbs will dynamically update their state (instead of just using yes/no/maybe). Extracted from Matt Mayfield's thumb detection patches. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15touchpad: extract some bits of thumb detection into helper functionsPeter Hutterer1-11/+35
No functional changes Extracted from Matt Mayfield's thumb detection patches. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15touchpad: move the speed-thumb detection code to the thumb helper filePeter Hutterer3-46/+49
Extracted from Matt Mayfield's thumb detection patches. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15touchpad: add helper function to reset a thumb's statePeter Hutterer3-1/+10
Extracted from Matt Mayfield's thumb detection patches. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15touchpad: explicitly start with detect_thumbs as falsePeter Hutterer1-0/+2
Not needed because we zalloc() anyway, but this makes it grep-able. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15touchpad: add helper function for setting the thumb statePeter Hutterer3-19/+34
This moves the thumb state logging directly into that helper function too. Extracted from Matt Mayfield's thumb detection patches. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15touchpad: move tp_init_thumb and tp_thumb_detect to the thumb filePeter Hutterer3-168/+176
Extracted from Matt Mayfield's thumb detection patches. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15touchpad: add a helper function for counting touches for gesturesPeter Hutterer3-3/+18
Currently the same as tp_touch_active() but this will change. No functional changes. Extracted from Matt Mayfield's thumb detection patches. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15touchpad: add a helper function for checking thumb statePeter Hutterer6-8/+41
No functional changes Extracted from Matt Mayfield's thumb detection patches. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15touchpad: rename the scroll timeout define, drop the pinch onePeter Hutterer1-4/+3
The previously 'scroll'-named timeout is also used for swipe, so let's rename it. And the pinch one isn't used at all. Extracted from Matt Mayfield's thumb detection patches. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15touchpad: reduce state debugging output by only logging changed statesPeter Hutterer2-10/+12
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-27evdev: when the kernel fuzz is nonzero, set ours to zeroPeter Hutterer1-9/+30
Our udev callout is supposed to reset the kernel fuzz to 0 and move the value to the LIBINPUT_FUZZ property. This is to stop the kernel from applying its own hysteresis-like approach. Where the kernel fuzz is nonzero, something has gone wrong with that approach. Complain about it and set our fuzz to zero, we are in the hands of the kernel now. If we leave our fuzz as nonzero, we'll apply our own hysteresis on top of the kernel's and that leads to unresponsive behavior. Fixes #313 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-26evdev: only extract the fuzz for touchpads and touchscreensPeter Hutterer1-6/+9
We don't have a hysteresis for tablet devices, so let's leave those as-is. This may be a slight regression in behavior compared to pre-410b157e84 now the kernel will apply the fuzz. Let's see if anyone notices, the fuzz is usually so tiny on tablets that it shouldn't be noticable. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-26If we never initialized the libwacom database, don't check the refcountPeter Hutterer1-0/+3
If the libwacom context failed to initialize for some reason, the database is NULL and the refcount remains at zero. Calling unref should just work then. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-18touchpad: slightly change a debug messagePeter Hutterer1-3/+3
Makes it clearer that thumb detection always enables area-based detection. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-17tablet: disable the forced proximity out for the Dell Canvas penPeter Hutterer4-2/+12
This pen has random timeouts, often when a button is pressed. This causes a forced proximity out (and the button release) and makes the whole device a tad unusable. Nothing we can detect by heuristics since it looks like other devices that don't send proximity out events. And the timeout can be quite high, the recording in #304 has over 800ms for one sequence. Fixes #304 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-17quirk: drop the ModelTabletNoTilt quirkPeter Hutterer2-2/+0
This quirk is unused, use AttrEventCodeDisable instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-17tablet: fix double proximity out on slow proximity out pensPeter Hutterer2-13/+25
Where the proximity out event is delayed by the kernel, libinput would cause an extra proxmity in-out after the forced proximity out event. Event sequence is basically (k: kernel, l: libinput) k: tablet axis events l: tablet axis events k: nothing for $proximity timer milliseconds l: tablet proximity out k: proximity out event l: proximity in event l: proximity out event Fixes #306 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-16Replace one more __builtin_popcount with bitwise testMichael Forney1-1/+1
__builtin_popcount might not be available and in this case, a bitwise-and can accomplish the same task. Signed-off-by: Michael Forney <mforney@mforney.org>
2019-06-15Don't return expression in function returning voidMichael Forney1-1/+1
This is a constraint violation in ISO C[0]. [0] http://port70.net/~nsz/c/c11/n1570.html#6.8.6.4p1 Signed-off-by: Michael Forney <mforney@mforney.org>
2019-06-15Use bitwise test instead of __builtin_popcountMichael Forney1-2/+4
__builtin_popcount might not be available on all compilers, so using it requires a configure check and fallback implementation. In fact on gcc without an -march flag, it gets compiled to a function call to libgcc. However, we only need to test whether multiple bits are set, and this can be done easily with a bitwise and. Signed-off-by: Michael Forney <mforney@mforney.org>
2019-06-15Avoid case ranges in switch statementMichael Forney1-6/+7
Signed-off-by: Michael Forney <mforney@mforney.org>
2019-06-15Avoid unnecessary VLAsMichael Forney2-5/+5
When the array length is fixed, or bounded by a fixed upper bound, just use that fixed length. Signed-off-by: Michael Forney <mforney@mforney.org>
2019-06-15Remove semicolons after function definitionsMichael Forney1-3/+3
Signed-off-by: Michael Forney <mforney@mforney.org>
2019-06-14test: auto-generate the udev rulesPeter Hutterer1-0/+5
We only ever set properties in the devices, so let's make that more explicit and auto-generate the udev rule. This way we're hopefully better protected from the various typos that hid in those rules over the years, but also be prepared for passing the udev property key/value pairs elsewhere. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-11path: add helper function to destroy a devicePeter Hutterer1-12/+13
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-11path: initialize the quirks context after error checkingPeter Hutterer1-7/+7
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-11path: factor out the seat creation into a helper functionPeter Hutterer1-20/+39
No functional changes Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-11udev: don't init the quirks until we checked all argumentsPeter Hutterer1-7/+7
If we fail with an invalid argument, there's no need to initialize all the quirks beforehand. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-11path: drop the separate header, not necessaryPeter Hutterer2-46/+16
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-07Add a new dispatch interface for the Dell Canvas TotemPeter Hutterer5-1/+843
This device looks similar to a MT device on the kernel side, but it's not a MT device and it's not quite a tablet either. It uses slots to track up to 4 totems off the same device and the only hint that it's not a MT device is that it sends ABS_MT_TOOL_TYPE / MT_TOOL_DIAL. udev thinks it's a touchscreen and a tablet but we currently init those devices as touchscreen (because all wacom tablet touch devices are udev tablets+tochscreens). So we need a quirk to hook onto this device. And we use a completely separate dispatch implementation, because adding the behavior to the tablet interface requires so many exceptions that it's easier to just add a separate dispatch interface. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-07tablet: add a the Totem tool type to the tablet interfacePeter Hutterer5-2/+188
This is the public API only, not the internal bits, so nothing will work just yet. This interface addition is for the Dell Canvas Totem tool, so let's go with the same name because options like "Rotary" are too ambiguous. The totem is a knob that can be placed on the surface, it provides us with location and rotation data. The touch major/minor fields are filled in by the current totem, but they're always the same size. The totem exports BTN_0 as well, so let's add that to the debug-events output. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-28Warn if NDEBUG is definedPeter Hutterer1-0/+4
We rely on assert() too much for safety checks, let's not let the user disable it without warning Fixes #262 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-28quirks: add trackpoint integration attributePeter Hutterer4-9/+46
Some versions [1] of the Lenovo ThinkPad Compact USB Keyboard with TrackPoint USB have the pointing stick on an event node that has keys but is not a regular keyboard. Thus the stick falls through the cracks and gets disabled on tablet mode switch. Instead of adding more hacks let's do this properly: tag the pointing stick as external and have the code in place to deal with that. [1] This may be caused by recent kernel changes Fixes #291 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-28quirks: handle ID_INPUT_KEY as udev keyboard matchPeter Hutterer1-0/+1
We handle that as keyboard in the evdev code, let's do so here as well. Related to #291 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-28Abstract libwacom database initialization into a single placePeter Hutterer7-35/+88
No real changes for the non-tablet code, but for tablets we now keep the libwacom datbase around. The primary motivating factor here is response time during tests - initializing the database under valgrind took longer than the proximity timeouts and caused random test case failures when a proximity out was triggered before we even got to process the first event. This is unfortunately a burden on the runtime now since we keep libwacom around whenever a tablet is connected. Not much of an impact though, I suspect, chances are you're running a web browser and everything pales against that anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-27touchpad: lock the touchpad rotation to the tablet rotationPeter Hutterer2-6/+128
Follow-up to 6229df184e8a03e76ba99483e7f9ecdd9ef02f4a We must not rely on the caller to toggle the left-handed bits correctly since they may not know which devices belong together (despite device groups). Let's do the right thing here, if the tablet is set to left-handed, rotate the touchpad accordingly. Note that the left-handed setting of the tablet is left as-is (right-handed). Until we have notifications about configuration changes, this is the best we can do. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-27tablet: lock the tablet rotation to the touchpad rotationPeter Hutterer3-7/+114
Follow-up to 6229df184e8a03e76ba99483e7f9ecdd9ef02f4a We must not rely on the caller to toggle the left-handed bits correctly since they may not know which devices belong together (despite device groups). Let's do the right thing here, if the touchpad is set to left-handed, rotate the tablet accordingly. Note that the left-handed setting of the touchpad is left as-is (right-handed). Until we have notifications about configuration changes, this is the best we can do. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-05-27tablet: don't disable the proximity quirk on good sequencesPeter Hutterer2-15/+5
There are tablets out there that *sometimes* send the right event sequence, but are generally broken. So let's not disable that quirk even if we do get a right sequence. Affected devices: Lenovo Flex 5 Fixes #248 Fixes #290 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>