Foward modifiers after disabling sticky keys

When disabling sticky keys while a key is latched or locked we unlatch the key, but don't tell the client until the next key event

Call forwardModifiers to tell the client immediately
This commit is contained in:
Nicolas Fella 2024-07-09 16:42:44 +02:00
parent e14e4a1f8e
commit 6f410383fc

View file

@ -53,6 +53,7 @@ void StickyKeysFilter::loadConfig(const KConfigGroup &group)
if (it->second == KeyState::Locked) {
it->second = KeyState::None;
KWin::input()->keyboard()->xkb()->setModifierLocked(keyToModifier(static_cast<Qt::Key>(it->first)), false);
KWin::input()->keyboard()->xkb()->forwardModifiers();
}
}
}
@ -60,11 +61,12 @@ void StickyKeysFilter::loadConfig(const KConfigGroup &group)
if (group.readEntry<bool>("StickyKeys", false)) {
KWin::input()->prependInputEventFilter(this);
} else {
// sticky keys are deactivated, unlatch all latched keys
// sticky keys are deactivated, unlatch all latched/locked keys
for (auto it = m_keyStates.keyValueBegin(); it != m_keyStates.keyValueEnd(); ++it) {
if (it->second != KeyState::None) {
it->second = KeyState::None;
KWin::input()->keyboard()->xkb()->setModifierLatched(keyToModifier(static_cast<Qt::Key>(it->first)), false);
KWin::input()->keyboard()->xkb()->forwardModifiers();
}
}
}