From 5d7fc54c2208ad2171348e2dc5890ac33918f64e Mon Sep 17 00:00:00 2001 From: hrdl Date: Thu, 2 Feb 2023 07:52:40 +0100 Subject: [PATCH] evdev: apply calibration for touch arbitration Rectangle-based touch arbitration should respect calibration. This fixes #853. Signed-off-by: hrdl --- src/evdev-fallback.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/evdev-fallback.c b/src/evdev-fallback.c index 56121ed8..d591928a 100644 --- a/src/evdev-fallback.c +++ b/src/evdev-fallback.c @@ -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; } -- 2.34.1