diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,7 +167,7 @@ set(HAVE_WAYLAND_EGL TRUE) endif() -find_package(XKB 0.5.0) +find_package(XKB 0.7.0) set_package_properties(XKB PROPERTIES TYPE REQUIRED PURPOSE "Required for building KWin with Wayland support" diff --git a/keyboard_input.cpp b/keyboard_input.cpp --- a/keyboard_input.cpp +++ b/keyboard_input.cpp @@ -401,16 +401,16 @@ void Xkb::updateConsumedModifiers(uint32_t key) { Qt::KeyboardModifiers mods = Qt::NoModifier; - if (xkb_state_mod_index_is_consumed(m_state, key + 8, m_shiftModifier) == 1) { + if (xkb_state_mod_index_is_consumed2(m_state, key + 8, m_shiftModifier, XKB_CONSUMED_MODE_GTK) == 1) { mods |= Qt::ShiftModifier; } - if (xkb_state_mod_index_is_consumed(m_state, key + 8, m_altModifier) == 1) { + if (xkb_state_mod_index_is_consumed2(m_state, key + 8, m_altModifier, XKB_CONSUMED_MODE_GTK) == 1) { mods |= Qt::AltModifier; } - if (xkb_state_mod_index_is_consumed(m_state, key + 8, m_controlModifier) == 1) { + if (xkb_state_mod_index_is_consumed2(m_state, key + 8, m_controlModifier, XKB_CONSUMED_MODE_GTK) == 1) { mods |= Qt::ControlModifier; } - if (xkb_state_mod_index_is_consumed(m_state, key + 8, m_metaModifier) == 1) { + if (xkb_state_mod_index_is_consumed2(m_state, key + 8, m_metaModifier, XKB_CONSUMED_MODE_GTK) == 1) { mods |= Qt::MetaModifier; } m_consumedModifiers = mods; @@ -432,23 +432,6 @@ mods |= Qt::MetaModifier; } - // workaround xkbcommon limitation concerning consumed modifiers - // if a key could be turned into a keysym with a modifier xkbcommon - // considers the modifier as consumed even if not pressed - // e.g. alt+F3 considers alt as consumed as there is a keysym generated - // with ctrl+alt+F3 (vt switching) - // For more information see: - // https://bugs.freedesktop.org/show_bug.cgi?id=92818 - // https://github.com/xkbcommon/libxkbcommon/issues/17 - - // the workaround is to not consider the modifiers as consumed - // if they are not a currently - // this might have other side effects, though. The only proper way to - // handle this is through new API in xkbcommon which doesn't exist yet - if (m_consumedModifiers & ~m_modifiers) { - return mods; - } - Qt::KeyboardModifiers consumedMods = m_consumedModifiers; if ((mods & Qt::ShiftModifier) && (consumedMods == Qt::ShiftModifier)) { // test whether current keysym is a letter