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
This commit is contained in:
はれなよ 2024-06-30 03:05:07 +09:00 committed by GitHub
parent 1f43a5c859
commit 718afe271e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 <algorithm>
@ -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);
}