From 124582b8d200b3ac94f614c2eb1e6f179bcb14b4 Mon Sep 17 00:00:00 2001 From: Gwilherm Folliot Date: Mon, 30 Sep 2024 12:31:31 +0200 Subject: [PATCH] input-capture: Init active property & upstream protocol changes --- src/managers/PointerManager.cpp | 3 +-- src/protocols/InputCapture.cpp | 6 +++--- src/protocols/InputCapture.hpp | 4 ++-- subprojects/hyprland-protocols | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index cc3671f3..4ecc362b 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -674,8 +674,7 @@ void CPointerManager::move(const Vector2D& deltaLogical) { const auto oldPos = pointerPos; auto newPos = oldPos + Vector2D{std::isnan(deltaLogical.x) ? 0.0 : deltaLogical.x, std::isnan(deltaLogical.y) ? 0.0 : deltaLogical.y}; - - PROTO::inputCapture->sendAbsoluteMotion(newPos, deltaLogical); + PROTO::inputCapture->sendMotion(newPos, deltaLogical); if (PROTO::inputCapture->isCaptured()) return; diff --git a/src/protocols/InputCapture.cpp b/src/protocols/InputCapture.cpp index e8ac910a..2fa99ac2 100644 --- a/src/protocols/InputCapture.cpp +++ b/src/protocols/InputCapture.cpp @@ -1,7 +1,7 @@ #include "InputCapture.hpp" CInputCaptureProtocol::CInputCaptureProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { - active = false; + ; } void CInputCaptureProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) { @@ -31,9 +31,9 @@ bool CInputCaptureProtocol::isCaptured() { return active; } -void CInputCaptureProtocol::sendAbsoluteMotion(const Vector2D& absolutePosition, const Vector2D& delta) { +void CInputCaptureProtocol::sendMotion(const Vector2D& absolutePosition, const Vector2D& delta) { for (const UP& manager : m_vManagers) { - manager->sendAbsoluteMotion(wl_fixed_from_double(absolutePosition.x), wl_fixed_from_double(absolutePosition.y), wl_fixed_from_double(delta.x), + manager->sendMotion(wl_fixed_from_double(absolutePosition.x), wl_fixed_from_double(absolutePosition.y), wl_fixed_from_double(delta.x), wl_fixed_from_double(delta.y)); } } diff --git a/src/protocols/InputCapture.hpp b/src/protocols/InputCapture.hpp index fafe81bb..efe69463 100644 --- a/src/protocols/InputCapture.hpp +++ b/src/protocols/InputCapture.hpp @@ -12,7 +12,7 @@ class CInputCaptureProtocol : public IWaylandProtocol { bool isCaptured(); // - void sendAbsoluteMotion(const Vector2D& absolutePosition, const Vector2D& delta); + void sendMotion(const Vector2D& absolutePosition, const Vector2D& delta); void sendKey(uint32_t keyCode, hyprlandInputCaptureManagerV1KeyState state); void sendButton(uint32_t button, hyprlandInputCaptureManagerV1ButtonState state); void sendAxis(hyprlandInputCaptureManagerV1Axis axis, double value); @@ -22,7 +22,7 @@ class CInputCaptureProtocol : public IWaylandProtocol { void sendFrame(); private: - bool active; + bool active = false; void onManagerResourceDestroy(wl_resource* res); void onCapture(CHyprlandInputCaptureManagerV1* pMgr); diff --git a/subprojects/hyprland-protocols b/subprojects/hyprland-protocols index 53a994b2..479cc226 160000 --- a/subprojects/hyprland-protocols +++ b/subprojects/hyprland-protocols @@ -1 +1 @@ -Subproject commit 53a994b2efbcc19862125fc9a8d5a752a24a0f20 +Subproject commit 479cc226451c264396a4c442710d6b56dce2fa46