#pragma once #include #include struct xkb_keymap; // One typing key of a keymap layout, at its shift and AltGr levels. A level // is either text or a dead key (then the 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; QString altGr; // third level (AltGr), empty if it types nothing QString altGrUpper; // fourth level (AltGr+Shift) quint32 deadAltGr = 0; quint32 deadAltGrUpper = 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> rows; }; KeymapKeys readKeymapKeys(xkb_keymap *keymap, quint32 layoutIndex); // Spacing accent for a dead keysym, used as its label and when nothing composes: ´ for dead_acute. QString deadKeyText(quint32 keysym);