xkb: Honor layout loop count for spare layouts

When kxkbrc has more layouts than LayoutLoopCount, KWin currently builds the XKB keymap from the full LayoutList. XKB-level layout switching options such as grp:caps_toggle then cycle through spare layouts too.

This keeps the public layout list logical, but builds the active keymap from the configured loop. Explicitly selecting a spare layout swaps it into the last loop slot, so the physical/XKB layout switch cycles the active pair only.

For example, with LayoutList=us,ru,by, LayoutLoopCount=2 and grp:caps_toggle, Caps Lock cycles us-ru. If by is selected explicitly, the active pair becomes us-by.

Local verification:

  • cmake --build build-fix --target kwin -j4 on Debian KWin 6.6.4 source
  • ctest --test-dir build-fix -R testKeyboardLayout --output-on-failure on Debian KWin 6.6.4 source

KDE Invent CI is running this change against current master.

Edited by Darafei Praliaskouski

Merge request reports

Loading
Loading