From 53146ccf69a53850f8ad2af85f0ccf6e1143b878 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 9 Jun 2022 19:47:05 +0200 Subject: [PATCH] oopsie --- src/helpers/WLClasses.hpp | 2 ++ src/managers/input/Tablets.cpp | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/helpers/WLClasses.hpp b/src/helpers/WLClasses.hpp index 723ffdff..534b0de6 100644 --- a/src/helpers/WLClasses.hpp +++ b/src/helpers/WLClasses.hpp @@ -177,6 +177,8 @@ struct STabletTool { wlr_tablet_v2_tablet* wlrTabletOwnerV2 = nullptr; + wlr_surface* pSurface = nullptr; + double tiltX = 0; double tiltY = 0; diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp index bb2c5c6d..d21ef518 100644 --- a/src/managers/input/Tablets.cpp +++ b/src/managers/input/Tablets.cpp @@ -213,24 +213,27 @@ void CInputManager::focusTablet(STablet* pTab, wlr_tablet_tool* pTool, bool moti const auto LOCAL = CURSORPOS - PWINDOW->m_vRealPosition.goalv(); - if (PTOOL->wlrTabletToolV2->focused_surface != g_pCompositor->m_pLastFocus) + if (PTOOL->pSurface != g_pCompositor->m_pLastFocus) wlr_tablet_v2_tablet_tool_notify_proximity_out(PTOOL->wlrTabletToolV2); - if (g_pCompositor->m_pLastFocus) + if (g_pCompositor->m_pLastFocus) { + PTOOL->pSurface = g_pCompositor->m_pLastFocus; 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); } else { - wlr_tablet_v2_tablet_tool_notify_proximity_out(PTOOL->wlrTabletToolV2); + if (PTOOL->pSurface) + wlr_tablet_v2_tablet_tool_notify_proximity_out(PTOOL->wlrTabletToolV2); } } void CInputManager::unfocusAllTablets() { for (auto& tt : m_lTabletTools) { - if (!tt.wlrTabletTool->data) + if (!tt.wlrTabletToolV2 || !tt.pSurface || !tt.active) continue; - wlr_tablet_v2_tablet_tool_notify_proximity_out(((STabletTool*)tt.wlrTabletTool->data)->wlrTabletToolV2); + wlr_tablet_v2_tablet_tool_notify_proximity_out(tt.wlrTabletToolV2); } } \ No newline at end of file