xkb: always update keysym
Previously m_keysym was only updated on key press. This caused issues when multiple keys are pressed at the same time. E.g., if the user presses A, presses B, releases A, releases B, the actual events sent by kwin was A pressed; B pressed; B released; B released. Also call xkb_state_update_key after xkb_state_key_get_one_sym, as recommended by the libxkbcommon documentation
This commit is contained in:
parent
92d29ed7f0
commit
380795423d
1 changed files with 17 additions and 16 deletions
|
@ -395,10 +395,12 @@ void Xkb::updateKey(uint32_t key, InputRedirection::KeyboardKeyState state)
|
||||||
if (!m_keymap || !m_state) {
|
if (!m_keymap || !m_state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xkb_state_update_key(m_state, key + EVDEV_OFFSET, static_cast<xkb_key_direction>(state));
|
|
||||||
if (state == InputRedirection::KeyboardKeyPressed) {
|
|
||||||
const auto sym = toKeysym(key);
|
const auto sym = toKeysym(key);
|
||||||
if (m_compose.state && xkb_compose_state_feed(m_compose.state, sym) == XKB_COMPOSE_FEED_ACCEPTED) {
|
xkb_state_update_key(m_state, key + EVDEV_OFFSET, static_cast<xkb_key_direction>(state));
|
||||||
|
if (m_compose.state) {
|
||||||
|
if (state == InputRedirection::KeyboardKeyPressed) {
|
||||||
|
xkb_compose_state_feed(m_compose.state, sym);
|
||||||
|
}
|
||||||
switch (xkb_compose_state_get_status(m_compose.state)) {
|
switch (xkb_compose_state_get_status(m_compose.state)) {
|
||||||
case XKB_COMPOSE_NOTHING:
|
case XKB_COMPOSE_NOTHING:
|
||||||
m_keysym = sym;
|
m_keysym = sym;
|
||||||
|
@ -413,7 +415,6 @@ void Xkb::updateKey(uint32_t key, InputRedirection::KeyboardKeyState state)
|
||||||
} else {
|
} else {
|
||||||
m_keysym = sym;
|
m_keysym = sym;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
updateModifiers();
|
updateModifiers();
|
||||||
updateConsumedModifiers(key);
|
updateConsumedModifiers(key);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue