From c218ed443243017ca32a8b2dde4180f520c25c00 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 9 Jun 2022 17:16:01 +0200 Subject: [PATCH] notify tablet motion --- src/managers/input/Tablets.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp index b6a3c7d7..f46ad775 100644 --- a/src/managers/input/Tablets.cpp +++ b/src/managers/input/Tablets.cpp @@ -44,9 +44,18 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) { const auto PTOOL = g_pInputManager->ensureTabletToolPresent(PTAB, EVENT->tool); // TODO: this might be wrong - if (PTOOL->active) + if (PTOOL->active) { g_pInputManager->refocus(); + if (const auto PWINDOW = g_pCompositor->m_pLastWindow; g_pCompositor->windowValidMapped(PWINDOW)) { + const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal(); + + const auto LOCAL = CURSORPOS - PWINDOW->m_vRealPosition.goalv(); + + wlr_tablet_v2_tablet_tool_notify_motion(PTOOL->wlrTabletToolV2, LOCAL.x, LOCAL.y); + } + } + if (EVENT->updated_axes & WLR_TABLET_TOOL_AXIS_PRESSURE) wlr_tablet_v2_tablet_tool_notify_pressure(PTOOL->wlrTabletToolV2, EVENT->pressure); @@ -116,6 +125,14 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) { PTOOL->active = true; Debug::log(LOG, "Tool active -> true"); g_pInputManager->refocus(); + + if (const auto PWINDOW = g_pCompositor->m_pLastWindow; g_pCompositor->windowValidMapped(PWINDOW)) { + const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal(); + + const auto LOCAL = CURSORPOS - PWINDOW->m_vRealPosition.goalv(); + + wlr_tablet_v2_tablet_tool_notify_motion(PTOOL->wlrTabletToolV2, LOCAL.x, LOCAL.y); + } } }, PNEWTABLET, "Tablet");