diff --git a/src/backends/wayland/wayland_backend.cpp b/src/backends/wayland/wayland_backend.cpp index 3a6d4268ea..efd08332bd 100644 --- a/src/backends/wayland/wayland_backend.cpp +++ b/src/backends/wayland/wayland_backend.cpp @@ -21,7 +21,6 @@ #include "cursor.h" #include "dpmsinputeventfilter.h" #include "input.h" -#include "keyboard_input.h" #include "pointer_input.h" #include @@ -203,12 +202,6 @@ WaylandInputDevice::WaylandInputDevice(KWayland::Client::Keyboard *keyboard, Way } Q_EMIT keyChanged(key, state, time, this); }); - connect(keyboard, &Keyboard::modifiersChanged, this, [](quint32 depressed, quint32 latched, quint32 locked, quint32 group) { - input()->keyboard()->processModifiers(depressed, latched, locked, group); - }); - connect(keyboard, &Keyboard::keymapChanged, this, [](int fd, quint32 size) { - input()->keyboard()->processKeymapChange(fd, size); - }); } WaylandInputDevice::WaylandInputDevice(KWayland::Client::Pointer *pointer, WaylandSeat *seat) diff --git a/src/keyboard_input.cpp b/src/keyboard_input.cpp index b36d24bdcc..ef911a36aa 100644 --- a/src/keyboard_input.cpp +++ b/src/keyboard_input.cpp @@ -100,11 +100,7 @@ public: if (event->isAutoRepeat()) { return; } - updateModifiers(event->modifiers()); - } - - void updateModifiers(Qt::KeyboardModifiers mods) - { + const Qt::KeyboardModifiers mods = event->modifiers(); if (mods == m_modifiers) { return; } @@ -282,26 +278,4 @@ void KeyboardInputRedirection::processKey(uint32_t key, InputRedirection::Keyboa } } -void KeyboardInputRedirection::processModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group) -{ - if (!m_inited) { - return; - } - const quint32 previousLayout = m_xkb->currentLayout(); - // TODO: send to proper Client and also send when active Client changes - m_xkb->updateModifiers(modsDepressed, modsLatched, modsLocked, group); - m_modifiersChangedSpy->updateModifiers(modifiers()); - m_keyboardLayout->checkLayoutChange(previousLayout); -} - -void KeyboardInputRedirection::processKeymapChange(int fd, uint32_t size) -{ - if (!m_inited) { - return; - } - // TODO: should we pass the keymap to our Clients? Or only to the currently active one and update - m_xkb->installKeymap(fd, size); - m_keyboardLayout->resetLayout(); -} - } diff --git a/src/keyboard_input.h b/src/keyboard_input.h index bdd40bddb9..f9d55cfc99 100644 --- a/src/keyboard_input.h +++ b/src/keyboard_input.h @@ -54,14 +54,6 @@ public: * @internal */ void processKey(uint32_t key, InputRedirection::KeyboardKeyState state, uint32_t time, InputDevice *device = nullptr); - /** - * @internal - */ - void processModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group); - /** - * @internal - */ - void processKeymapChange(int fd, uint32_t size); Xkb *xkb() const; Qt::KeyboardModifiers modifiers() const; diff --git a/src/xkb.cpp b/src/xkb.cpp index 690d25b467..2ea5dd9a6e 100644 --- a/src/xkb.cpp +++ b/src/xkb.cpp @@ -256,25 +256,6 @@ xkb_keymap *Xkb::loadKeymapFromLocale1() return xkb_keymap_new_from_names(m_context, &ruleNames, XKB_KEYMAP_COMPILE_NO_FLAGS); } -void Xkb::installKeymap(int fd, uint32_t size) -{ - if (!m_context) { - return; - } - char *map = reinterpret_cast(mmap(nullptr, size, PROT_READ, MAP_SHARED, fd, 0)); - if (map == MAP_FAILED) { - return; - } - xkb_keymap *keymap = xkb_keymap_new_from_string(m_context, map, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_MAP_COMPILE_PLACEHOLDER); - munmap(map, size); - if (!keymap) { - qCDebug(KWIN_XKB) << "Could not map keymap from file"; - return; - } - m_ownership = Ownership::Client; - updateKeymap(keymap); -} - void Xkb::updateKeymap(xkb_keymap *keymap) { Q_ASSERT(keymap); @@ -318,7 +299,7 @@ void Xkb::updateKeymap(xkb_keymap *keymap) m_modifierState.locked = xkb_state_serialize_mods(m_state, xkb_state_component(XKB_STATE_MODS_LOCKED)); auto setLock = [this](xkb_mod_index_t modifier, bool value) { - if (m_ownership == Ownership::Server && modifier != XKB_MOD_INVALID) { + if (modifier != XKB_MOD_INVALID) { std::bitset mask{m_modifierState.locked}; if (mask.size() > modifier) { mask[modifier] = value; diff --git a/src/xkb.h b/src/xkb.h index 572f1654dc..9ad31eeb79 100644 --- a/src/xkb.h +++ b/src/xkb.h @@ -48,7 +48,6 @@ public: void setConfig(const KSharedConfigPtr &config); void setNumLockConfig(const KSharedConfigPtr &config); - void installKeymap(int fd, uint32_t size); void updateModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group); void updateKey(uint32_t key, InputRedirection::KeyboardKeyState state); xkb_keysym_t toKeysym(uint32_t key); @@ -160,12 +159,6 @@ private: xkb_mod_index_t locked = 0; } m_modifierState; - enum class Ownership { - Server, - Client - }; - Ownership m_ownership = Ownership::Server; - QPointer m_seat; const bool m_followLocale1; };