Changeset View
Changeset View
Standalone View
Standalone View
keyboard_input.cpp
Show First 20 Lines • Show All 162 Lines • ▼ Show 20 Line(s) | 148 | { | |||
---|---|---|---|---|---|
163 | } else { | 163 | } else { | ||
164 | qCDebug(KWIN_XKB) << "Could not create default xkb keymap"; | 164 | qCDebug(KWIN_XKB) << "Could not create default xkb keymap"; | ||
165 | } | 165 | } | ||
166 | } | 166 | } | ||
167 | 167 | | |||
168 | xkb_keymap *Xkb::loadKeymapFromConfig() | 168 | xkb_keymap *Xkb::loadKeymapFromConfig() | ||
169 | { | 169 | { | ||
170 | // load config | 170 | // load config | ||
171 | const KConfigGroup config = KSharedConfig::openConfig(QStringLiteral("kxkbrc"), KConfig::NoGlobals)->group("Layout"); | 171 | if (!m_config) { | ||
172 | return nullptr; | ||||
173 | } | ||||
174 | const KConfigGroup config = m_config->group("Layout"); | ||||
172 | const QByteArray model = config.readEntry("Model", "pc104").toLocal8Bit(); | 175 | const QByteArray model = config.readEntry("Model", "pc104").toLocal8Bit(); | ||
173 | const QByteArray layout = config.readEntry("LayoutList", "").toLocal8Bit(); | 176 | const QByteArray layout = config.readEntry("LayoutList", "").toLocal8Bit(); | ||
174 | const QByteArray options = config.readEntry("Options", "").toLocal8Bit(); | 177 | const QByteArray options = config.readEntry("Options", "").toLocal8Bit(); | ||
175 | 178 | | |||
176 | xkb_rule_names ruleNames = { | 179 | xkb_rule_names ruleNames = { | ||
177 | .rules = nullptr, | 180 | .rules = nullptr, | ||
178 | .model = model.constData(), | 181 | .model = model.constData(), | ||
179 | .layout = layout.constData(), | 182 | .layout = layout.constData(), | ||
▲ Show 20 Lines • Show All 413 Lines • ▼ Show 20 Line(s) | 595 | private: | |||
593 | InputRedirection *m_input; | 596 | InputRedirection *m_input; | ||
594 | Qt::KeyboardModifiers m_modifiers; | 597 | Qt::KeyboardModifiers m_modifiers; | ||
595 | }; | 598 | }; | ||
596 | 599 | | |||
597 | void KeyboardInputRedirection::init() | 600 | void KeyboardInputRedirection::init() | ||
598 | { | 601 | { | ||
599 | Q_ASSERT(!m_inited); | 602 | Q_ASSERT(!m_inited); | ||
600 | m_inited = true; | 603 | m_inited = true; | ||
604 | const auto config = kwinApp()->kxkbConfig(); | ||||
605 | m_xkb->setConfig(config); | ||||
606 | | ||||
601 | m_input->installInputEventSpy(new KeyStateChangedSpy(m_input)); | 607 | m_input->installInputEventSpy(new KeyStateChangedSpy(m_input)); | ||
602 | m_modifiersChangedSpy = new ModifiersChangedSpy(m_input); | 608 | m_modifiersChangedSpy = new ModifiersChangedSpy(m_input); | ||
603 | m_input->installInputEventSpy(m_modifiersChangedSpy); | 609 | m_input->installInputEventSpy(m_modifiersChangedSpy); | ||
604 | m_keyboardLayout = new KeyboardLayout(m_xkb.data()); | 610 | m_keyboardLayout = new KeyboardLayout(m_xkb.data()); | ||
605 | m_keyboardLayout->setConfig(KSharedConfig::openConfig(QStringLiteral("kxkbrc"), KConfig::NoGlobals)); | 611 | m_keyboardLayout->setConfig(config); | ||
606 | m_keyboardLayout->init(); | 612 | m_keyboardLayout->init(); | ||
607 | m_input->installInputEventSpy(m_keyboardLayout); | 613 | m_input->installInputEventSpy(m_keyboardLayout); | ||
608 | 614 | | |||
609 | KeyboardRepeat *keyRepeatSpy = new KeyboardRepeat(m_xkb.data()); | 615 | KeyboardRepeat *keyRepeatSpy = new KeyboardRepeat(m_xkb.data()); | ||
610 | connect(keyRepeatSpy, &KeyboardRepeat::keyRepeat, this, | 616 | connect(keyRepeatSpy, &KeyboardRepeat::keyRepeat, this, | ||
611 | std::bind(&KeyboardInputRedirection::processKey, this, std::placeholders::_1, InputRedirection::KeyboardKeyAutoRepeat, std::placeholders::_2, nullptr)); | 617 | std::bind(&KeyboardInputRedirection::processKey, this, std::placeholders::_1, InputRedirection::KeyboardKeyAutoRepeat, std::placeholders::_2, nullptr)); | ||
612 | m_input->installInputEventSpy(keyRepeatSpy); | 618 | m_input->installInputEventSpy(keyRepeatSpy); | ||
613 | 619 | | |||
▲ Show 20 Lines • Show All 135 Lines • Show Last 20 Lines |