evdev: apply calibration for touch arbitration
authorhrdl <git@hrdl.eu>
Thu, 2 Feb 2023 06:52:40 +0000 (07:52 +0100)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 8 Feb 2023 03:57:18 +0000 (03:57 +0000)
Rectangle-based touch arbitration should respect calibration. This
fixes #853.

Signed-off-by: hrdl <git@hrdl.eu>
src/evdev-fallback.c

index 56121ed88647883bae00b912e91ce7eb25c74d25..d591928af4ac59f1c5935784c44172df16409125 100644 (file)
@@ -808,9 +808,11 @@ fallback_arbitrate_touch(struct fallback_dispatch *dispatch,
                         struct mt_slot *slot)
 {
        bool discard = false;
+       struct device_coords point = slot->point;
+       evdev_transform_absolute(dispatch->device, &point);
 
        if (dispatch->arbitration.state == ARBITRATION_IGNORE_RECT &&
-           point_in_rect(&slot->point, &dispatch->arbitration.rect)) {
+           point_in_rect(&point, &dispatch->arbitration.rect)) {
                slot->palm_state = PALM_IS_PALM;
                discard = true;
        }
@@ -997,19 +999,24 @@ cancel_touches(struct fallback_dispatch *dispatch,
 {
        unsigned int idx;
        bool need_frame = false;
+       struct device_coords point;
 
-       if (!rect || point_in_rect(&dispatch->abs.point, rect))
+       point = dispatch->abs.point;
+       evdev_transform_absolute(device, &point);
+       if (!rect || point_in_rect(&point, rect))
                need_frame = fallback_flush_st_cancel(dispatch,
                                                      device,
                                                      time);
 
        for (idx = 0; idx < dispatch->mt.slots_len; idx++) {
                struct mt_slot *slot = &dispatch->mt.slots[idx];
+               point = slot->point;
+               evdev_transform_absolute(device, &point);
 
                if (slot->seat_slot == -1)
                        continue;
 
-               if ((!rect || point_in_rect(&slot->point, rect)) &&
+               if ((!rect || point_in_rect(&point, rect)) &&
                    fallback_flush_mt_cancel(dispatch, device, idx, time))
                        need_frame = true;
        }