time: move to stl's clocks and move timer

This commit is contained in:
Vaxry
2025-04-16 01:37:48 +01:00
parent 0e521788bc
commit 877fb5b93a
43 changed files with 392 additions and 248 deletions

View File

@@ -36,6 +36,8 @@
#include "../../managers/EventManager.hpp"
#include "../../managers/LayoutManager.hpp"
#include "../../helpers/time/Time.hpp"
#include <aquamarine/input/Input.hpp>
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();