From 059e85ae69e5d50bb6734532da4abdcf66167ab3 Mon Sep 17 00:00:00 2001 From: Khalid Date: Sat, 23 Mar 2024 23:31:03 +0300 Subject: input: Add options to set tablet's active area (#5199) * Add options to set tablet's active area * Set tablet's active area in `setTabletConfigs` * Fix formatting for new variables in ConfigManager * Report tablet's physical size with hyprctl --- src/managers/input/Tablets.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/managers/input/Tablets.cpp') diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp index 387212c7..9252fca4 100644 --- a/src/managers/input/Tablets.cpp +++ b/src/managers/input/Tablets.cpp @@ -51,8 +51,14 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) { if (PTAB->relativeInput) wlr_cursor_move(g_pCompositor->m_sWLRCursor, PTAB->wlrDevice, dx, dy); - else + else { + // Calculate transformations if active area is set + if (!PTAB->activeArea.empty()) { + x = (x - PTAB->activeArea.x) / (PTAB->activeArea.w - PTAB->activeArea.x); + y = (y - PTAB->activeArea.y) / (PTAB->activeArea.h - PTAB->activeArea.y); + } wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, PTAB->wlrDevice, x, y); + } g_pInputManager->simulateMouseMovement(); g_pInputManager->focusTablet(PTAB, EVENT->tool, true); -- cgit v1.2.3