From 718afe271ecebfe6711453b9cfee90fa49a7e761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AF=E3=82=8C=E3=81=AA=E3=82=88?= <123649644+harenayo@users.noreply.github.com> Date: Sun, 30 Jun 2024 03:05:07 +0900 Subject: [PATCH] seat: don't send keyboard data without a keyboard cap (#6697) * Fix #6279: prevent sending keymap or repeat info events by keyboards without keyboard capability * Remove brackets --- src/protocols/core/Seat.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/protocols/core/Seat.cpp b/src/protocols/core/Seat.cpp index f578292a..464a901c 100644 --- a/src/protocols/core/Seat.cpp +++ b/src/protocols/core/Seat.cpp @@ -2,6 +2,7 @@ #include "Compositor.hpp" #include "DataDevice.hpp" #include "../../devices/IKeyboard.hpp" +#include "../../devices/IHID.hpp" #include "../../managers/SeatManager.hpp" #include "../../config/ConfigValue.hpp" #include @@ -451,12 +452,18 @@ void CWLSeatProtocol::updateCapabilities(uint32_t caps) { } void CWLSeatProtocol::updateKeymap() { + if (!(currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD)) + return; + for (auto& k : m_vKeyboards) { k->sendKeymap(g_pSeatManager->keyboard.lock()); } } void CWLSeatProtocol::updateRepeatInfo(uint32_t rate, uint32_t delayMs) { + if (!(currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD)) + return; + for (auto& k : m_vKeyboards) { k->repeatInfo(rate, delayMs); }