- Full (iPad Pro) mode: every typing key from the keymap, number row, tab, caps lock, ctrl/super/alt; shifted symbol shown above and flickable - Dead keys compose with the locale's XKB compose table - Ctrl/Alt/Super stick like shift and turn keys into shortcuts; a tapped or held shift joins shortcuts and non-text keys, auto-shift and caps lock don't - Auto-capitalization and caps lock only capitalize letters; the user's shift picks the keymap's shifted level - Mode switch in settings keeps key size by resizing the window Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.1 KiB
C
35 lines
1.1 KiB
C
#pragma once
|
||
|
||
#include <QList>
|
||
#include <QString>
|
||
|
||
struct xkb_keymap;
|
||
|
||
// One typing key of a keymap layout, at its two shift levels. A level is
|
||
// either text or a dead key (then `text` is its spacing accent, for labels).
|
||
struct KeymapKey {
|
||
enum class Position { Regular, Backslash, LessGreater }; // BKSL, LSGT: not on every keyboard
|
||
|
||
Position position = Position::Regular;
|
||
QString lower;
|
||
QString upper;
|
||
quint32 deadLower = 0; // dead keysym, 0 if the level types text
|
||
quint32 deadUpper = 0;
|
||
|
||
bool isLetter() const;
|
||
};
|
||
|
||
// The typing keys one layout of an XKB keymap has on a physical keyboard,
|
||
// in its four rows: 0 number row (TLDE, AE01–AE12), 1 top (AD01–AD12, BKSL),
|
||
// 2 home (AC01–AC11), 3 bottom (LSGT, AB01–AB10). Keys that type nothing on
|
||
// either level are left out.
|
||
struct KeymapKeys {
|
||
QString name; // e.g. "Slovak"
|
||
QList<QList<KeymapKey>> rows;
|
||
};
|
||
|
||
KeymapKeys readKeymapKeys(xkb_keymap *keymap, quint32 layoutIndex);
|
||
|
||
// What a dead key shows and types when nothing composes: ´ for dead_acute.
|
||
QString deadKeyText(quint32 keysym);
|