From 5b3e489108d8512fb5dfacf07b2aa3a71208e0f0 Mon Sep 17 00:00:00 2001 From: davc0n Date: Thu, 1 May 2025 23:57:11 +0200 Subject: inputs: refactor class member vars (#10230) --- src/managers/input/Touch.cpp | 92 ++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'src/managers/input/Touch.cpp') diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp index f8964521..83447593 100644 --- a/src/managers/input/Touch.cpp +++ b/src/managers/input/Touch.cpp @@ -12,7 +12,7 @@ #include "debug/Log.hpp" void CInputManager::onTouchDown(ITouch::SDownEvent e) { - m_bLastInputTouch = true; + m_lastInputTouch = true; static auto PSWIPETOUCH = CConfigValue("gestures:workspace_swipe_touch"); static auto PGAPSOUTDATA = CConfigValue("general:gaps_out"); @@ -31,7 +31,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { refocus(); - if (m_ecbClickBehavior == CLICKMODE_KILL) { + if (m_clickBehavior == CLICKMODE_KILL) { IPointer::SButtonEvent e; e.state = WL_POINTER_BUTTON_STATE_PRESSED; g_pInputManager->processMouseDownKill(e); @@ -39,10 +39,10 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { } // Don't propagate new touches when a workspace swipe is in progress. - if (m_sActiveSwipe.pWorkspaceBegin) { + if (m_activeSwipe.pWorkspaceBegin) { return; // TODO: Don't swipe if you touched a floating window. - } else if (*PSWIPETOUCH && (m_pFoundLSToFocus.expired() || m_pFoundLSToFocus->m_layer <= 1) && !g_pSessionLockManager->isSessionLocked()) { + } else if (*PSWIPETOUCH && (m_foundLSToFocus.expired() || m_foundLSToFocus->m_layer <= 1) && !g_pSessionLockManager->isSessionLocked()) { const auto PWORKSPACE = PMONITOR->m_activeWorkspace; const auto STYLE = PWORKSPACE->m_renderOffset->getStyle(); const bool VERTANIMS = STYLE == "slidevert" || STYLE.starts_with("slidefadevert"); @@ -51,83 +51,83 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { const double POSITION = (VERTANIMS ? e.pos.y : e.pos.x); if (POSITION < TARGETLEFT || POSITION > TARGETRIGHT) { beginWorkspaceSwipe(); - m_sActiveSwipe.touch_id = e.touchID; + m_activeSwipe.touch_id = e.touchID; // Set the initial direction based on which edge you started from if (POSITION > 0.5) - m_sActiveSwipe.initialDirection = *PSWIPEINVR ? -1 : 1; + m_activeSwipe.initialDirection = *PSWIPEINVR ? -1 : 1; else - m_sActiveSwipe.initialDirection = *PSWIPEINVR ? 1 : -1; + m_activeSwipe.initialDirection = *PSWIPEINVR ? 1 : -1; return; } } if (g_pSessionLockManager->isSessionLocked()) { - m_sTouchData.touchFocusLockSurface = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->m_id); - if (!m_sTouchData.touchFocusLockSurface) + m_touchData.touchFocusLockSurface = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->m_id); + if (!m_touchData.touchFocusLockSurface) Debug::log(WARN, "The session is locked but can't find a lock surface"); else - m_sTouchData.touchFocusSurface = m_sTouchData.touchFocusLockSurface->surface->surface(); + m_touchData.touchFocusSurface = m_touchData.touchFocusLockSurface->surface->surface(); } else { - m_sTouchData.touchFocusLockSurface.reset(); - m_sTouchData.touchFocusWindow = m_pFoundWindowToFocus; - m_sTouchData.touchFocusSurface = m_pFoundSurfaceToFocus; - m_sTouchData.touchFocusLS = m_pFoundLSToFocus; + m_touchData.touchFocusLockSurface.reset(); + m_touchData.touchFocusWindow = m_foundWindowToFocus; + m_touchData.touchFocusSurface = m_foundSurfaceToFocus; + m_touchData.touchFocusLS = m_foundLSToFocus; } Vector2D local; - if (m_sTouchData.touchFocusLockSurface) { - local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->m_position; - m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local; - } else if (!m_sTouchData.touchFocusWindow.expired()) { - if (m_sTouchData.touchFocusWindow->m_isX11) { - local = (g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusWindow->m_realPosition->goal()) * m_sTouchData.touchFocusWindow->m_X11SurfaceScaledBy; - m_sTouchData.touchSurfaceOrigin = m_sTouchData.touchFocusWindow->m_realPosition->goal(); + if (m_touchData.touchFocusLockSurface) { + local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->m_position; + m_touchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local; + } else if (!m_touchData.touchFocusWindow.expired()) { + if (m_touchData.touchFocusWindow->m_isX11) { + local = (g_pInputManager->getMouseCoordsInternal() - m_touchData.touchFocusWindow->m_realPosition->goal()) * m_touchData.touchFocusWindow->m_X11SurfaceScaledBy; + m_touchData.touchSurfaceOrigin = m_touchData.touchFocusWindow->m_realPosition->goal(); } else { - g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), m_sTouchData.touchFocusWindow.lock(), local); - m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local; + g_pCompositor->vectorWindowToSurface(g_pInputManager->getMouseCoordsInternal(), m_touchData.touchFocusWindow.lock(), local); + m_touchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local; } - } else if (!m_sTouchData.touchFocusLS.expired()) { - local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchFocusLS->m_geometry.pos(); + } else if (!m_touchData.touchFocusLS.expired()) { + local = g_pInputManager->getMouseCoordsInternal() - m_touchData.touchFocusLS->m_geometry.pos(); - m_sTouchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local; + m_touchData.touchSurfaceOrigin = g_pInputManager->getMouseCoordsInternal() - local; } else return; // oops, nothing found. - g_pSeatManager->sendTouchDown(m_sTouchData.touchFocusSurface.lock(), e.timeMs, e.touchID, local); + g_pSeatManager->sendTouchDown(m_touchData.touchFocusSurface.lock(), e.timeMs, e.touchID, local); } void CInputManager::onTouchUp(ITouch::SUpEvent e) { - m_bLastInputTouch = true; + m_lastInputTouch = true; EMIT_HOOK_EVENT_CANCELLABLE("touchUp", e); - if (m_sActiveSwipe.pWorkspaceBegin) { + if (m_activeSwipe.pWorkspaceBegin) { // If there was a swipe from this finger, end it. - if (e.touchID == m_sActiveSwipe.touch_id) + if (e.touchID == m_activeSwipe.touch_id) endWorkspaceSwipe(); return; } - if (m_sTouchData.touchFocusSurface) + if (m_touchData.touchFocusSurface) g_pSeatManager->sendTouchUp(e.timeMs, e.touchID); } void CInputManager::onTouchMove(ITouch::SMotionEvent e) { - m_bLastInputTouch = true; + m_lastInputTouch = true; EMIT_HOOK_EVENT_CANCELLABLE("touchMove", e); - if (m_sActiveSwipe.pWorkspaceBegin) { + if (m_activeSwipe.pWorkspaceBegin) { // Do nothing if this is using a different finger. - if (e.touchID != m_sActiveSwipe.touch_id) + if (e.touchID != m_activeSwipe.touch_id) return; - const auto ANIMSTYLE = m_sActiveSwipe.pWorkspaceBegin->m_renderOffset->getStyle(); + const auto ANIMSTYLE = m_activeSwipe.pWorkspaceBegin->m_renderOffset->getStyle(); const bool VERTANIMS = ANIMSTYLE == "slidevert" || ANIMSTYLE.starts_with("slidefadevert"); static auto PSWIPEINVR = CConfigValue("gestures:workspace_swipe_touch_invert"); static auto PSWIPEDIST = CConfigValue("gestures:workspace_swipe_distance"); const auto SWIPEDISTANCE = std::clamp(*PSWIPEDIST, (int64_t)1LL, (int64_t)UINT32_MAX); // Handle the workspace swipe if there is one - if (m_sActiveSwipe.initialDirection == -1) { + if (m_activeSwipe.initialDirection == -1) { if (*PSWIPEINVR) // go from 0 to -SWIPEDISTANCE updateWorkspaceSwipe(SWIPEDISTANCE * ((VERTANIMS ? e.pos.y : e.pos.x) - 1)); @@ -142,27 +142,27 @@ void CInputManager::onTouchMove(ITouch::SMotionEvent e) { updateWorkspaceSwipe(SWIPEDISTANCE * (1 - (VERTANIMS ? e.pos.y : e.pos.x))); return; } - if (m_sTouchData.touchFocusLockSurface) { - const auto PMONITOR = g_pCompositor->getMonitorFromID(m_sTouchData.touchFocusLockSurface->iMonitorID); + if (m_touchData.touchFocusLockSurface) { + const auto PMONITOR = g_pCompositor->getMonitorFromID(m_touchData.touchFocusLockSurface->iMonitorID); g_pCompositor->warpCursorTo({PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y}, true); auto local = g_pInputManager->getMouseCoordsInternal() - PMONITOR->m_position; g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local); - } else if (validMapped(m_sTouchData.touchFocusWindow)) { - const auto PMONITOR = m_sTouchData.touchFocusWindow->m_monitor.lock(); + } else if (validMapped(m_touchData.touchFocusWindow)) { + const auto PMONITOR = m_touchData.touchFocusWindow->m_monitor.lock(); g_pCompositor->warpCursorTo({PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y}, true); - auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin; - if (m_sTouchData.touchFocusWindow->m_isX11) - local = local * m_sTouchData.touchFocusWindow->m_X11SurfaceScaledBy; + auto local = g_pInputManager->getMouseCoordsInternal() - m_touchData.touchSurfaceOrigin; + if (m_touchData.touchFocusWindow->m_isX11) + local = local * m_touchData.touchFocusWindow->m_X11SurfaceScaledBy; g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local); - } else if (!m_sTouchData.touchFocusLS.expired()) { - const auto PMONITOR = m_sTouchData.touchFocusLS->m_monitor.lock(); + } else if (!m_touchData.touchFocusLS.expired()) { + const auto PMONITOR = m_touchData.touchFocusLS->m_monitor.lock(); g_pCompositor->warpCursorTo({PMONITOR->m_position.x + e.pos.x * PMONITOR->m_size.x, PMONITOR->m_position.y + e.pos.y * PMONITOR->m_size.y}, true); - const auto local = g_pInputManager->getMouseCoordsInternal() - m_sTouchData.touchSurfaceOrigin; + const auto local = g_pInputManager->getMouseCoordsInternal() - m_touchData.touchSurfaceOrigin; g_pSeatManager->sendTouchMotion(e.timeMs, e.touchID, local); } -- cgit v1.2.3