From 1841d244f03793acc260ddadd34d64095e08dfa2 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Thu, 9 Jun 2022 14:40:56 +0200 Subject: [PATCH] log shit in tablets --- src/managers/input/Tablets.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp index df0a7171..b6a3c7d7 100644 --- a/src/managers/input/Tablets.cpp +++ b/src/managers/input/Tablets.cpp @@ -9,6 +9,8 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) { PNEWTABLET->wlrTabletV2 = wlr_tablet_create(g_pCompositor->m_sWLRTabletManager, g_pCompositor->m_sSeat.seat, pDevice); PNEWTABLET->wlrTablet->data = PNEWTABLET; + Debug::log(LOG, "Attaching tablet to cursor!"); + wlr_cursor_attach_input_device(g_pCompositor->m_sWLRCursor, pDevice); PNEWTABLET->hyprListener_Destroy.initCallback(&pDevice->events.destroy, [](void* owner, void* data) { @@ -21,6 +23,8 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) { PNEWTABLET->hyprListener_Axis.initCallback(&pDevice->tablet->events.axis, [](void* owner, void* data) { + Debug::log(LOG, "Tablet axis"); + const auto EVENT = (wlr_tablet_tool_axis_event*)data; const auto PTAB = (STablet*)owner; @@ -73,6 +77,8 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) { const auto EVENT = (wlr_tablet_tool_tip_event*)data; const auto PTAB = (STablet*)owner; + Debug::log(LOG, "Tablet tip"); + const auto PTOOL = g_pInputManager->ensureTabletToolPresent(PTAB, EVENT->tool); // TODO: this might be wrong @@ -87,6 +93,8 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) { const auto EVENT = (wlr_tablet_tool_button_event*)data; const auto PTAB = (STablet*)owner; + Debug::log(LOG, "Tablet button"); + const auto PTOOL = g_pInputManager->ensureTabletToolPresent(PTAB, EVENT->tool); wlr_tablet_v2_tablet_tool_notify_button(PTOOL->wlrTabletToolV2, (zwp_tablet_pad_v2_button_state)EVENT->button, (zwp_tablet_pad_v2_button_state)EVENT->state); @@ -97,12 +105,16 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) { const auto EVENT = (wlr_tablet_tool_proximity_event*)data; const auto PTAB = (STablet*)owner; + Debug::log(LOG, "Tablet proxim"); + const auto PTOOL = g_pInputManager->ensureTabletToolPresent(PTAB, EVENT->tool); if (EVENT->state == WLR_TABLET_TOOL_PROXIMITY_OUT) { PTOOL->active = false; + Debug::log(LOG, "Tool active -> false"); } else { PTOOL->active = true; + Debug::log(LOG, "Tool active -> true"); g_pInputManager->refocus(); } @@ -113,6 +125,8 @@ STabletTool* CInputManager::ensureTabletToolPresent(STablet* pTablet, wlr_tablet if (pTool->data == nullptr) { const auto PTOOL = &m_lTabletTools.emplace_back(); + Debug::log(LOG, "Creating tablet tool v2 for %x", pTool); + PTOOL->wlrTabletTool = pTool; pTool->data = PTOOL; @@ -138,6 +152,8 @@ void CInputManager::newTabletPad(wlr_input_device* pDevice) { PNEWPAD->hyprListener_Button.initCallback(&pDevice->tablet_pad->events.button, [](void* owner, void* data) { + Debug::log(LOG, "TabletPad button"); + const auto EVENT = (wlr_tablet_pad_button_event*)data; const auto PPAD = (STabletPad*)owner; @@ -151,6 +167,8 @@ void CInputManager::newTabletPad(wlr_input_device* pDevice) { const auto EVENT = (wlr_tablet_pad_strip_event*)data; const auto PPAD = (STabletPad*)owner; + Debug::log(LOG, "TabletPad strip"); + wlr_tablet_v2_tablet_pad_notify_strip(PPAD->wlrTabletPadV2, EVENT->strip, EVENT->position, EVENT->source == WLR_TABLET_PAD_STRIP_SOURCE_FINGER, EVENT->time_msec); }, PNEWPAD, "Tablet Pad"); @@ -160,6 +178,8 @@ void CInputManager::newTabletPad(wlr_input_device* pDevice) { const auto EVENT = (wlr_tablet_pad_ring_event*)data; const auto PPAD = (STabletPad*)owner; + Debug::log(LOG, "TabletPad ring"); + wlr_tablet_v2_tablet_pad_notify_ring(PPAD->wlrTabletPadV2, EVENT->ring, EVENT->position, EVENT->source == WLR_TABLET_PAD_RING_SOURCE_FINGER, EVENT->time_msec); }, PNEWPAD, "Tablet Pad"); @@ -169,6 +189,8 @@ void CInputManager::newTabletPad(wlr_input_device* pDevice) { const auto TABLET = (wlr_tablet_tool*)data; const auto PPAD = (STabletPad*)owner; + Debug::log(LOG, "TabletPad attach"); + PPAD->pTabletParent = (STablet*)TABLET->data; if (!PPAD->pTabletParent) @@ -180,6 +202,8 @@ void CInputManager::newTabletPad(wlr_input_device* pDevice) { const auto PPAD = (STabletPad*)owner; + Debug::log(LOG, "TabletPad destroy"); + g_pInputManager->m_lTabletPads.remove(*PPAD); Debug::log(LOG, "Removed a tablet pad");