From 877fb5b93ada9b25b4d2f5ca5f69370fa345f1ac Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 16 Apr 2025 01:37:48 +0100 Subject: time: move to stl's clocks and move timer --- src/managers/input/InputManager.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/managers/input/InputManager.cpp') diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 4c5de729..0665e0d2 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -36,6 +36,8 @@ #include "../../managers/EventManager.hpp" #include "../../managers/LayoutManager.hpp" +#include "../../helpers/time/Time.hpp" + #include CInputManager::CInputManager() { @@ -142,10 +144,8 @@ void CInputManager::onMouseWarp(IPointer::SMotionAbsoluteEvent e) { } void CInputManager::simulateMouseMovement() { - timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); m_vLastCursorPosFloored = m_vLastCursorPosFloored - Vector2D(1, 1); // hack: force the mouseMoveUnified to report without making this a refocus. - mouseMoveUnified(now.tv_sec * 1000 + now.tv_nsec / 10000000); + mouseMoveUnified(Time::millis(Time::steadyNow())); } void CInputManager::sendMotionEventsToFocused() { @@ -156,9 +156,6 @@ void CInputManager::sendMotionEventsToFocused() { const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus.lock()); const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus.lock()); - timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); - const auto LOCAL = getMouseCoordsInternal() - (PWINDOW ? PWINDOW->m_vRealPosition->goal() : (PLS ? Vector2D{PLS->geometry.x, PLS->geometry.y} : Vector2D{})); m_bEmptyFocusCursorSet = false; @@ -1746,11 +1743,8 @@ void CInputManager::releaseAllMouseButtons() { if (PROTO::data->dndActive()) return; - timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); - for (auto const& mb : buttonsCopy) { - g_pSeatManager->sendPointerButton(now.tv_sec * 1000 + now.tv_nsec / 1000000, mb, WL_POINTER_BUTTON_STATE_RELEASED); + g_pSeatManager->sendPointerButton(Time::millis(Time::steadyNow()), mb, WL_POINTER_BUTTON_STATE_RELEASED); } m_lCurrentlyHeldButtons.clear(); -- cgit v1.2.3