From 0237e39f74a7facf51d40bc4c95f6ce8ce3cdc2e Mon Sep 17 00:00:00 2001 From: Vaxry Date: Wed, 1 May 2024 19:40:35 +0100 Subject: protocols: utilize hyprwayland-scanner 0.3.3 functions stuff like ::version(), ::client(), ::error() etc --- src/protocols/PointerGestures.cpp | 53 +++++++++++++-------------------------- 1 file changed, 17 insertions(+), 36 deletions(-) (limited to 'src/protocols/PointerGestures.cpp') diff --git a/src/protocols/PointerGestures.cpp b/src/protocols/PointerGestures.cpp index a6f3d19c..b3840093 100644 --- a/src/protocols/PointerGestures.cpp +++ b/src/protocols/PointerGestures.cpp @@ -70,36 +70,33 @@ void CPointerGesturesProtocol::onGestureDestroy(CPointerGestureHold* gesture) { } void CPointerGesturesProtocol::onGetPinchGesture(CZwpPointerGesturesV1* pMgr, uint32_t id, wl_resource* pointer) { - const auto CLIENT = wl_resource_get_client(pMgr->resource()); - const auto RESOURCE = - m_vPinches.emplace_back(std::make_unique(std::make_shared(CLIENT, wl_resource_get_version(pMgr->resource()), id))).get(); + const auto CLIENT = pMgr->client(); + const auto RESOURCE = m_vPinches.emplace_back(std::make_unique(std::make_shared(CLIENT, pMgr->version(), id))).get(); if (!RESOURCE->good()) { - wl_resource_post_no_memory(pMgr->resource()); + pMgr->noMemory(); LOGM(ERR, "Couldn't create gesture"); return; } } void CPointerGesturesProtocol::onGetSwipeGesture(CZwpPointerGesturesV1* pMgr, uint32_t id, wl_resource* pointer) { - const auto CLIENT = wl_resource_get_client(pMgr->resource()); - const auto RESOURCE = - m_vSwipes.emplace_back(std::make_unique(std::make_shared(CLIENT, wl_resource_get_version(pMgr->resource()), id))).get(); + const auto CLIENT = pMgr->client(); + const auto RESOURCE = m_vSwipes.emplace_back(std::make_unique(std::make_shared(CLIENT, pMgr->version(), id))).get(); if (!RESOURCE->good()) { - wl_resource_post_no_memory(pMgr->resource()); + pMgr->noMemory(); LOGM(ERR, "Couldn't create gesture"); return; } } void CPointerGesturesProtocol::onGetHoldGesture(CZwpPointerGesturesV1* pMgr, uint32_t id, wl_resource* pointer) { - const auto CLIENT = wl_resource_get_client(pMgr->resource()); - const auto RESOURCE = - m_vHolds.emplace_back(std::make_unique(std::make_shared(CLIENT, wl_resource_get_version(pMgr->resource()), id))).get(); + const auto CLIENT = pMgr->client(); + const auto RESOURCE = m_vHolds.emplace_back(std::make_unique(std::make_shared(CLIENT, pMgr->version(), id))).get(); if (!RESOURCE->good()) { - wl_resource_post_no_memory(pMgr->resource()); + pMgr->noMemory(); LOGM(ERR, "Couldn't create gesture"); return; } @@ -114,9 +111,7 @@ void CPointerGesturesProtocol::swipeBegin(uint32_t timeMs, uint32_t fingers) { const auto SERIAL = wlr_seat_client_next_serial(g_pCompositor->m_sSeat.seat->pointer_state.focused_client); for (auto& sw : m_vSwipes) { - const auto CLIENT = wl_resource_get_client(sw->resource->resource()); - - if (CLIENT != FOCUSEDCLIENT) + if (sw->resource->client() != FOCUSEDCLIENT) continue; sw->resource->sendBegin(SERIAL, timeMs, g_pCompositor->m_sSeat.seat->pointer_state.focused_surface->resource, fingers); @@ -130,9 +125,7 @@ void CPointerGesturesProtocol::swipeUpdate(uint32_t timeMs, const Vector2D& delt const auto FOCUSEDCLIENT = g_pCompositor->m_sSeat.seat->pointer_state.focused_client->client; for (auto& sw : m_vSwipes) { - const auto CLIENT = wl_resource_get_client(sw->resource->resource()); - - if (CLIENT != FOCUSEDCLIENT) + if (sw->resource->client() != FOCUSEDCLIENT) continue; sw->resource->sendUpdate(timeMs, wl_fixed_from_double(delta.x), wl_fixed_from_double(delta.y)); @@ -148,9 +141,7 @@ void CPointerGesturesProtocol::swipeEnd(uint32_t timeMs, bool cancelled) { const auto SERIAL = wlr_seat_client_next_serial(g_pCompositor->m_sSeat.seat->pointer_state.focused_client); for (auto& sw : m_vSwipes) { - const auto CLIENT = wl_resource_get_client(sw->resource->resource()); - - if (CLIENT != FOCUSEDCLIENT) + if (sw->resource->client() != FOCUSEDCLIENT) continue; sw->resource->sendEnd(SERIAL, timeMs, cancelled); @@ -166,9 +157,7 @@ void CPointerGesturesProtocol::pinchBegin(uint32_t timeMs, uint32_t fingers) { const auto SERIAL = wlr_seat_client_next_serial(g_pCompositor->m_sSeat.seat->pointer_state.focused_client); for (auto& sw : m_vPinches) { - const auto CLIENT = wl_resource_get_client(sw->resource->resource()); - - if (CLIENT != FOCUSEDCLIENT) + if (sw->resource->client() != FOCUSEDCLIENT) continue; sw->resource->sendBegin(SERIAL, timeMs, g_pCompositor->m_sSeat.seat->pointer_state.focused_surface->resource, fingers); @@ -182,9 +171,7 @@ void CPointerGesturesProtocol::pinchUpdate(uint32_t timeMs, const Vector2D& delt const auto FOCUSEDCLIENT = g_pCompositor->m_sSeat.seat->pointer_state.focused_client->client; for (auto& sw : m_vPinches) { - const auto CLIENT = wl_resource_get_client(sw->resource->resource()); - - if (CLIENT != FOCUSEDCLIENT) + if (sw->resource->client() != FOCUSEDCLIENT) continue; sw->resource->sendUpdate(timeMs, wl_fixed_from_double(delta.x), wl_fixed_from_double(delta.y), wl_fixed_from_double(scale), wl_fixed_from_double(rotation)); @@ -200,9 +187,7 @@ void CPointerGesturesProtocol::pinchEnd(uint32_t timeMs, bool cancelled) { const auto SERIAL = wlr_seat_client_next_serial(g_pCompositor->m_sSeat.seat->pointer_state.focused_client); for (auto& sw : m_vPinches) { - const auto CLIENT = wl_resource_get_client(sw->resource->resource()); - - if (CLIENT != FOCUSEDCLIENT) + if (sw->resource->client() != FOCUSEDCLIENT) continue; sw->resource->sendEnd(SERIAL, timeMs, cancelled); @@ -218,9 +203,7 @@ void CPointerGesturesProtocol::holdBegin(uint32_t timeMs, uint32_t fingers) { const auto SERIAL = wlr_seat_client_next_serial(g_pCompositor->m_sSeat.seat->pointer_state.focused_client); for (auto& sw : m_vHolds) { - const auto CLIENT = wl_resource_get_client(sw->resource->resource()); - - if (CLIENT != FOCUSEDCLIENT) + if (sw->resource->client() != FOCUSEDCLIENT) continue; sw->resource->sendBegin(SERIAL, timeMs, g_pCompositor->m_sSeat.seat->pointer_state.focused_surface->resource, fingers); @@ -236,9 +219,7 @@ void CPointerGesturesProtocol::holdEnd(uint32_t timeMs, bool cancelled) { const auto SERIAL = wlr_seat_client_next_serial(g_pCompositor->m_sSeat.seat->pointer_state.focused_client); for (auto& sw : m_vHolds) { - const auto CLIENT = wl_resource_get_client(sw->resource->resource()); - - if (CLIENT != FOCUSEDCLIENT) + if (sw->resource->client() != FOCUSEDCLIENT) continue; sw->resource->sendEnd(SERIAL, timeMs, cancelled); -- cgit v1.2.3