Split implementation of keyboard layout handling into a dedicated class
ClosedPublic

Authored by graesslin on Jan 14 2017, 5:15 PM.

Details

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

Diff Detail

Branch
keyboard-layout
Lint
No Linters Available
Unit
No Unit Test Coverage
graesslin updated this revision to Diff 10169.Jan 14 2017, 5:15 PM
graesslin retitled this revision from to Split implementation of keyboard layout handling into a dedicated class.
graesslin updated this object.
graesslin edited the test plan for this revision. (Show Details)
graesslin added reviewers: KWin, Plasma on Wayland.
Restricted Application added projects: Plasma on Wayland, KWin. · View Herald TranscriptJan 14 2017, 5:15 PM
Restricted Application added subscribers: kwin, plasma-devel. · View Herald Transcript
graesslin updated this revision to Diff 10323.Jan 18 2017, 3:39 PM
  • Rebased to current master
  • Removed dependency to InputRedirection as no longer needed
bshah added a subscriber: bshah.Jan 18 2017, 3:44 PM
bshah added inline comments.
keyboard_input.cpp
502

This code seems to be from D4128?

graesslin added inline comments.Jan 18 2017, 4:43 PM
keyboard_input.cpp
502

yeah, arc fail on my side. Please ignore :-)

bshah added inline comments.Jan 18 2017, 4:45 PM
keyboard_input.cpp
502

Makes kinda hard to see actual change, can you perhaps redo this RR?

graesslin added inline comments.Jan 18 2017, 4:50 PM
keyboard_input.cpp
502

I'll push the other change then it hopefully solves by updating

graesslin updated this revision to Diff 10330.Jan 18 2017, 4:52 PM

Rebased to master

bshah accepted this revision.Jan 18 2017, 5:01 PM
bshah added a reviewer: bshah.
This revision is now accepted and ready to land.Jan 18 2017, 5:01 PM
This revision was automatically updated to reflect the committed changes.
bam added a subscriber: bam.Dec 10 2020, 8:25 PM
bam added inline comments.
keyboard_input.cpp
709

I'm not quite follow the check here and whole processModifiers() method:
it's occurs after client gets the modifiers event, right?
But at this moment, the modifiers are already updated on server, isn't it?
Sorry I might miss something.

bam added inline comments.Dec 10 2020, 9:33 PM
keyboard_input.cpp
709

Or it's used for nested mode?