graesslin created this revision. graesslin added reviewers: KWin, Plasma on Wayland. Restricted Application added subscribers: kwin, plasma-devel. Restricted Application added projects: Plasma on Wayland, KWin.
REVISION SUMMARY So far the implementation of keyboard layout handling was split between KeyboardInputRedirection and Xkb. KeyboardInputRedirection registered the global shortcut and did the handling for layout switch and config changes. Xkb did the notification on layout change. Layout changes can nowadays be detected through an InputEventSpy. It can only happen after a key change or an explicit layout switch. Thus it does not need to be in Xkb anymore which allows to reduce Xkb to only care about the Xkb keymap and state tracking. This change introduces a new class KeyboardLayout which is an InputEventSpy and takes over the task of the layout change notification from Xkb and the layout management from KeyboardInputRedirection. Thus everything related to management of keyboard layout is together in one class. This allows in future to add unit test to it (requires further cleanup of Xkb to be able to use it and drop the InputRedirection dependency) and opens the possibility to also take over keyboard layout management on X11 for the Plasma desktop. TEST PLAN Manual testing BRANCH keyboard-layout REVISION DETAIL https://phabricator.kde.org/D4135 AFFECTED FILES CMakeLists.txt keyboard_input.cpp keyboard_input.h keyboard_layout.cpp keyboard_layout.h EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: graesslin, #kwin, #plasma_on_wayland Cc: plasma-devel, kwin, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, eliasp, sebas