From 313bbd32a7c83c011e47c644943c367f3d9d1498 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 28 Mar 2024 12:19:41 -0500 Subject: [PATCH 1/6] feat(core): kmx+ scaffolding for modifiers=default - add a new value, 0x10000 to indicate 'default' For: #11072 --- common/include/kmx_file.h | 1 + core/include/ldml/keyman_core_ldml.h | 3 ++- core/include/ldml/keyman_core_ldml.ts | 6 ++++++ core/src/ldml/C7043_ldml.md | 23 ++++++++++++----------- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/common/include/kmx_file.h b/common/include/kmx_file.h index cd379489895..2fd4d2152b9 100644 --- a/common/include/kmx_file.h +++ b/common/include/kmx_file.h @@ -302,6 +302,7 @@ namespace kmx { #define K_MODIFIERFLAG 0x007F #define K_NOTMODIFIERFLAG 0xFF00 // I4548 +#define K_DEFAULTMODFLAG 0x10000 // used by KMX+ for the default modifier struct COMP_STORE { KMX_DWORD_unaligned dwSystemID; diff --git a/core/include/ldml/keyman_core_ldml.h b/core/include/ldml/keyman_core_ldml.h index b498065acaa..896e6841903 100644 --- a/core/include/ldml/keyman_core_ldml.h +++ b/core/include/ldml/keyman_core_ldml.h @@ -34,7 +34,7 @@ #define LDML_FINL_FLAGS_ERROR 0x1 #define LDML_KEYS_KEY_FLAGS_EXTEND 0x1 #define LDML_KEYS_KEY_FLAGS_GAP 0x2 -#define LDML_KEYS_MOD_ALL 0x17F +#define LDML_KEYS_MOD_ALL 0x1017F #define LDML_KEYS_MOD_ALT 0x40 #define LDML_KEYS_MOD_ALTL 0x4 #define LDML_KEYS_MOD_ALTR 0x8 @@ -42,6 +42,7 @@ #define LDML_KEYS_MOD_CTRL 0x20 #define LDML_KEYS_MOD_CTRLL 0x1 #define LDML_KEYS_MOD_CTRLR 0x2 +#define LDML_KEYS_MOD_DEFAULT 0x10000 #define LDML_KEYS_MOD_NONE 0x0 #define LDML_KEYS_MOD_SHIFT 0x10 #define LDML_LAYR_LIST_HARDWARE_TOUCH "touch" diff --git a/core/include/ldml/keyman_core_ldml.ts b/core/include/ldml/keyman_core_ldml.ts index ca9654587b5..06314c4a3d5 100644 --- a/core/include/ldml/keyman_core_ldml.ts +++ b/core/include/ldml/keyman_core_ldml.ts @@ -270,6 +270,11 @@ class Constants { */ readonly keys_mod_shift = 0x0010; + /** + * bitmask for 'default'. + */ + readonly keys_mod_default = 0x10000; + /** * Convenience map for modifiers */ @@ -284,6 +289,7 @@ class Constants { ["ctrlL", this.keys_mod_ctrlL], ["ctrlR", this.keys_mod_ctrlR], ["shift", this.keys_mod_shift], + ["default", this.keys_mod_default], ] ); diff --git a/core/src/ldml/C7043_ldml.md b/core/src/ldml/C7043_ldml.md index 8714e01f023..a3f69d66bf6 100644 --- a/core/src/ldml/C7043_ldml.md +++ b/core/src/ldml/C7043_ldml.md @@ -461,17 +461,18 @@ For each key: by the compiler. - `mod`: 32-bit bitfield defined as below. Little endian values. -| Value | Meaning |`kmx_file.h` | Comment | -|----------|----------|---------------|---------------------------------------------| -| 0x0000 | `none` | | All zeros = no modifiers | -| 0x0001 | `ctrlL` | `LCTRLFLAG` | Left Control | -| 0x0002 | `ctrlR` | `RCTRLFLAG` | Right Control | -| 0x0004 | `altL` | `LALTFLAG` | Left Alt | -| 0x0008 | `altR` | `RALTFLAG` | Right Alt | -| 0x0010 | `shift` | `K_SHIFTFLAG` | Either Shift | -| 0x0020 | `ctrl` | `K_CTRLFLAG` | Either Control | -| 0x0040 | `alt` | `K_ALTFLAG` | Either Alt | -| 0x0100 | `caps` | `CAPITALFLAG` | Caps lock | +| Value | Meaning |`kmx_file.h` | Comment | +|----------|-----------|--------------------|-----------------------------------------------| +| 0x0000 | `none` | | All zeros = no modifiers | +| 0x0001 | `ctrlL` | `LCTRLFLAG` | Left Control | +| 0x0002 | `ctrlR` | `RCTRLFLAG` | Right Control | +| 0x0004 | `altL` | `LALTFLAG` | Left Alt | +| 0x0008 | `altR` | `RALTFLAG` | Right Alt | +| 0x0010 | `shift` | `K_SHIFTFLAG` | Either Shift | +| 0x0020 | `ctrl` | `K_CTRLFLAG` | Either Control | +| 0x0040 | `alt` | `K_ALTFLAG` | Either Alt | +| 0x0100 | `caps` | `CAPITALFLAG` | Caps lock | +| 0x10000 | `default` | `K_DEFAULTMODFLAG` | Default (not used in conjunction with others) | TODO-LDML: Note that conforming to other keyman values, left versus right shift cannot be distinguished. From 89f5a0e090086a0629763f2882845cf81c6cd90d Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 28 Mar 2024 13:12:01 -0500 Subject: [PATCH 2/6] fix(core): support default lookup for modifiers Fixes: #11072 --- core/src/kmx/kmx_plus.cpp | 1 + core/src/ldml/ldml_vkeys.cpp | 10 +++++++ .../unit/ldml/keyboards/k_012_default.xml | 27 +++++++++++++++++++ core/tests/unit/ldml/keyboards/meson.build | 2 ++ 4 files changed, 40 insertions(+) create mode 100644 core/tests/unit/ldml/keyboards/k_012_default.xml diff --git a/core/src/kmx/kmx_plus.cpp b/core/src/kmx/kmx_plus.cpp index 295d92a4b24..af2062d1226 100644 --- a/core/src/kmx/kmx_plus.cpp +++ b/core/src/kmx/kmx_plus.cpp @@ -42,6 +42,7 @@ static_assert(LALTFLAG == LDML_KEYS_MOD_ALTL, "LDML modifier bitfield vs. kmx_fi static_assert(K_ALTFLAG == LDML_KEYS_MOD_ALT, "LDML modifier bitfield vs. kmx_file.h #define mismatch"); static_assert(CAPITALFLAG == LDML_KEYS_MOD_CAPS, "LDML modifier bitfield vs. kmx_file.h #define mismatch"); static_assert(K_SHIFTFLAG == LDML_KEYS_MOD_SHIFT, "LDML modifier bitfield vs. kmx_file.h #define mismatch"); // "either" shift +static_assert(K_DEFAULTMODFLAG == LDML_KEYS_MOD_DEFAULT, "LDML modifier bitfield vs. kmx_file.h #define mismatch"); /** * \def LDML_IS_VALID_MODIFIER_BITS test whether x is a valid modifier bitfield diff --git a/core/src/ldml/ldml_vkeys.cpp b/core/src/ldml/ldml_vkeys.cpp index 156a4c3247e..95cf935133f 100644 --- a/core/src/ldml/ldml_vkeys.cpp +++ b/core/src/ldml/ldml_vkeys.cpp @@ -65,6 +65,16 @@ vkeys::lookup(km_core_virtual_key vk, uint16_t modifier_state, bool &found) cons return ret; } } + + // look for a layer with "default" + { + const vkey_id id_default(vk, (K_DEFAULTMODFLAG)); + ret = lookup(id_default, found); + if (found) { + return ret; + } + } + // default: return failure. found=false. return ret; } diff --git a/core/tests/unit/ldml/keyboards/k_012_default.xml b/core/tests/unit/ldml/keyboards/k_012_default.xml new file mode 100644 index 00000000000..ef7b21d175c --- /dev/null +++ b/core/tests/unit/ldml/keyboards/k_012_default.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/core/tests/unit/ldml/keyboards/meson.build b/core/tests/unit/ldml/keyboards/meson.build index e06c64a8bd3..90aef564585 100644 --- a/core/tests/unit/ldml/keyboards/meson.build +++ b/core/tests/unit/ldml/keyboards/meson.build @@ -16,6 +16,7 @@ tests_from_cldr = [ 'bn', ] +# these have 'embedded' (@@) testdata instead of a separate file tests_without_testdata = [ # disabling 000 until we have updates to core or to the keyboard so that it passes # 'k_000_null_keyboard', @@ -25,6 +26,7 @@ tests_without_testdata = [ 'k_005_modbittest', 'k_010_mt', 'k_011_mt_iso', + 'k_012_default', 'k_100_keytest', 'k_101_keytest', 'k_102_keytest', From bca037cbf3fa3cc42c30823a2071700218f5ec85 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Fri, 29 Mar 2024 10:29:43 -0500 Subject: [PATCH 3/6] chore(core): support default lookup for modifiers - remove default flag from kmx_file.h Fixes: #11072 --- common/include/kmx_file.h | 3 ++- core/src/kmx/kmx_plus.cpp | 2 +- core/src/ldml/ldml_vkeys.cpp | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/include/kmx_file.h b/common/include/kmx_file.h index 2fd4d2152b9..3a6c281948f 100644 --- a/common/include/kmx_file.h +++ b/common/include/kmx_file.h @@ -302,7 +302,8 @@ namespace kmx { #define K_MODIFIERFLAG 0x007F #define K_NOTMODIFIERFLAG 0xFF00 // I4548 -#define K_DEFAULTMODFLAG 0x10000 // used by KMX+ for the default modifier +// Note: DEFAULT_MODIFIER = 0x10000, used by KMX+ for the +// default modifier flag in layers, > 16 bit so not available here struct COMP_STORE { KMX_DWORD_unaligned dwSystemID; diff --git a/core/src/kmx/kmx_plus.cpp b/core/src/kmx/kmx_plus.cpp index af2062d1226..00611a419af 100644 --- a/core/src/kmx/kmx_plus.cpp +++ b/core/src/kmx/kmx_plus.cpp @@ -42,7 +42,7 @@ static_assert(LALTFLAG == LDML_KEYS_MOD_ALTL, "LDML modifier bitfield vs. kmx_fi static_assert(K_ALTFLAG == LDML_KEYS_MOD_ALT, "LDML modifier bitfield vs. kmx_file.h #define mismatch"); static_assert(CAPITALFLAG == LDML_KEYS_MOD_CAPS, "LDML modifier bitfield vs. kmx_file.h #define mismatch"); static_assert(K_SHIFTFLAG == LDML_KEYS_MOD_SHIFT, "LDML modifier bitfield vs. kmx_file.h #define mismatch"); // "either" shift -static_assert(K_DEFAULTMODFLAG == LDML_KEYS_MOD_DEFAULT, "LDML modifier bitfield vs. kmx_file.h #define mismatch"); +// LDML_KEYS_MOD_DEFAULT is not present in kmx_file.h (>16 bit) /** * \def LDML_IS_VALID_MODIFIER_BITS test whether x is a valid modifier bitfield diff --git a/core/src/ldml/ldml_vkeys.cpp b/core/src/ldml/ldml_vkeys.cpp index 95cf935133f..803c9248db3 100644 --- a/core/src/ldml/ldml_vkeys.cpp +++ b/core/src/ldml/ldml_vkeys.cpp @@ -7,6 +7,7 @@ #include "ldml_vkeys.hpp" #include "kmx_file.h" +#include namespace km { namespace core { @@ -68,7 +69,7 @@ vkeys::lookup(km_core_virtual_key vk, uint16_t modifier_state, bool &found) cons // look for a layer with "default" { - const vkey_id id_default(vk, (K_DEFAULTMODFLAG)); + const vkey_id id_default(vk, (LDML_KEYS_MOD_DEFAULT)); ret = lookup(id_default, found); if (found) { return ret; From ae6f7b5d78da013ba63f85272c631f8ced40f9c9 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Fri, 29 Mar 2024 12:38:18 -0500 Subject: [PATCH 4/6] chore(core): support default lookup for modifiers - fix spec Fixes: #11072 --- core/src/ldml/C7043_ldml.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/ldml/C7043_ldml.md b/core/src/ldml/C7043_ldml.md index a3f69d66bf6..700f9b2ddde 100644 --- a/core/src/ldml/C7043_ldml.md +++ b/core/src/ldml/C7043_ldml.md @@ -472,7 +472,7 @@ For each key: | 0x0020 | `ctrl` | `K_CTRLFLAG` | Either Control | | 0x0040 | `alt` | `K_ALTFLAG` | Either Alt | | 0x0100 | `caps` | `CAPITALFLAG` | Caps lock | -| 0x10000 | `default` | `K_DEFAULTMODFLAG` | Default (not used in conjunction with others) | +| 0x10000 | `default` | n/a | Default (not used in conjunction with others) | TODO-LDML: Note that conforming to other keyman values, left versus right shift cannot be distinguished. From 5615a5eb4c22863b602d4893868fb43de4ee80ca Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Mon, 1 Apr 2024 12:26:00 -0500 Subject: [PATCH 5/6] chore(common): add more references to 0x10000 - at least add comments pointing back to keyman_core_ldml.ts Fixes: #11072 --- common/include/kmx_file.h | 3 ++- common/web/keyboard-processor/src/text/codes.ts | 10 +++++++--- common/web/types/src/kmx/kmx.ts | 6 +++++- common/windows/cpp/include/legacy_kmx_file.h | 6 +++++- common/windows/delphi/keyboards/kmxfileconsts.pas | 4 ++++ 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/common/include/kmx_file.h b/common/include/kmx_file.h index 3a6c281948f..6081a666e8a 100644 --- a/common/include/kmx_file.h +++ b/common/include/kmx_file.h @@ -303,7 +303,8 @@ namespace kmx { #define K_MODIFIERFLAG 0x007F #define K_NOTMODIFIERFLAG 0xFF00 // I4548 // Note: DEFAULT_MODIFIER = 0x10000, used by KMX+ for the -// default modifier flag in layers, > 16 bit so not available here +// default modifier flag in layers, > 16 bit so not available here. +// See keys_mod_default in keyman_core_ldml.ts struct COMP_STORE { KMX_DWORD_unaligned dwSystemID; diff --git a/common/web/keyboard-processor/src/text/codes.ts b/common/web/keyboard-processor/src/text/codes.ts index 11490f32f2d..2305d1eed2f 100644 --- a/common/web/keyboard-processor/src/text/codes.ts +++ b/common/web/keyboard-processor/src/text/codes.ts @@ -1,7 +1,7 @@ // TODO: Move to separate folder: 'codes' // We should start splitting off code needed by keyboards even without a KeyboardProcessor active. -// There's an upcoming `/common/web/types` package that 'codes' and 'keyboards' may fit well within. -// In fact, there's a file there (on its branch) that should be merged with this one! + +// see also: common/web/types/src/kmx/kmx.ts const Codes = { // Define Keyman Developer modifier bit-flags (exposed for use by other modules) @@ -25,6 +25,10 @@ const Codes = { "NO_SCROLL_LOCK":0x2000, // NOTSCROLLFLAG "VIRTUAL_KEY":0x4000, // ISVIRTUALKEY "VIRTUAL_CHAR_KEY":0x8000 // VIRTUALCHARKEY // Unused by KMW, but reserved for use by other Keyman engines. + + // Note: keys_mod_default = 0x10000, used by KMX+ for the + // default modifier flag in layers, > 16 bit so not available here. + // See keys_mod_default in keyman_core_ldml.ts }, modifierBitmasks: { @@ -168,4 +172,4 @@ const Codes = { } } -export default Codes; \ No newline at end of file +export default Codes; diff --git a/common/web/types/src/kmx/kmx.ts b/common/web/types/src/kmx/kmx.ts index 6102a69cf55..07d0330ccb2 100644 --- a/common/web/types/src/kmx/kmx.ts +++ b/common/web/types/src/kmx/kmx.ts @@ -345,6 +345,10 @@ export class KMXFile { public static readonly ISVIRTUALKEY = 0x4000; // It is a Virtual Key Sequence public static readonly VIRTUALCHARKEY = 0x8000; // Keyman 6.0: Virtual Key Cap Sequence NOT YET + // Note: DEFAULT_MODIFIER = 0x10000, used by KMX+ for the + // default modifier flag in layers, > 16 bit so not available here. + // See keys_mod_default in keyman_core_ldml.ts + public static readonly MASK_MODIFIER_CHIRAL = KMXFile.LCTRLFLAG | KMXFile.RCTRLFLAG | KMXFile.LALTFLAG | KMXFile.RALTFLAG; public static readonly MASK_MODIFIER_SHIFT = KMXFile.K_SHIFTFLAG; public static readonly MASK_MODIFIER_NONCHIRAL = KMXFile.K_CTRLFLAG | KMXFile.K_ALTFLAG; @@ -457,4 +461,4 @@ export class KMXFile { throw "COMP_KEYBOARD size is "+this.COMP_KEYBOARD.size()+" but should be "+KMXFile.COMP_KEYBOARD_SIZE+" bytes"; } } -} \ No newline at end of file +} diff --git a/common/windows/cpp/include/legacy_kmx_file.h b/common/windows/cpp/include/legacy_kmx_file.h index 9b8f6a59fb1..081defd38d9 100644 --- a/common/windows/cpp/include/legacy_kmx_file.h +++ b/common/windows/cpp/include/legacy_kmx_file.h @@ -303,7 +303,7 @@ #define RALTFLAG 0x0008 // Right Alt flag #define K_SHIFTFLAG 0x0010 // Either shift flag #define K_CTRLFLAG 0x0020 // Either ctrl flag -#define K_ALTFLAG 0x0040 // Either alt flag +#define K_ALTFLAG 0x0040 // Either alt lag //#define K_METAFLAG 0x0080 // Either Meta-key flag (tentative). Not usable in keyboard rules; // Used internally (currently, only by KMW) to ensure Meta-key // shortcuts safely bypass rules @@ -320,6 +320,10 @@ #define K_MODIFIERFLAG 0x007F #define K_NOTMODIFIERFLAG 0xFF00 // I4548 +// Note: DEFAULT_MODIFIER = 0x10000, used by KMX+ for the +// default modifier flag in layers, > 16 bit so not available here. +// See keys_mod_default in keyman_core_ldml.ts + /* These sanity checks help ensure we don't break on-disk struct sizes when we cross diff --git a/common/windows/delphi/keyboards/kmxfileconsts.pas b/common/windows/delphi/keyboards/kmxfileconsts.pas index 966dada8827..96215ad8627 100644 --- a/common/windows/delphi/keyboards/kmxfileconsts.pas +++ b/common/windows/delphi/keyboards/kmxfileconsts.pas @@ -129,6 +129,10 @@ interface KMX_ISVIRTUALKEY = $4000; // It is a Virtual Key Sequence KMX_VIRTUALCHARKEY = $8000; // It is a virtual character key sequence - mnemonic layouts + // Note: KMX_DEFAULT_MODIFIER = $10000, used by KMX+ for the + // default modifier flag in layers, > 16 bit so not available here. + // See keys_mod_default in keyman_core_ldml.ts + // Combinations of key masks KMX_MASK_MODIFIER_CHIRAL = KMX_LCTRLFLAG or KMX_RCTRLFLAG or KMX_LALTFLAG or KMX_RALTFLAG; KMX_MASK_MODIFIER_SHIFT = KMX_SHIFTFLAG; From 5b1c853557b4412bf3d9c456fac8deb264dfde90 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Mon, 1 Apr 2024 23:21:33 -0500 Subject: [PATCH 6/6] fix(common,core): support other lookup for modifiers - the 'other' keyword was incorrectly called 'default' Fixes: #11072 --- common/include/kmx_file.h | 6 +++--- common/web/keyboard-processor/src/text/codes.ts | 6 +++--- common/web/types/src/kmx/kmx.ts | 6 +++--- common/windows/cpp/include/legacy_kmx_file.h | 8 ++++---- common/windows/delphi/keyboards/kmxfileconsts.pas | 6 +++--- core/include/ldml/keyman_core_ldml.h | 2 +- core/include/ldml/keyman_core_ldml.ts | 6 +++--- core/src/kmx/kmx_plus.cpp | 2 +- core/src/ldml/C7043_ldml.md | 2 +- core/src/ldml/ldml_vkeys.cpp | 4 ++-- .../ldml/keyboards/{k_012_default.xml => k_012_other.xml} | 2 +- core/tests/unit/ldml/keyboards/meson.build | 2 +- 12 files changed, 26 insertions(+), 26 deletions(-) rename core/tests/unit/ldml/keyboards/{k_012_default.xml => k_012_other.xml} (93%) diff --git a/common/include/kmx_file.h b/common/include/kmx_file.h index 6081a666e8a..748ba32d920 100644 --- a/common/include/kmx_file.h +++ b/common/include/kmx_file.h @@ -302,9 +302,9 @@ namespace kmx { #define K_MODIFIERFLAG 0x007F #define K_NOTMODIFIERFLAG 0xFF00 // I4548 -// Note: DEFAULT_MODIFIER = 0x10000, used by KMX+ for the -// default modifier flag in layers, > 16 bit so not available here. -// See keys_mod_default in keyman_core_ldml.ts +// Note: OTHER_MODIFIER = 0x10000, used by KMX+ for the +// other modifier flag in layers, > 16 bit so not available here. +// See keys_mod_other in keyman_core_ldml.ts struct COMP_STORE { KMX_DWORD_unaligned dwSystemID; diff --git a/common/web/keyboard-processor/src/text/codes.ts b/common/web/keyboard-processor/src/text/codes.ts index 2305d1eed2f..3f1ebe7afe8 100644 --- a/common/web/keyboard-processor/src/text/codes.ts +++ b/common/web/keyboard-processor/src/text/codes.ts @@ -26,9 +26,9 @@ const Codes = { "VIRTUAL_KEY":0x4000, // ISVIRTUALKEY "VIRTUAL_CHAR_KEY":0x8000 // VIRTUALCHARKEY // Unused by KMW, but reserved for use by other Keyman engines. - // Note: keys_mod_default = 0x10000, used by KMX+ for the - // default modifier flag in layers, > 16 bit so not available here. - // See keys_mod_default in keyman_core_ldml.ts + // Note: keys_mod_other = 0x10000, used by KMX+ for the + // other modifier flag in layers, > 16 bit so not available here. + // See keys_mod_other in keyman_core_ldml.ts }, modifierBitmasks: { diff --git a/common/web/types/src/kmx/kmx.ts b/common/web/types/src/kmx/kmx.ts index 07d0330ccb2..c5989ec1157 100644 --- a/common/web/types/src/kmx/kmx.ts +++ b/common/web/types/src/kmx/kmx.ts @@ -345,9 +345,9 @@ export class KMXFile { public static readonly ISVIRTUALKEY = 0x4000; // It is a Virtual Key Sequence public static readonly VIRTUALCHARKEY = 0x8000; // Keyman 6.0: Virtual Key Cap Sequence NOT YET - // Note: DEFAULT_MODIFIER = 0x10000, used by KMX+ for the - // default modifier flag in layers, > 16 bit so not available here. - // See keys_mod_default in keyman_core_ldml.ts + // Note: OTHER_MODIFIER = 0x10000, used by KMX+ for the + // other modifier flag in layers, > 16 bit so not available here. + // See keys_mod_other in keyman_core_ldml.ts public static readonly MASK_MODIFIER_CHIRAL = KMXFile.LCTRLFLAG | KMXFile.RCTRLFLAG | KMXFile.LALTFLAG | KMXFile.RALTFLAG; public static readonly MASK_MODIFIER_SHIFT = KMXFile.K_SHIFTFLAG; diff --git a/common/windows/cpp/include/legacy_kmx_file.h b/common/windows/cpp/include/legacy_kmx_file.h index 081defd38d9..d3bc3aed0f6 100644 --- a/common/windows/cpp/include/legacy_kmx_file.h +++ b/common/windows/cpp/include/legacy_kmx_file.h @@ -303,7 +303,7 @@ #define RALTFLAG 0x0008 // Right Alt flag #define K_SHIFTFLAG 0x0010 // Either shift flag #define K_CTRLFLAG 0x0020 // Either ctrl flag -#define K_ALTFLAG 0x0040 // Either alt lag +#define K_ALTFLAG 0x0040 // Either alt flag //#define K_METAFLAG 0x0080 // Either Meta-key flag (tentative). Not usable in keyboard rules; // Used internally (currently, only by KMW) to ensure Meta-key // shortcuts safely bypass rules @@ -320,9 +320,9 @@ #define K_MODIFIERFLAG 0x007F #define K_NOTMODIFIERFLAG 0xFF00 // I4548 -// Note: DEFAULT_MODIFIER = 0x10000, used by KMX+ for the -// default modifier flag in layers, > 16 bit so not available here. -// See keys_mod_default in keyman_core_ldml.ts +// Note: OTHER_MODIFIER = 0x10000, used by KMX+ for the +// other modifier flag in layers, > 16 bit so not available here. +// See keys_mod_other in keyman_core_ldml.ts /* These sanity checks help ensure we don't diff --git a/common/windows/delphi/keyboards/kmxfileconsts.pas b/common/windows/delphi/keyboards/kmxfileconsts.pas index 96215ad8627..2a32184ec04 100644 --- a/common/windows/delphi/keyboards/kmxfileconsts.pas +++ b/common/windows/delphi/keyboards/kmxfileconsts.pas @@ -129,9 +129,9 @@ interface KMX_ISVIRTUALKEY = $4000; // It is a Virtual Key Sequence KMX_VIRTUALCHARKEY = $8000; // It is a virtual character key sequence - mnemonic layouts - // Note: KMX_DEFAULT_MODIFIER = $10000, used by KMX+ for the - // default modifier flag in layers, > 16 bit so not available here. - // See keys_mod_default in keyman_core_ldml.ts + // Note: KMX_OTHER_MODIFIER = $10000, used by KMX+ for the + // other modifier flag in layers, > 16 bit so not available here. + // See keys_mod_other in keyman_core_ldml.ts // Combinations of key masks KMX_MASK_MODIFIER_CHIRAL = KMX_LCTRLFLAG or KMX_RCTRLFLAG or KMX_LALTFLAG or KMX_RALTFLAG; diff --git a/core/include/ldml/keyman_core_ldml.h b/core/include/ldml/keyman_core_ldml.h index 896e6841903..1d8aaa2575d 100644 --- a/core/include/ldml/keyman_core_ldml.h +++ b/core/include/ldml/keyman_core_ldml.h @@ -42,8 +42,8 @@ #define LDML_KEYS_MOD_CTRL 0x20 #define LDML_KEYS_MOD_CTRLL 0x1 #define LDML_KEYS_MOD_CTRLR 0x2 -#define LDML_KEYS_MOD_DEFAULT 0x10000 #define LDML_KEYS_MOD_NONE 0x0 +#define LDML_KEYS_MOD_OTHER 0x10000 #define LDML_KEYS_MOD_SHIFT 0x10 #define LDML_LAYR_LIST_HARDWARE_TOUCH "touch" #define LDML_LENGTH_BKSP 0xC diff --git a/core/include/ldml/keyman_core_ldml.ts b/core/include/ldml/keyman_core_ldml.ts index 06314c4a3d5..b649d9424e7 100644 --- a/core/include/ldml/keyman_core_ldml.ts +++ b/core/include/ldml/keyman_core_ldml.ts @@ -271,9 +271,9 @@ class Constants { readonly keys_mod_shift = 0x0010; /** - * bitmask for 'default'. + * bitmask for 'other'. */ - readonly keys_mod_default = 0x10000; + readonly keys_mod_other = 0x10000; /** * Convenience map for modifiers @@ -289,7 +289,7 @@ class Constants { ["ctrlL", this.keys_mod_ctrlL], ["ctrlR", this.keys_mod_ctrlR], ["shift", this.keys_mod_shift], - ["default", this.keys_mod_default], + ["other", this.keys_mod_other], ] ); diff --git a/core/src/kmx/kmx_plus.cpp b/core/src/kmx/kmx_plus.cpp index 00611a419af..007a87cdf7d 100644 --- a/core/src/kmx/kmx_plus.cpp +++ b/core/src/kmx/kmx_plus.cpp @@ -42,7 +42,7 @@ static_assert(LALTFLAG == LDML_KEYS_MOD_ALTL, "LDML modifier bitfield vs. kmx_fi static_assert(K_ALTFLAG == LDML_KEYS_MOD_ALT, "LDML modifier bitfield vs. kmx_file.h #define mismatch"); static_assert(CAPITALFLAG == LDML_KEYS_MOD_CAPS, "LDML modifier bitfield vs. kmx_file.h #define mismatch"); static_assert(K_SHIFTFLAG == LDML_KEYS_MOD_SHIFT, "LDML modifier bitfield vs. kmx_file.h #define mismatch"); // "either" shift -// LDML_KEYS_MOD_DEFAULT is not present in kmx_file.h (>16 bit) +// LDML_KEYS_MOD_OTHER is not present in kmx_file.h (>16 bit) /** * \def LDML_IS_VALID_MODIFIER_BITS test whether x is a valid modifier bitfield diff --git a/core/src/ldml/C7043_ldml.md b/core/src/ldml/C7043_ldml.md index 700f9b2ddde..b1d2223d556 100644 --- a/core/src/ldml/C7043_ldml.md +++ b/core/src/ldml/C7043_ldml.md @@ -472,7 +472,7 @@ For each key: | 0x0020 | `ctrl` | `K_CTRLFLAG` | Either Control | | 0x0040 | `alt` | `K_ALTFLAG` | Either Alt | | 0x0100 | `caps` | `CAPITALFLAG` | Caps lock | -| 0x10000 | `default` | n/a | Default (not used in conjunction with others) | +| 0x10000 | `other` | n/a | Other (not used in conjunction with others) | TODO-LDML: Note that conforming to other keyman values, left versus right shift cannot be distinguished. diff --git a/core/src/ldml/ldml_vkeys.cpp b/core/src/ldml/ldml_vkeys.cpp index 803c9248db3..07a2ff08ad9 100644 --- a/core/src/ldml/ldml_vkeys.cpp +++ b/core/src/ldml/ldml_vkeys.cpp @@ -67,9 +67,9 @@ vkeys::lookup(km_core_virtual_key vk, uint16_t modifier_state, bool &found) cons } } - // look for a layer with "default" + // look for a layer with "other" { - const vkey_id id_default(vk, (LDML_KEYS_MOD_DEFAULT)); + const vkey_id id_default(vk, (LDML_KEYS_MOD_OTHER)); ret = lookup(id_default, found); if (found) { return ret; diff --git a/core/tests/unit/ldml/keyboards/k_012_default.xml b/core/tests/unit/ldml/keyboards/k_012_other.xml similarity index 93% rename from core/tests/unit/ldml/keyboards/k_012_default.xml rename to core/tests/unit/ldml/keyboards/k_012_other.xml index ef7b21d175c..186cfd88699 100644 --- a/core/tests/unit/ldml/keyboards/k_012_default.xml +++ b/core/tests/unit/ldml/keyboards/k_012_other.xml @@ -20,7 +20,7 @@ will match the default layer - + diff --git a/core/tests/unit/ldml/keyboards/meson.build b/core/tests/unit/ldml/keyboards/meson.build index 90aef564585..e27fb39b3ef 100644 --- a/core/tests/unit/ldml/keyboards/meson.build +++ b/core/tests/unit/ldml/keyboards/meson.build @@ -26,7 +26,7 @@ tests_without_testdata = [ 'k_005_modbittest', 'k_010_mt', 'k_011_mt_iso', - 'k_012_default', + 'k_012_other', 'k_100_keytest', 'k_101_keytest', 'k_102_keytest',