This commit is contained in:
vaxerski 2022-06-09 19:47:05 +02:00
parent 506977c13d
commit 53146ccf69
2 changed files with 10 additions and 5 deletions

View file

@ -177,6 +177,8 @@ struct STabletTool {
wlr_tablet_v2_tablet* wlrTabletOwnerV2 = nullptr; wlr_tablet_v2_tablet* wlrTabletOwnerV2 = nullptr;
wlr_surface* pSurface = nullptr;
double tiltX = 0; double tiltX = 0;
double tiltY = 0; double tiltY = 0;

View file

@ -213,24 +213,27 @@ void CInputManager::focusTablet(STablet* pTab, wlr_tablet_tool* pTool, bool moti
const auto LOCAL = CURSORPOS - PWINDOW->m_vRealPosition.goalv(); 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); 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); wlr_tablet_v2_tablet_tool_notify_proximity_in(PTOOL->wlrTabletToolV2, pTab->wlrTabletV2, g_pCompositor->m_pLastFocus);
}
if (motion) if (motion)
wlr_tablet_v2_tablet_tool_notify_motion(PTOOL->wlrTabletToolV2, LOCAL.x, LOCAL.y); wlr_tablet_v2_tablet_tool_notify_motion(PTOOL->wlrTabletToolV2, LOCAL.x, LOCAL.y);
} else { } 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() { void CInputManager::unfocusAllTablets() {
for (auto& tt : m_lTabletTools) { for (auto& tt : m_lTabletTools) {
if (!tt.wlrTabletTool->data) if (!tt.wlrTabletToolV2 || !tt.pSurface || !tt.active)
continue; continue;
wlr_tablet_v2_tablet_tool_notify_proximity_out(((STabletTool*)tt.wlrTabletTool->data)->wlrTabletToolV2); wlr_tablet_v2_tablet_tool_notify_proximity_out(tt.wlrTabletToolV2);
} }
} }