input-capture: Init active property & upstream protocol changes

This commit is contained in:
Gwilherm Folliot 2024-09-30 12:31:31 +02:00
parent 6c211d49b5
commit 124582b8d2
No known key found for this signature in database
GPG key ID: 90236D3623DCD660
4 changed files with 7 additions and 8 deletions

View file

@ -674,8 +674,7 @@ void CPointerManager::move(const Vector2D& deltaLogical) {
const auto oldPos = pointerPos; const auto oldPos = pointerPos;
auto newPos = oldPos + Vector2D{std::isnan(deltaLogical.x) ? 0.0 : deltaLogical.x, std::isnan(deltaLogical.y) ? 0.0 : deltaLogical.y}; auto newPos = oldPos + Vector2D{std::isnan(deltaLogical.x) ? 0.0 : deltaLogical.x, std::isnan(deltaLogical.y) ? 0.0 : deltaLogical.y};
PROTO::inputCapture->sendMotion(newPos, deltaLogical);
PROTO::inputCapture->sendAbsoluteMotion(newPos, deltaLogical);
if (PROTO::inputCapture->isCaptured()) if (PROTO::inputCapture->isCaptured())
return; return;

View file

@ -1,7 +1,7 @@
#include "InputCapture.hpp" #include "InputCapture.hpp"
CInputCaptureProtocol::CInputCaptureProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) { 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) { void CInputCaptureProtocol::bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id) {
@ -31,9 +31,9 @@ bool CInputCaptureProtocol::isCaptured() {
return active; return active;
} }
void CInputCaptureProtocol::sendAbsoluteMotion(const Vector2D& absolutePosition, const Vector2D& delta) { void CInputCaptureProtocol::sendMotion(const Vector2D& absolutePosition, const Vector2D& delta) {
for (const UP<CHyprlandInputCaptureManagerV1>& manager : m_vManagers) { for (const UP<CHyprlandInputCaptureManagerV1>& 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)); wl_fixed_from_double(delta.y));
} }
} }

View file

@ -12,7 +12,7 @@ class CInputCaptureProtocol : public IWaylandProtocol {
bool isCaptured(); 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 sendKey(uint32_t keyCode, hyprlandInputCaptureManagerV1KeyState state);
void sendButton(uint32_t button, hyprlandInputCaptureManagerV1ButtonState state); void sendButton(uint32_t button, hyprlandInputCaptureManagerV1ButtonState state);
void sendAxis(hyprlandInputCaptureManagerV1Axis axis, double value); void sendAxis(hyprlandInputCaptureManagerV1Axis axis, double value);
@ -22,7 +22,7 @@ class CInputCaptureProtocol : public IWaylandProtocol {
void sendFrame(); void sendFrame();
private: private:
bool active; bool active = false;
void onManagerResourceDestroy(wl_resource* res); void onManagerResourceDestroy(wl_resource* res);
void onCapture(CHyprlandInputCaptureManagerV1* pMgr); void onCapture(CHyprlandInputCaptureManagerV1* pMgr);

@ -1 +1 @@
Subproject commit 53a994b2efbcc19862125fc9a8d5a752a24a0f20 Subproject commit 479cc226451c264396a4c442710d6b56dce2fa46