diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index 852912e2..88fadd49 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -705,6 +705,7 @@ void CPointerManager::move(const Vector2D& deltaLogical) { PROTO::inputCapture->sendAbsoluteMotion(newPos, deltaLogical); + //TODO: Inhibit inputs warpTo(newPos); } diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 8a50a7bf..607e0683 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -19,6 +19,7 @@ #include "../../protocols/core/DataDevice.hpp" #include "../../protocols/core/Compositor.hpp" #include "../../protocols/XDGShell.hpp" +#include "../../protocols/InputCapture.hpp" #include "../../devices/Mouse.hpp" #include "../../devices/VirtualPointer.hpp" @@ -99,6 +100,7 @@ void CInputManager::onMouseMoved(IPointer::SMotionEvent e) { g_pPointerManager->move(DELTA); + //TODO: Inhibit inputs mouseMoveUnified(e.timeMs, false, e.mouse); m_tmrLastCursorMovement.reset(); @@ -545,6 +547,9 @@ void CInputManager::onMouseButton(IPointer::SButtonEvent e) { if (e.mouse) recheckMouseWarpOnMouseInput(); + PROTO::inputCapture->sendButton(e.button, (hyprlandInputCaptureManagerV1ButtonState)e.state); + + //TODO: Inhibit inputs m_tmrLastCursorMovement.reset(); if (e.state == WL_POINTER_BUTTON_STATE_PRESSED) { @@ -782,6 +787,13 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e) { if (e.mouse) recheckMouseWarpOnMouseInput(); + PROTO::inputCapture->sendAxis((hyprlandInputCaptureManagerV1Axis)e.axis, e.delta); + if (e.source == 0) + PROTO::inputCapture->sendAxisValue120((hyprlandInputCaptureManagerV1Axis)e.axis, e.delta); + else if (e.delta == 0) + PROTO::inputCapture->sendAxisStop((hyprlandInputCaptureManagerV1Axis)e.axis); + + //TODO: Inhibit inputs bool passEvent = g_pKeybindManager->onAxisEvent(e); if (!passEvent) @@ -862,6 +874,13 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e) { g_pSeatManager->sendPointerAxis(e.timeMs, e.axis, delta, deltaDiscrete, value120, e.source, WL_POINTER_AXIS_RELATIVE_DIRECTION_IDENTICAL); } +void CInputManager::onMouseFrame() { + PROTO::inputCapture->sendFrame(); + + //TODO: Inhibit inputs + g_pSeatManager->sendPointerFrame(); +} + Vector2D CInputManager::getMouseCoordsInternal() { return g_pPointerManager->position(); } @@ -1325,6 +1344,9 @@ void CInputManager::onKeyboardKey(std::any event, SP pKeyboard) { auto e = std::any_cast(event); + //TODO: Inhibit inputs + PROTO::inputCapture->sendKey(e.keycode, (hyprlandInputCaptureManagerV1KeyState)e.state); + if (passEvent) { const auto IME = m_sIMERelay.m_pIME.lock(); diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index 36c8144d..4ae8eb10 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -87,6 +87,7 @@ class CInputManager { void onMouseWarp(IPointer::SMotionAbsoluteEvent); void onMouseButton(IPointer::SButtonEvent); void onMouseWheel(IPointer::SAxisEvent); + void onMouseFrame(); void onKeyboardKey(std::any, SP); void onKeyboardMod(SP); diff --git a/src/protocols/InputCapture.cpp b/src/protocols/InputCapture.cpp index 889f2599..1d9bdecf 100644 --- a/src/protocols/InputCapture.cpp +++ b/src/protocols/InputCapture.cpp @@ -31,3 +31,39 @@ void CInputCaptureProtocol::sendAbsoluteMotion(const Vector2D& absolutePosition, wl_fixed_from_double(delta.y)); } } + +void CInputCaptureProtocol::sendKey(uint32_t keyCode, hyprlandInputCaptureManagerV1KeyState state) { + for (const UP& manager : m_vManagers) { + manager->sendKey(keyCode, state); + } +} + +void CInputCaptureProtocol::sendButton(uint32_t button, hyprlandInputCaptureManagerV1ButtonState state) { + for (const UP& manager : m_vManagers) { + manager->sendButton(button, state); + } +} + +void CInputCaptureProtocol::sendAxis(hyprlandInputCaptureManagerV1Axis axis, double value) { + for (const UP& manager : m_vManagers) { + manager->sendAxis(axis, value); + } +} + +void CInputCaptureProtocol::sendAxisValue120(hyprlandInputCaptureManagerV1Axis axis, int32_t value120) { + for (const UP& manager : m_vManagers) { + manager->sendAxisValue120(axis, value120); + } +} + +void CInputCaptureProtocol::sendAxisStop(hyprlandInputCaptureManagerV1Axis axis) { + for (const UP& manager : m_vManagers) { + manager->sendAxisStop(axis); + } +} + +void CInputCaptureProtocol::sendFrame() { + for (const UP& manager : m_vManagers) { + manager->sendFrame(); + } +} diff --git a/src/protocols/InputCapture.hpp b/src/protocols/InputCapture.hpp index 172c17dc..639a21f1 100644 --- a/src/protocols/InputCapture.hpp +++ b/src/protocols/InputCapture.hpp @@ -9,12 +9,20 @@ class CInputCaptureProtocol : public IWaylandProtocol { CInputCaptureProtocol(const wl_interface* iface, const int& ver, const std::string& name); virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id); void sendAbsoluteMotion(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); + void sendAxisValue120(hyprlandInputCaptureManagerV1Axis axis, int32_t value120); + void sendAxisStop(hyprlandInputCaptureManagerV1Axis axis); + + void sendFrame(); private: void onManagerResourceDestroy(wl_resource* res); void onCapture(CHyprlandInputCaptureManagerV1* pMgr); void onRelease(CHyprlandInputCaptureManagerV1* pMgr); + // std::vector> m_vManagers; };