From df80fbf70650dfb0d96381a1d86d30811cf516f4 Mon Sep 17 00:00:00 2001 From: Ming-Chuan <10496191+sifmelcara@users.noreply.github.com> Date: Thu, 23 May 2024 04:52:32 -0700 Subject: [PATCH] tablet: fix mapping when mapped region is specified (#6206) When `region_size` is set in the config (non-empty `boundBox`), cursor is mapped to wrong coordinate because `CBox::translate` mutates `TAB->boundBox`, making all subsequent coordinate calculations wrong. This also fixes the edge case where user sets `region_position` but not `region_size`. --- src/managers/PointerManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index 4be91b80..ae17c6d6 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -696,8 +696,11 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP dev) { } } - if (!TAB->boundBox.empty()) - mappedArea = TAB->boundBox.translate(currentMonitor->vecPosition); + mappedArea.translate(TAB->boundBox.pos()); + if (!TAB->boundBox.empty()) { + mappedArea.w = TAB->boundBox.w; + mappedArea.h = TAB->boundBox.h; + } break; } case HID_TYPE_TOUCH: {