Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bca94ad authored by Jeff Brown's avatar Jeff Brown
Browse files

More work on international keyboards.

Changed the English US keymaps to implement a strict US key map
with no additional ALT functions.

Fixed a bug copying the alias in the InputDevice copy constructor.

Added support for end of line comments in KCM and KL files.

Added the German keyboard layout.

Sorted the keys in the keyboard layout files by physical arrangement
to make it easier to maintain them.

Bug: 6110399
Change-Id: If44d83de5b98f2bf0016cbb8e12264387b286aaa
parent fd6a5245
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ InputDeviceInfo::InputDeviceInfo() {

InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other) :
        mId(other.mId), mGeneration(other.mGeneration), mIdentifier(other.mIdentifier),
        mSources(other.mSources),
        mAlias(other.mAlias), mSources(other.mSources),
        mKeyboardType(other.mKeyboardType),
        mKeyCharacterMap(other.mKeyCharacterMap),
        mHasVibrator(other.mHasVibrator),
+3 −3
Original line number Diff line number Diff line
@@ -713,8 +713,8 @@ status_t KeyCharacterMap::Parser::parse() {
            }

            mTokenizer->skipDelimiters(WHITESPACE);
            if (!mTokenizer->isEol()) {
                ALOGE("%s: Expected end of line, got '%s'.",
            if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') {
                ALOGE("%s: Expected end of line or trailing comment, got '%s'.",
                        mTokenizer->getLocation().string(),
                        mTokenizer->peekRemainderOfLine().string());
                return BAD_VALUE;
@@ -973,7 +973,7 @@ status_t KeyCharacterMap::Parser::parseKeyProperty() {
        }

        mTokenizer->skipDelimiters(WHITESPACE);
    } while (!mTokenizer->isEol());
    } while (!mTokenizer->isEol() && mTokenizer->peekChar() != '#');

    // Add the behavior.
    for (size_t i = 0; i < properties.size(); i++) {
+4 −4
Original line number Diff line number Diff line
@@ -185,8 +185,8 @@ status_t KeyLayoutMap::Parser::parse() {
            }

            mTokenizer->skipDelimiters(WHITESPACE);
            if (!mTokenizer->isEol()) {
                ALOGE("%s: Expected end of line, got '%s'.",
            if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') {
                ALOGE("%s: Expected end of line or trailing comment, got '%s'.",
                        mTokenizer->getLocation().string(),
                        mTokenizer->peekRemainderOfLine().string());
                return BAD_VALUE;
@@ -234,7 +234,7 @@ status_t KeyLayoutMap::Parser::parseKey() {
    uint32_t flags = 0;
    for (;;) {
        mTokenizer->skipDelimiters(WHITESPACE);
        if (mTokenizer->isEol()) break;
        if (mTokenizer->isEol() || mTokenizer->peekChar() == '#') break;

        String8 flagToken = mTokenizer->nextToken(WHITESPACE);
        uint32_t flag = getKeyFlagByLabel(flagToken.string());
@@ -332,7 +332,7 @@ status_t KeyLayoutMap::Parser::parseAxis() {

    for (;;) {
        mTokenizer->skipDelimiters(WHITESPACE);
        if (mTokenizer->isEol()) {
        if (mTokenizer->isEol() || mTokenizer->peekChar() == '#') {
            break;
        }
        String8 keywordToken = mTokenizer->nextToken(WHITESPACE);
+292 −1
Original line number Diff line number Diff line
@@ -14,7 +14,298 @@

#
# English (US) keyboard layout.
# Assumes that the base keyboard layout is already English (US).
# Unlike the default (generic) keyboard layout, English (US) does not contain any
# special ALT characters.
#

type OVERLAY

### ROW 1

key GRAVE {
    label:                              '`'
    base:                               '`'
    shift:                              '~'
}

key 1 {
    label:                              '1'
    base:                               '1'
    shift:                              '!'
}

key 2 {
    label:                              '2'
    base:                               '2'
    shift:                              '@'
}

key 3 {
    label:                              '3'
    base:                               '3'
    shift:                              '#'
}

key 4 {
    label:                              '4'
    base:                               '4'
    shift:                              '$'
}

key 5 {
    label:                              '5'
    base:                               '5'
    shift:                              '%'
}

key 6 {
    label:                              '6'
    base:                               '6'
    shift:                              '^'
}

key 7 {
    label:                              '7'
    base:                               '7'
    shift:                              '&'
}

key 8 {
    label:                              '8'
    base:                               '8'
    shift:                              '*'
}

key 9 {
    label:                              '9'
    base:                               '9'
    shift:                              '('
}

key 0 {
    label:                              '0'
    base:                               '0'
    shift:                              ')'
}

key MINUS {
    label:                              '-'
    base:                               '-'
    shift:                              '_'
}

key EQUALS {
    label:                              '='
    base:                               '='
    shift:                              '+'
}

### ROW 2

key Q {
    label:                              'Q'
    base:                               'q'
    shift, capslock:                    'Q'
}

key W {
    label:                              'W'
    base:                               'w'
    shift, capslock:                    'W'
}

key E {
    label:                              'E'
    base:                               'e'
    shift, capslock:                    'E'
}

key R {
    label:                              'R'
    base:                               'r'
    shift, capslock:                    'R'
}

key T {
    label:                              'T'
    base:                               't'
    shift, capslock:                    'T'
}

key Y {
    label:                              'Y'
    base:                               'y'
    shift, capslock:                    'Y'
}

key U {
    label:                              'U'
    base:                               'u'
    shift, capslock:                    'U'
}

key I {
    label:                              'I'
    base:                               'i'
    shift, capslock:                    'I'
}

key O {
    label:                              'O'
    base:                               'o'
    shift, capslock:                    'O'
}

key P {
    label:                              'P'
    base:                               'p'
    shift, capslock:                    'P'
}

key LEFT_BRACKET {
    label:                              '['
    base:                               '['
    shift:                              '{'
}

key RIGHT_BRACKET {
    label:                              ']'
    base:                               ']'
    shift:                              '}'
}

key BACKSLASH {
    label:                              '\\'
    base:                               '\\'
    shift:                              '|'
}

### ROW 3

key A {
    label:                              'A'
    base:                               'a'
    shift, capslock:                    'A'
}

key S {
    label:                              'S'
    base:                               's'
    shift, capslock:                    'S'
}

key D {
    label:                              'D'
    base:                               'd'
    shift, capslock:                    'D'
}

key F {
    label:                              'F'
    base:                               'f'
    shift, capslock:                    'F'
}

key G {
    label:                              'G'
    base:                               'g'
    shift, capslock:                    'G'
}

key H {
    label:                              'H'
    base:                               'h'
    shift, capslock:                    'H'
}

key J {
    label:                              'J'
    base:                               'j'
    shift, capslock:                    'J'
}

key K {
    label:                              'K'
    base:                               'k'
    shift, capslock:                    'K'
}

key L {
    label:                              'L'
    base:                               'l'
    shift, capslock:                    'L'
}

key SEMICOLON {
    label:                              ';'
    base:                               ';'
    shift:                              ':'
}

key APOSTROPHE {
    label:                              '\''
    base:                               '\''
    shift:                              '"'
}

### ROW 4

key Z {
    label:                              'Z'
    base:                               'z'
    shift, capslock:                    'Z'
}

key X {
    label:                              'X'
    base:                               'x'
    shift, capslock:                    'X'
}

key C {
    label:                              'C'
    base:                               'c'
    shift, capslock:                    'C'
}

key V {
    label:                              'V'
    base:                               'v'
    shift, capslock:                    'V'
}

key B {
    label:                              'B'
    base:                               'b'
    shift, capslock:                    'B'
}

key N {
    label:                              'N'
    base:                               'n'
    shift, capslock:                    'N'
}

key M {
    label:                              'M'
    base:                               'm'
    shift, capslock:                    'M'
}

key COMMA {
    label:                              ','
    base:                               ','
    shift:                              '<'
}

key PERIOD {
    label:                              '.'
    base:                               '.'
    shift:                              '>'
}

key SLASH {
    label:                              '/'
    base:                               '/'
    shift:                              '?'
}
+292 −1
Original line number Diff line number Diff line
@@ -14,7 +14,8 @@

#
# English (US), Dvorak keyboard layout.
# Assumes that the base keyboard layout is already English (US).
# Unlike the default (generic) keyboard layout, English (US) does not contain any
# special ALT characters.
#

type OVERLAY
@@ -54,3 +55,293 @@ map key 50 M
map key 51 W
map key 52 V
map key 53 Z

### ROW 1

key GRAVE {
    label:                              '`'
    base:                               '`'
    shift:                              '~'
}

key 1 {
    label:                              '1'
    base:                               '1'
    shift:                              '!'
}

key 2 {
    label:                              '2'
    base:                               '2'
    shift:                              '@'
}

key 3 {
    label:                              '3'
    base:                               '3'
    shift:                              '#'
}

key 4 {
    label:                              '4'
    base:                               '4'
    shift:                              '$'
}

key 5 {
    label:                              '5'
    base:                               '5'
    shift:                              '%'
}

key 6 {
    label:                              '6'
    base:                               '6'
    shift:                              '^'
}

key 7 {
    label:                              '7'
    base:                               '7'
    shift:                              '&'
}

key 8 {
    label:                              '8'
    base:                               '8'
    shift:                              '*'
}

key 9 {
    label:                              '9'
    base:                               '9'
    shift:                              '('
}

key 0 {
    label:                              '0'
    base:                               '0'
    shift:                              ')'
}

key LEFT_BRACKET {
    label:                              '['
    base:                               '['
    shift:                              '{'
}

key RIGHT_BRACKET {
    label:                              ']'
    base:                               ']'
    shift:                              '}'
}

### ROW 2

key APOSTROPHE {
    label:                              '\''
    base:                               '\''
    shift:                              '"'
}

key COMMA {
    label:                              ','
    base:                               ','
    shift:                              '<'
}

key PERIOD {
    label:                              '.'
    base:                               '.'
    shift:                              '>'
}

key P {
    label:                              'P'
    base:                               'p'
    shift, capslock:                    'P'
}

key Y {
    label:                              'Y'
    base:                               'y'
    shift, capslock:                    'Y'
}

key F {
    label:                              'F'
    base:                               'f'
    shift, capslock:                    'F'
}

key G {
    label:                              'G'
    base:                               'g'
    shift, capslock:                    'G'
}

key C {
    label:                              'C'
    base:                               'c'
    shift, capslock:                    'C'
}

key R {
    label:                              'R'
    base:                               'r'
    shift, capslock:                    'R'
}

key L {
    label:                              'L'
    base:                               'l'
    shift, capslock:                    'L'
}

key SLASH {
    label:                              '/'
    base:                               '/'
    shift:                              '?'
}

key EQUALS {
    label:                              '='
    base:                               '='
    shift:                              '+'
}

key BACKSLASH {
    label:                              '\\'
    base:                               '\\'
    shift:                              '|'
}

### ROW 3

key A {
    label:                              'A'
    base:                               'a'
    shift, capslock:                    'A'
}

key O {
    label:                              'O'
    base:                               'o'
    shift, capslock:                    'O'
}

key E {
    label:                              'E'
    base:                               'e'
    shift, capslock:                    'E'
}

key U {
    label:                              'U'
    base:                               'u'
    shift, capslock:                    'U'
}

key I {
    label:                              'I'
    base:                               'i'
    shift, capslock:                    'I'
}

key D {
    label:                              'D'
    base:                               'd'
    shift, capslock:                    'D'
}

key H {
    label:                              'H'
    base:                               'h'
    shift, capslock:                    'H'
}

key T {
    label:                              'T'
    base:                               't'
    shift, capslock:                    'T'
}

key N {
    label:                              'N'
    base:                               'n'
    shift, capslock:                    'N'
}

key S {
    label:                              'S'
    base:                               's'
    shift, capslock:                    'S'
}

key MINUS {
    label:                              '-'
    base:                               '-'
    shift:                              '_'
}

### ROW 4

key SEMICOLON {
    label:                              ';'
    base:                               ';'
    shift:                              ':'
}

key Q {
    label:                              'Q'
    base:                               'q'
    shift, capslock:                    'Q'
}

key J {
    label:                              'J'
    base:                               'j'
    shift, capslock:                    'J'
}

key K {
    label:                              'K'
    base:                               'k'
    shift, capslock:                    'K'
}

key X {
    label:                              'X'
    base:                               'x'
    shift, capslock:                    'X'
}

key B {
    label:                              'B'
    base:                               'b'
    shift, capslock:                    'B'
}

key M {
    label:                              'M'
    base:                               'm'
    shift, capslock:                    'M'
}

key W {
    label:                              'W'
    base:                               'w'
    shift, capslock:                    'W'
}

key V {
    label:                              'V'
    base:                               'v'
    shift, capslock:                    'V'
}

key Z {
    label:                              'Z'
    base:                               'z'
    shift, capslock:                    'Z'
}
Loading