From 8455fc8ca6432a72313cd285488333ba5977fbe5 Mon Sep 17 00:00:00 2001 From: ojafuenf <50103673+ojafuenf@users.noreply.github.com> Date: Wed, 4 Jun 2025 08:14:11 +0200 Subject: [PATCH] core: interpret touch as click (#788) --- src/core/Seat.cpp | 11 ++++++++++- src/core/Seat.hpp | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/core/Seat.cpp b/src/core/Seat.cpp index 408e64d..a3f811c 100644 --- a/src/core/Seat.cpp +++ b/src/core/Seat.cpp @@ -5,6 +5,7 @@ #include #include #include +#include CSeatManager::~CSeatManager() { if (m_pXKBState) @@ -76,7 +77,15 @@ void CSeatManager::registerSeat(SP seat) { g_pHyprlock->onClick(button, state == WL_POINTER_BUTTON_STATE_PRESSED, g_pHyprlock->m_vMouseLocation); }); } - + if (caps & WL_SEAT_CAPABILITY_TOUCH) { + m_pTouch = makeShared(r->sendGetTouch()); + m_pTouch->setDown([](CCWlTouch* r, uint32_t serial, uint32_t time, wl_proxy* surface, int32_t id, wl_fixed_t x, wl_fixed_t y) { + g_pHyprlock->onClick(BTN_LEFT, true, {wl_fixed_to_double(x), wl_fixed_to_double(y)}); + }); + m_pTouch->setUp([](CCWlTouch* r, uint32_t serial, uint32_t time, int32_t id) { + g_pHyprlock->onClick(BTN_LEFT, false, {0, 0}); + }); + }; if (caps & WL_SEAT_CAPABILITY_KEYBOARD) { m_pKeeb = makeShared(r->sendGetKeyboard()); diff --git a/src/core/Seat.hpp b/src/core/Seat.hpp index bf6a7a0..804e062 100644 --- a/src/core/Seat.hpp +++ b/src/core/Seat.hpp @@ -17,6 +17,7 @@ class CSeatManager { SP m_pKeeb; SP m_pPointer; + SP m_pTouch; UP m_pCursorShape;