summaryrefslogtreecommitdiff
path: root/src/managers/input/Tablets.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-09 17:16:01 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-06-09 17:16:01 +0200
commitc218ed443243017ca32a8b2dde4180f520c25c00 (patch)
treebc6dbe813a13972c47b122ecc51e2d30492aec42 /src/managers/input/Tablets.cpp
parentf97b90859ae95571a2a16cd9827f5f623369c732 (diff)
notify tablet motion
Diffstat (limited to 'src/managers/input/Tablets.cpp')
-rw-r--r--src/managers/input/Tablets.cpp19
1 files changed, 18 insertions, 1 deletions
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");