Use new xkbcommon API for consumed modifiers
Summary:
This change removes the workaround added with
421824b654
.
Xkbcommon 0.7 introduces the needed API to make this work without a
workaround.
Test Plan: Test case still passes
Reviewers: #kwin, #plasma_on_wayland
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D3809
This commit is contained in:
parent
e3d79cdda6
commit
d1fdb9a02f
2 changed files with 5 additions and 22 deletions
|
@ -167,7 +167,7 @@ if(Wayland_Egl_FOUND)
|
|||
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"
|
||||
|
|
|
@ -401,16 +401,16 @@ void Xkb::updateModifiers()
|
|||
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 @@ Qt::KeyboardModifiers Xkb::modifiersRelevantForGlobalShortcuts() const
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue