diff options
| author | Pppp1116 <pcaiadoguerreiro@gmail.com> | 2026-04-03 13:24:22 +0100 |
|---|---|---|
| committer | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-04-04 08:26:24 -0400 |
| commit | 0647b5449c5e5d7d314b03793232a13097fe753f (patch) | |
| tree | fc7c35b47d6d7a616eba1173d2a03fcf78eb3725 /src/protocols/RelativePointer.cpp | |
| parent | 4c897c2d476d42c716dee254d151ff23c66ef53b (diff) | |
protocols: avoid repeated per-client work in hot paths
Diffstat (limited to 'src/protocols/RelativePointer.cpp')
| -rw-r--r-- | src/protocols/RelativePointer.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/protocols/RelativePointer.cpp b/src/protocols/RelativePointer.cpp index 67bff46e..39a96309 100644 --- a/src/protocols/RelativePointer.cpp +++ b/src/protocols/RelativePointer.cpp @@ -22,8 +22,12 @@ wl_client* CRelativePointer::client() { } void CRelativePointer::sendRelativeMotion(uint64_t time, const Vector2D& delta, const Vector2D& deltaUnaccel) { - m_resource->sendRelativeMotion(time >> 32, time & 0xFFFFFFFF, wl_fixed_from_double(delta.x), wl_fixed_from_double(delta.y), wl_fixed_from_double(deltaUnaccel.x), - wl_fixed_from_double(deltaUnaccel.y)); + sendRelativeMotion(time >> 32, time & 0xFFFFFFFF, wl_fixed_from_double(delta.x), wl_fixed_from_double(delta.y), wl_fixed_from_double(deltaUnaccel.x), + wl_fixed_from_double(deltaUnaccel.y)); +} + +void CRelativePointer::sendRelativeMotion(uint32_t timeHi, uint32_t timeLo, wl_fixed_t dx, wl_fixed_t dy, wl_fixed_t dxUnaccel, wl_fixed_t dyUnaccel) { + m_resource->sendRelativeMotion(timeHi, timeLo, dx, dy, dxUnaccel, dyUnaccel); } CRelativePointerProtocol::CRelativePointerProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { @@ -58,16 +62,21 @@ void CRelativePointerProtocol::onGetRelativePointer(CZwpRelativePointerManagerV1 } void CRelativePointerProtocol::sendRelativeMotion(uint64_t time, const Vector2D& delta, const Vector2D& deltaUnaccel) { - if (!g_pSeatManager->m_state.pointerFocusResource) return; - const auto FOCUSED = g_pSeatManager->m_state.pointerFocusResource->client(); + const auto FOCUSED = g_pSeatManager->m_state.pointerFocusResource->client(); + const auto TIMEHI = sc<uint32_t>(time >> 32); + const auto TIMELO = sc<uint32_t>(time & 0xFFFFFFFF); + const auto DX = wl_fixed_from_double(delta.x); + const auto DY = wl_fixed_from_double(delta.y); + const auto DXUNACCEL = wl_fixed_from_double(deltaUnaccel.x); + const auto DYUNACCEL = wl_fixed_from_double(deltaUnaccel.y); for (auto const& rp : m_relativePointers) { if (FOCUSED != rp->client()) continue; - rp->sendRelativeMotion(time, delta, deltaUnaccel); + rp->sendRelativeMotion(TIMEHI, TIMELO, DX, DY, DXUNACCEL, DYUNACCEL); } } |
