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
This commit is contained in:
Martin Gräßlin 2016-08-21 18:12:43 +02:00
parent a67ccc3529
commit 7d7bbcc56a

View file

@ -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)),