Skip to content

Commit

Permalink
chore(common): add more references to 0x10000
Browse files Browse the repository at this point in the history
- at least add comments pointing back to keyman_core_ldml.ts

Fixes: #11072
  • Loading branch information
srl295 committed Apr 1, 2024
1 parent d75bbbe commit 5615a5e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
3 changes: 2 additions & 1 deletion common/include/kmx_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 7 additions & 3 deletions common/web/keyboard-processor/src/text/codes.ts
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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: {
Expand Down Expand Up @@ -168,4 +172,4 @@ const Codes = {
}
}

export default Codes;
export default Codes;
6 changes: 5 additions & 1 deletion common/web/types/src/kmx/kmx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -457,4 +461,4 @@ export class KMXFile {
throw "COMP_KEYBOARD size is "+this.COMP_KEYBOARD.size()+" but should be "+KMXFile.COMP_KEYBOARD_SIZE+" bytes";
}
}
}
}
6 changes: 5 additions & 1 deletion common/windows/cpp/include/legacy_kmx_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions common/windows/delphi/keyboards/kmxfileconsts.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5615a5e

Please sign in to comment.