4 Commits
Author SHA1 Message Date
Devin Lin c4fe01beaf Wrap keyboard layouts in KeyboardLayoutDefinition
Currently layouts are created with the KeyboardLayout component. When we
switch to alternate layouts (i.e. numpad, symbols), the Keyboard switches out the
KeyboardLayout completely to the alternate layout's KeyboardLayout.

We currently don't have a "holding" object for a keyboard layout,
preventing us from having a shared TextComposer session between all of
the "sublayouts" within a layout (ex. QWERTY <-> symbols <-> numpad)

This is problematic for CJK because the TextComposer gets reset when we
switch to other pages, like the symbols page.

---

This MR introduces a "KeyboardLayoutDefinition" holding component for
layouts, so that we can retain state within a keyboard layout. In this
case, we keep the TextComposer on the KeyboardLayoutDefinition rather
than the KeyboardLayout so it isn't reset when we switch to other
keyboard pages.

I also replaced the JSON-specified alternate layouts with it now being
specified on the KeyboardLayoutDefinition, which makes things a bit more
centralized.

---

Kind of annoying that I had to do this after porting the layouts, but
this was a big oversight I missed that came up during CJK testing :/
2026-10-25 14:00:43 -04:00
Devin Lin d2a622c8b4 Introduce new input engine and framework to replace Qt VKBD 2026-10-14 20:00:54 -04:00
Devin Lin 3d36d0cae2 Revert "Introduce virtual keyboard input engine and layout framework"
This reverts commit cb4e635242
2026-04-22 16:27:34 -04:00
Devin Lin cb4e635242 Introduce virtual keyboard input engine and layout framework
This is the first step in
https://invent.kde.org/plasma/plasma-keyboard/-/merge_requests/109
(please see it for context and rationale), and
introduces a basic input engine and layout framework.

The virtual keyboard library and engine are in /virtualkeyboard:
- /virtualkeyboard/components - QML components for building keyboard layouts and the keyboard itself
- /virtualkeyboard/inputbackend.h - generic input "backend" for sending events from the vkbd, currently just for input-method-v1 but could be for xdg-remote-desktop?
- /virtualkeyboard/inputengine.h - internal input method "state"
- /virtualkeyboard/keyboardcontroller.h - internal virtual keyboard panel "state"
- /virtualkeyboard/keyboardpackageresolver.h - utilities to find and parse keyboard "layout packages"
- /virtualkeyboard/textcomposers/abstracttextcomposer.h - abstract interface that implements event handling from the keyboard layout and talks to InputEngine for the final "text" (needed for CJK, text prediction)
- /virtualkeyboard/textcomposers/directtextcomposer.h - directly enters text (enough for most layouts)

For an example keyboard package (not included in this MR), please see https://invent.kde.org/plasma/plasma-keyboard/-/tree/e8e33ef2103c545decaed556a43907349e789fb8/layouts/en (shared layouts in https://invent.kde.org/plasma/plasma-keyboard/-/tree/e8e33ef2103c545decaed556a43907349e789fb8/layouts/defaultplugin)
- Metadata is in metadata.json, which lists the locales the package is
  meant for, and what layouts it provides
- Each keyboard layout has predefined "required" layouts: main, symbols,
  digits, numbers and dialpad
- Each keyboard layout can define which form factors to show up for (ex.
  desktop ones won't show up in the mobile kcm keyboard selector by default)
2026-04-21 19:19:11 -04:00