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

Commit ebb5e477 authored by Steve Kondik's avatar Steve Kondik
Browse files

input: Fix keymapping and handle www/com key.

The keymappings derived when setting up for Espresso were
incorrect and causing problems on other keyboards like Vision. Corrected
this, and also added handling for the www/com key on Vision.

Change-Id: I4303c60498469a24f5ce2b4397b6cf822ac81f67
parent 691845d6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -106,6 +106,12 @@ public class QwertyKeyListener extends BaseKeyListener {
            return true;
        }

        if (i == KeyCharacterMap.DOT_WWW_INPUT || i == KeyCharacterMap.DOT_COM_INPUT) {
            content.replace(selStart, selEnd, selStart == 0 ? "www." : ".com");
            adjustMetaAfterKeypress(content);
            return true;
        }

        if (i == KeyCharacterMap.HEX_INPUT) {
            int start;

+11 −1
Original line number Diff line number Diff line
@@ -55,6 +55,16 @@ public class KeyCharacterMap
     */
    public static final char PICKER_DIALOG_INPUT = '\uEF01';

    /**
     * Private use character denoting a .com suffix
     */
    public static final char DOT_COM_INPUT = '\uEF03';

    /**
     * Private use character denoting a www. prefix
     */
    public static final char DOT_WWW_INPUT = '\uEF04';

    private static Object sLock = new Object();
    private static SparseArray<WeakReference<KeyCharacterMap>> sInstances
        = new SparseArray<WeakReference<KeyCharacterMap>>();
+5 −14
Original line number Diff line number Diff line
@@ -120,20 +120,11 @@ public class KeyEvent implements Parcelable {
    public static final int KEYCODE_MEDIA_REWIND    = 89;
    public static final int KEYCODE_MEDIA_FAST_FORWARD = 90;
    public static final int KEYCODE_MUTE            = 91;
    public static final int KEYCODE_FUNC_1          = 92;
    public static final int KEYCODE_FUNC_2          = 93;
    public static final int KEYCODE_FUNC_3          = 94;
    public static final int KEYCODE_FUNC_4          = 95;
    public static final int KEYCODE_FUNC_5          = 96;
    public static final int KEYCODE_FUNC_6          = 97;
    public static final int KEYCODE_FUNC_7          = 98;
    public static final int KEYCODE_FUNC_8          = 99;
    public static final int KEYCODE_QUECHAR         = 100;
    public static final int KEYCODE_USER1           = 101;
    public static final int KEYCODE_USER2           = 102;
    public static final int KEYCODE_USER3           = 103;
    public static final int KEYCODE_USER4           = 104;
    public static final int KEYCODE_USER5           = 105;
    public static final int KEYCODE_USER1           = 92;
    public static final int KEYCODE_USER2           = 93;
    public static final int KEYCODE_USER3           = 94;
    public static final int KEYCODE_USER4           = 95;
    public static final int KEYCODE_USER5           = 96;

    // NOTE: If you add a new keycode here you must also add it to:
    //  isSystem()
+5 −14
Original line number Diff line number Diff line
@@ -916,20 +916,11 @@
        <enum name="KEYCODE_MEDIA_REWIND" value="89" />
        <enum name="KEYCODE_MEDIA_FAST_FORWARD" value="90" />
        <enum name="KEYCODE_MUTE" value="91" />
        <enum name="KEYCODE_FUNC_1" value="92" />
        <enum name="KEYCODE_FUNC_2" value="93" />
        <enum name="KEYCODE_FUNC_3" value="94" />
        <enum name="KEYCODE_FUNC_4" value="95" />
        <enum name="KEYCODE_FUNC_5" value="96" />
        <enum name="KEYCODE_FUNC_6" value="97" />
        <enum name="KEYCODE_FUNC_7" value="98" />
        <enum name="KEYCODE_FUNC_8" value="99" />
        <enum name="KEYCODE_QUECHAR" value="100" />
        <enum name="KEYCODE_USER1" value="101" />
        <enum name="KEYCODE_USER2" value="102" />
        <enum name="KEYCODE_USER3" value="103" />
        <enum name="KEYCODE_USER4" value="104" />
        <enum name="KEYCODE_USER5" value="105" />
        <enum name="KEYCODE_USER1" value="92" />
        <enum name="KEYCODE_USER2" value="93" />
        <enum name="KEYCODE_USER3" value="94" />
        <enum name="KEYCODE_USER4" value="95" />
        <enum name="KEYCODE_USER5" value="96" />
    </attr>

    <!-- ***************************************************************** -->
+20 −28
Original line number Diff line number Diff line
@@ -114,20 +114,21 @@ static const KeycodeLabel KEYCODES[] = {
    { "MEDIA_REWIND", 89 },
    { "MEDIA_FAST_FORWARD", 90 },
    { "MUTE", 91 },
    { "FUNC_1", 92 },
    { "FUNC_2", 93 },
    { "FUNC_3", 94 },
    { "FUNC_4", 95 },
    { "FUNC_5", 96 },
    { "FUNC_6", 97 },
    { "FUNC_7", 98 },
    { "FUNC_8", 99 },
    { "QUECHAR", 100 },
    { "USER1", 101 },
    { "USER2", 102 },
    { "USER3", 103 },
    { "USER4", 104 },
    { "USER5", 105 },
    { "USER1", 92 },
    { "USER2", 93 },
    { "USER3", 94 },
    { "USER4", 95 },
    { "USER5", 96 },
    { "FUNC_1", 97 },
    { "FUNC_2", 98 },
    { "FUNC_3", 99 },
    { "FUNC_4", 100 },
    { "FUNC_5", 101 },
    { "FUNC_6", 102 },
    { "FUNC_7", 103 },
    { "FUNC_8", 104 },
    { "QUECHAR", 105 },
    { "BTN_MOUSE", 106 },

    // NOTE: If you add a new keycode here you must also add it to:
    //   (enum KeyCode, in this file)
@@ -233,20 +234,11 @@ typedef enum KeyCode {
    kKeyCodeRewind = 89,
    kKeyCodeForward = 90,
    kKeyCodeMute = 91,
    kKeyCodeFunc1 = 92,
    kKeyCodeFunc2 = 93,
    kKeyCodeFunc3 = 94,
    kKeyCodeFunc4 = 95,
    kKeyCodeFunc5 = 96,
    kKeyCodeFunc6 = 97,
    kKeyCodeFunc7 = 98,
    kKeyCodeFunc8 = 99,
    kKeyCodeQuechar = 100,
    kKeyCodeUser1 = 101,
    kKeyCodeUser2 = 102,
    kKeyCodeUser3 = 103,
    kKeyCodeUser4 = 104,
    kKeyCodeUser5 = 105
    kKeyCodeUser1 = 92,
    kKeyCodeUser2 = 93,
    kKeyCodeUser3 = 94,
    kKeyCodeUser4 = 95,
    kKeyCodeUser5 = 96,
} KeyCode;

static const KeycodeLabel FLAGS[] = {