From 92907f59ba95fce36b96e67f036372f4e46343d9 Mon Sep 17 00:00:00 2001 From: mingchuan Date: Wed, 22 May 2024 20:00:39 -0700 Subject: [PATCH] Fix tablet mapping when mapped region is specified 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 663456f8bc99..11ec228237de 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -674,8 +674,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: {