core: interpret touch as click (#788)

This commit is contained in:
ojafuenf 2025-06-04 08:14:11 +02:00 committed by GitHub
parent da1d076d84
commit 8455fc8ca6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View file

@ -5,6 +5,7 @@
#include <chrono>
#include <sys/mman.h>
#include <unistd.h>
#include <linux/input-event-codes.h>
CSeatManager::~CSeatManager() {
if (m_pXKBState)
@ -76,7 +77,15 @@ void CSeatManager::registerSeat(SP<CCWlSeat> seat) {
g_pHyprlock->onClick(button, state == WL_POINTER_BUTTON_STATE_PRESSED, g_pHyprlock->m_vMouseLocation);
});
}
if (caps & WL_SEAT_CAPABILITY_TOUCH) {
m_pTouch = makeShared<CCWlTouch>(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<CCWlKeyboard>(r->sendGetKeyboard());

View file

@ -17,6 +17,7 @@ class CSeatManager {
SP<CCWlKeyboard> m_pKeeb;
SP<CCWlPointer> m_pPointer;
SP<CCWlTouch> m_pTouch;
UP<CCursorShape> m_pCursorShape;