summaryrefslogtreecommitdiff
path: root/src/protocols/PointerGestures.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-05-10 18:27:57 +0100
committerVaxry <43317083+vaxerski@users.noreply.github.com>2024-05-14 23:02:24 +0100
commit121d3a72137d4780602cf245704615f63357ea22 (patch)
treeb25c8a3ee7b239006281f0e00110d1c324b8cedc /src/protocols/PointerGestures.cpp
parent4cdddcfe466cb21db81af0ac39e51cc15f574da9 (diff)
wl_seat: move to hyprland impl
Diffstat (limited to 'src/protocols/PointerGestures.cpp')
-rw-r--r--src/protocols/PointerGestures.cpp52
1 files changed, 27 insertions, 25 deletions
diff --git a/src/protocols/PointerGestures.cpp b/src/protocols/PointerGestures.cpp
index 5b5d1c52..2bfd74da 100644
--- a/src/protocols/PointerGestures.cpp
+++ b/src/protocols/PointerGestures.cpp
@@ -1,5 +1,7 @@
#include "PointerGestures.hpp"
#include "../Compositor.hpp"
+#include "../managers/SeatManager.hpp"
+#include "core/Seat.hpp"
#define LOGM PROTO::pointerGestures->protoLog
@@ -103,26 +105,26 @@ void CPointerGesturesProtocol::onGetHoldGesture(CZwpPointerGesturesV1* pMgr, uin
}
void CPointerGesturesProtocol::swipeBegin(uint32_t timeMs, uint32_t fingers) {
- if (!g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
+ if (!g_pSeatManager->state.pointerFocusResource)
return;
- const auto FOCUSEDCLIENT = g_pCompositor->m_sSeat.seat->pointer_state.focused_client->client;
+ const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client();
- const auto SERIAL = wlr_seat_client_next_serial(g_pCompositor->m_sSeat.seat->pointer_state.focused_client);
+ const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock());
for (auto& sw : m_vSwipes) {
if (sw->resource->client() != FOCUSEDCLIENT)
continue;
- sw->resource->sendBegin(SERIAL, timeMs, g_pCompositor->m_sSeat.seat->pointer_state.focused_surface->resource, fingers);
+ sw->resource->sendBegin(SERIAL, timeMs, g_pSeatManager->state.pointerFocus->resource, fingers);
}
}
void CPointerGesturesProtocol::swipeUpdate(uint32_t timeMs, const Vector2D& delta) {
- if (!g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
+ if (!g_pSeatManager->state.pointerFocusResource)
return;
- const auto FOCUSEDCLIENT = g_pCompositor->m_sSeat.seat->pointer_state.focused_client->client;
+ const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client();
for (auto& sw : m_vSwipes) {
if (sw->resource->client() != FOCUSEDCLIENT)
@@ -133,12 +135,12 @@ void CPointerGesturesProtocol::swipeUpdate(uint32_t timeMs, const Vector2D& delt
}
void CPointerGesturesProtocol::swipeEnd(uint32_t timeMs, bool cancelled) {
- if (!g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
+ if (!g_pSeatManager->state.pointerFocusResource)
return;
- const auto FOCUSEDCLIENT = g_pCompositor->m_sSeat.seat->pointer_state.focused_client->client;
+ const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client();
- const auto SERIAL = wlr_seat_client_next_serial(g_pCompositor->m_sSeat.seat->pointer_state.focused_client);
+ const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock());
for (auto& sw : m_vSwipes) {
if (sw->resource->client() != FOCUSEDCLIENT)
@@ -149,26 +151,26 @@ void CPointerGesturesProtocol::swipeEnd(uint32_t timeMs, bool cancelled) {
}
void CPointerGesturesProtocol::pinchBegin(uint32_t timeMs, uint32_t fingers) {
- if (!g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
+ if (!g_pSeatManager->state.pointerFocusResource)
return;
- const auto FOCUSEDCLIENT = g_pCompositor->m_sSeat.seat->pointer_state.focused_client->client;
+ const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client();
- const auto SERIAL = wlr_seat_client_next_serial(g_pCompositor->m_sSeat.seat->pointer_state.focused_client);
+ const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock());
for (auto& sw : m_vPinches) {
if (sw->resource->client() != FOCUSEDCLIENT)
continue;
- sw->resource->sendBegin(SERIAL, timeMs, g_pCompositor->m_sSeat.seat->pointer_state.focused_surface->resource, fingers);
+ sw->resource->sendBegin(SERIAL, timeMs, g_pSeatManager->state.pointerFocus->resource, fingers);
}
}
void CPointerGesturesProtocol::pinchUpdate(uint32_t timeMs, const Vector2D& delta, double scale, double rotation) {
- if (!g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
+ if (!g_pSeatManager->state.pointerFocusResource)
return;
- const auto FOCUSEDCLIENT = g_pCompositor->m_sSeat.seat->pointer_state.focused_client->client;
+ const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client();
for (auto& sw : m_vPinches) {
if (sw->resource->client() != FOCUSEDCLIENT)
@@ -179,12 +181,12 @@ void CPointerGesturesProtocol::pinchUpdate(uint32_t timeMs, const Vector2D& delt
}
void CPointerGesturesProtocol::pinchEnd(uint32_t timeMs, bool cancelled) {
- if (!g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
+ if (!g_pSeatManager->state.pointerFocusResource)
return;
- const auto FOCUSEDCLIENT = g_pCompositor->m_sSeat.seat->pointer_state.focused_client->client;
+ const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client();
- const auto SERIAL = wlr_seat_client_next_serial(g_pCompositor->m_sSeat.seat->pointer_state.focused_client);
+ const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock());
for (auto& sw : m_vPinches) {
if (sw->resource->client() != FOCUSEDCLIENT)
@@ -195,28 +197,28 @@ void CPointerGesturesProtocol::pinchEnd(uint32_t timeMs, bool cancelled) {
}
void CPointerGesturesProtocol::holdBegin(uint32_t timeMs, uint32_t fingers) {
- if (!g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
+ if (!g_pSeatManager->state.pointerFocusResource)
return;
- const auto FOCUSEDCLIENT = g_pCompositor->m_sSeat.seat->pointer_state.focused_client->client;
+ const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client();
- const auto SERIAL = wlr_seat_client_next_serial(g_pCompositor->m_sSeat.seat->pointer_state.focused_client);
+ const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock());
for (auto& sw : m_vHolds) {
if (sw->resource->client() != FOCUSEDCLIENT)
continue;
- sw->resource->sendBegin(SERIAL, timeMs, g_pCompositor->m_sSeat.seat->pointer_state.focused_surface->resource, fingers);
+ sw->resource->sendBegin(SERIAL, timeMs, g_pSeatManager->state.pointerFocus->resource, fingers);
}
}
void CPointerGesturesProtocol::holdEnd(uint32_t timeMs, bool cancelled) {
- if (!g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
+ if (!g_pSeatManager->state.pointerFocusResource)
return;
- const auto FOCUSEDCLIENT = g_pCompositor->m_sSeat.seat->pointer_state.focused_client->client;
+ const auto FOCUSEDCLIENT = g_pSeatManager->state.pointerFocusResource->client();
- const auto SERIAL = wlr_seat_client_next_serial(g_pCompositor->m_sSeat.seat->pointer_state.focused_client);
+ const auto SERIAL = g_pSeatManager->nextSerial(g_pSeatManager->state.pointerFocusResource.lock());
for (auto& sw : m_vHolds) {
if (sw->resource->client() != FOCUSEDCLIENT)