From 4d3f2ca96b006fe9fd27de7f1bd4d317ad732762 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 28 Feb 2023 19:02:30 +0000 Subject: [PATCH] minor fixes to touch handling --- src/managers/input/InputManager.cpp | 11 +++-------- src/managers/input/Touch.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index e221651a..042e19dd 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -69,11 +69,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown) return; - if (!g_pCompositor->m_sSeat.mouse) { - Debug::log(ERR, "BUG THIS: Mouse move on mouse nullptr!"); - return; - } - if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS) { // enable dpms g_pKeybindManager->dpms("on"); @@ -91,7 +86,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { // constraints // All constraints TODO: multiple mice? - if (g_pCompositor->m_sSeat.mouse->currentConstraint && !g_pCompositor->m_sSeat.exclusiveClient && !g_pSessionLockManager->isSessionLocked()) { + if (g_pCompositor->m_sSeat.mouse && g_pCompositor->m_sSeat.mouse->currentConstraint && !g_pCompositor->m_sSeat.exclusiveClient && !g_pSessionLockManager->isSessionLocked()) { // XWayland windows sometimes issue constraints weirdly. // TODO: We probably should search their parent. wlr_xwayland_surface->parent const auto CONSTRAINTWINDOW = g_pCompositor->getConstraintWindow(g_pCompositor->m_sSeat.mouse); @@ -462,7 +457,7 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) { if (*PFOLLOWMOUSE == 3) // don't refocus on full loose break; - if (!g_pCompositor->m_sSeat.mouse->currentConstraint) + if (!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint) refocus(); // if clicked on a floating window make it top @@ -1094,7 +1089,7 @@ void CInputManager::constrainMouse(SMouse* pMouse, wlr_pointer_constraint_v1* co } void CInputManager::unconstrainMouse() { - if (!g_pCompositor->m_sSeat.mouse->currentConstraint) + if (!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint) return; const auto CONSTRAINTWINDOW = g_pCompositor->getConstraintWindow(g_pCompositor->m_sSeat.mouse); diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp index b69b4f7b..70bae3b2 100644 --- a/src/managers/input/Touch.cpp +++ b/src/managers/input/Touch.cpp @@ -15,6 +15,13 @@ void CInputManager::onTouchDown(wlr_touch_down_event* e) { refocus(); + if (m_ecbClickBehavior == CLICKMODE_KILL) { + wlr_pointer_button_event e; + e.state = WLR_BUTTON_PRESSED; + g_pInputManager->processMouseDownKill(&e); + return; + } + m_bLastInputTouch = true; m_sTouchData.touchFocusWindow = m_pFoundWindowToFocus;