Update keyboard modifier state on seat after each key event
The layout might have changed, thus we should notify the client about it. The server ensures that on no state change it's not sent to the client.
This commit is contained in:
parent
2e36c4b7ca
commit
83a4fe5408
3 changed files with 4 additions and 30 deletions
11
input.cpp
11
input.cpp
|
@ -792,17 +792,6 @@ void InputRedirection::setupWorkspace()
|
|||
);
|
||||
}
|
||||
);
|
||||
connect(this, &InputRedirection::keyboardModifiersChanged, waylandServer(),
|
||||
[this] {
|
||||
if (!waylandServer()->seat()) {
|
||||
return;
|
||||
}
|
||||
waylandServer()->seat()->updateKeyboardModifiers(m_keyboard->xkb()->getMods(XKB_STATE_MODS_DEPRESSED),
|
||||
m_keyboard->xkb()->getMods(XKB_STATE_MODS_LATCHED),
|
||||
m_keyboard->xkb()->getMods(XKB_STATE_MODS_LOCKED),
|
||||
m_keyboard->xkb()->getGroup());
|
||||
}
|
||||
);
|
||||
connect(workspace(), &Workspace::configChanged, this, &InputRedirection::reconfigure);
|
||||
|
||||
m_keyboard->init();
|
||||
|
|
|
@ -279,6 +279,10 @@ void Xkb::updateModifiers()
|
|||
mods |= Qt::MetaModifier;
|
||||
}
|
||||
m_modifiers = mods;
|
||||
waylandServer()->seat()->updateKeyboardModifiers(xkb_state_serialize_mods(m_state, xkb_state_component(XKB_STATE_MODS_DEPRESSED)),
|
||||
xkb_state_serialize_mods(m_state, xkb_state_component(XKB_STATE_MODS_LATCHED)),
|
||||
xkb_state_serialize_mods(m_state, xkb_state_component(XKB_STATE_MODS_LOCKED)),
|
||||
xkb_state_serialize_layout(m_state, XKB_STATE_LAYOUT_EFFECTIVE));
|
||||
}
|
||||
|
||||
xkb_keysym_t Xkb::toKeysym(uint32_t key)
|
||||
|
@ -309,22 +313,6 @@ Qt::Key Xkb::toQtKey(xkb_keysym_t keysym)
|
|||
return static_cast<Qt::Key>(key);
|
||||
}
|
||||
|
||||
quint32 Xkb::getMods(quint32 components)
|
||||
{
|
||||
if (!m_state) {
|
||||
return 0;
|
||||
}
|
||||
return xkb_state_serialize_mods(m_state, xkb_state_component(components));
|
||||
}
|
||||
|
||||
quint32 Xkb::getGroup()
|
||||
{
|
||||
if (!m_state) {
|
||||
return 0;
|
||||
}
|
||||
return xkb_state_serialize_layout(m_state, XKB_STATE_LAYOUT_EFFECTIVE);
|
||||
}
|
||||
|
||||
bool Xkb::shouldKeyRepeat(quint32 key) const
|
||||
{
|
||||
if (!m_keymap) {
|
||||
|
|
|
@ -58,9 +58,6 @@ public:
|
|||
Qt::KeyboardModifiers modifiers() const;
|
||||
bool shouldKeyRepeat(quint32 key) const;
|
||||
|
||||
quint32 getMods(quint32 components);
|
||||
quint32 getGroup();
|
||||
|
||||
private:
|
||||
xkb_keymap *loadKeymapFromConfig();
|
||||
xkb_keymap *loadDefaultKeymap();
|
||||
|
|
Loading…
Reference in a new issue