tablet: minor focus fixes

ref #3004
This commit is contained in:
Vaxry 2024-03-19 02:45:11 +00:00
parent 49f5fd59ad
commit 7a31c954e5

View file

@ -39,7 +39,8 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
switch (EVENT->tool->type) { switch (EVENT->tool->type) {
case WLR_TABLET_TOOL_TYPE_MOUSE: case WLR_TABLET_TOOL_TYPE_MOUSE:
wlr_cursor_move(g_pCompositor->m_sWLRCursor, PTAB->wlrDevice, EVENT->dx, EVENT->dy); wlr_cursor_move(g_pCompositor->m_sWLRCursor, PTAB->wlrDevice, EVENT->dx, EVENT->dy);
g_pInputManager->refocus(); g_pInputManager->simulateMouseMovement();
g_pInputManager->focusTablet(PTAB, EVENT->tool, true);
g_pInputManager->m_tmrLastCursorMovement.reset(); g_pInputManager->m_tmrLastCursorMovement.reset();
break; break;
default: default:
@ -53,7 +54,8 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
else else
wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, PTAB->wlrDevice, x, y); wlr_cursor_warp_absolute(g_pCompositor->m_sWLRCursor, PTAB->wlrDevice, x, y);
g_pInputManager->refocus(); g_pInputManager->simulateMouseMovement();
g_pInputManager->focusTablet(PTAB, EVENT->tool, true);
g_pInputManager->m_tmrLastCursorMovement.reset(); g_pInputManager->m_tmrLastCursorMovement.reset();
break; break;
} }
@ -62,7 +64,7 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
// TODO: this might be wrong // TODO: this might be wrong
if (PTOOL->active) { if (PTOOL->active) {
g_pInputManager->refocus(); g_pInputManager->simulateMouseMovement();
g_pInputManager->focusTablet(PTAB, EVENT->tool, true); g_pInputManager->focusTablet(PTAB, EVENT->tool, true);
} }
@ -105,7 +107,7 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
// TODO: this might be wrong // TODO: this might be wrong
if (EVENT->state == WLR_TABLET_TOOL_TIP_DOWN) { if (EVENT->state == WLR_TABLET_TOOL_TIP_DOWN) {
g_pInputManager->refocus(); g_pInputManager->simulateMouseMovement();
g_pInputManager->focusTablet(PTAB, EVENT->tool); g_pInputManager->focusTablet(PTAB, EVENT->tool);
wlr_send_tablet_v2_tablet_tool_down(PTOOL->wlrTabletToolV2); wlr_send_tablet_v2_tablet_tool_down(PTOOL->wlrTabletToolV2);
} else { } else {
@ -146,7 +148,7 @@ void CInputManager::newTabletTool(wlr_input_device* pDevice) {
} else { } else {
PTOOL->active = true; PTOOL->active = true;
g_pInputManager->refocus(); g_pInputManager->simulateMouseMovement();
g_pInputManager->focusTablet(PTAB, EVENT->tool); g_pInputManager->focusTablet(PTAB, EVENT->tool);
} }
@ -258,12 +260,12 @@ void CInputManager::focusTablet(STablet* pTab, wlr_tablet_tool* pTool, bool moti
if (const auto PWINDOW = g_pCompositor->m_pLastWindow; PWINDOW) { if (const auto PWINDOW = g_pCompositor->m_pLastWindow; PWINDOW) {
const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal(); const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal();
if (PTOOL->pSurface != g_pCompositor->m_pLastFocus) if (PTOOL->pSurface != g_pInputManager->m_pLastMouseSurface)
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_pInputManager->m_pLastMouseSurface) {
PTOOL->pSurface = 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_pInputManager->m_pLastMouseSurface);
} }
if (motion) { if (motion) {