From ac0e675f3b0bcd9f5c01f43b050d1da6d1215be0 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Mon, 5 Dec 2022 14:28:27 +0000 Subject: better capability handling --- src/managers/input/InputManager.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'src/managers/input/InputManager.cpp') diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 228d64ad..b6fa3996 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1014,24 +1014,20 @@ void Events::listener_commitConstraint(void* owner, void* data) { //g_pInputManager->recheckConstraint((SMouse*)owner); } -void CInputManager::updateCapabilities(wlr_input_device* pDev) { - // TODO: this is dumb - - switch (pDev->type) { - case WLR_INPUT_DEVICE_KEYBOARD: - m_uiCapabilities |= WL_SEAT_CAPABILITY_KEYBOARD; - break; - case WLR_INPUT_DEVICE_POINTER: - m_uiCapabilities |= WL_SEAT_CAPABILITY_POINTER; - break; - case WLR_INPUT_DEVICE_TOUCH: - m_uiCapabilities |= WL_SEAT_CAPABILITY_TOUCH; - break; - default: - break; - } - - wlr_seat_set_capabilities(g_pCompositor->m_sSeat.seat, m_uiCapabilities); +void CInputManager::updateCapabilities() { + uint32_t caps = 0; + + if (!m_lKeyboards.empty()) + caps |= WL_SEAT_CAPABILITY_KEYBOARD; + if (!m_lMice.empty()) + caps |= WL_SEAT_CAPABILITY_POINTER; + if (!m_lTouchDevices.empty()) + caps |= WL_SEAT_CAPABILITY_TOUCH; + if (!m_lTabletTools.empty()) + caps |= WL_SEAT_CAPABILITY_POINTER; + + wlr_seat_set_capabilities(g_pCompositor->m_sSeat.seat, caps); + m_uiCapabilities = caps; } uint32_t CInputManager::accumulateModsFromAllKBs() { -- cgit v1.2.3