From 7d7bbcc56aa201964c63391a3686fb7efad36dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sun, 21 Aug 2016 18:12:43 +0200 Subject: [PATCH] Only trigger keyboard layout OSD if KWin manages input Summary: On platforms where KWin does not manage input, that is does not use libinput, KWin gets the keyboard layout from another place, e.g. the X server. In that case KWin should of course not trigger the layout changed OSD if KWin thinks (for whatever reason) that the layout changed. BUG: 367637 Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D2521 --- keyboard_input.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/keyboard_input.cpp b/keyboard_input.cpp index e695795fdc..2230a30725 100644 --- a/keyboard_input.cpp +++ b/keyboard_input.cpp @@ -307,15 +307,18 @@ void Xkb::updateModifiers() if (layout != m_currentLayout) { m_currentLayout = layout; // notify OSD service about the new layout - QDBusMessage msg = QDBusMessage::createMethodCall( - QStringLiteral("org.kde.plasmashell"), - QStringLiteral("/org/kde/osdService"), - QStringLiteral("org.kde.osdService"), - QStringLiteral("kbdLayoutChanged")); + if (kwinApp()->usesLibinput()) { + // only if kwin is in charge of keyboard input + QDBusMessage msg = QDBusMessage::createMethodCall( + QStringLiteral("org.kde.plasmashell"), + QStringLiteral("/org/kde/osdService"), + QStringLiteral("org.kde.osdService"), + QStringLiteral("kbdLayoutChanged")); - msg << QString::fromLocal8Bit(xkb_keymap_layout_get_name(m_keymap, layout)); + msg << QString::fromLocal8Bit(xkb_keymap_layout_get_name(m_keymap, layout)); - QDBusConnection::sessionBus().asyncCall(msg); + QDBusConnection::sessionBus().asyncCall(msg); + } } if (waylandServer()) { waylandServer()->seat()->updateKeyboardModifiers(xkb_state_serialize_mods(m_state, xkb_state_component(XKB_STATE_MODS_DEPRESSED)),