From 1d47e2c4088b74961fdc59aba558d84f4751fed1 Mon Sep 17 00:00:00 2001 From: Antoine Dutot Date: Fri, 27 Oct 2023 11:15:29 +0200 Subject: input: fix force_zero_scaling for tablet and touch (#3644) * Attempt to fix force_zero_scaling for tablet and touch for XWayland apps. * Formated using clang-format. * Simpler way to compute touch origin. --- src/managers/input/Tablets.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/managers/input/Tablets.cpp') diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp index 77dd737c..e5968a5a 100644 --- a/src/managers/input/Tablets.cpp +++ b/src/managers/input/Tablets.cpp @@ -244,8 +244,6 @@ void CInputManager::focusTablet(STablet* pTab, wlr_tablet_tool* pTool, bool moti if (const auto PWINDOW = g_pCompositor->m_pLastWindow; PWINDOW) { const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal(); - const auto LOCAL = CURSORPOS - PWINDOW->m_vRealPosition.goalv(); - if (PTOOL->pSurface != g_pCompositor->m_pLastFocus) wlr_tablet_v2_tablet_tool_notify_proximity_out(PTOOL->wlrTabletToolV2); @@ -254,8 +252,14 @@ void CInputManager::focusTablet(STablet* pTab, wlr_tablet_tool* pTool, bool moti wlr_tablet_v2_tablet_tool_notify_proximity_in(PTOOL->wlrTabletToolV2, pTab->wlrTabletV2, g_pCompositor->m_pLastFocus); } - if (motion) - wlr_tablet_v2_tablet_tool_notify_motion(PTOOL->wlrTabletToolV2, LOCAL.x, LOCAL.y); + if (motion) { + auto local = CURSORPOS - PWINDOW->m_vRealPosition.goalv(); + + if (PWINDOW->m_bIsX11) + local = local * PWINDOW->m_fX11SurfaceScaledBy; + + wlr_tablet_v2_tablet_tool_notify_motion(PTOOL->wlrTabletToolV2, local.x, local.y); + } } else { if (PTOOL->pSurface) wlr_tablet_v2_tablet_tool_notify_proximity_out(PTOOL->wlrTabletToolV2); -- cgit v1.2.3