From cf87c39fe69c1854bed89d9cae50115bfd2f29b0 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Tue, 8 May 2018 14:02:01 +0700 Subject: [PATCH] Fixes hardware-based mnemonic input for the sil_ipa keyboard w US layout --- web/source/kmwdomevents.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/web/source/kmwdomevents.ts b/web/source/kmwdomevents.ts index 4173a0351c..104b06bf74 100644 --- a/web/source/kmwdomevents.ts +++ b/web/source/kmwdomevents.ts @@ -492,6 +492,22 @@ namespace com.keyman { if (s.Lcode == null) { return null; } + + var activeKeyboard = this.keyman.keyboardManager.activeKeyboard; + if(activeKeyboard && activeKeyboard['KM']) { + // So long as the key name isn't prefixed with 'U_', we'll get a default mapping based on the Lcode value. + // We need to determine the mnemonic base character - for example, SHIFT + K_PERIOD needs to map to '>'. + var mappedChar: string = this.keyman.osk.defaultKeyOutput('K_xxxx', s.Lcode, (e.getModifierState("Shift") ? 0x10 : 0), false, null); + if(mappedChar) { + s.Lcode = mappedChar.charCodeAt(0); + if(s.Lcode >= 'a'.charCodeAt(0) && s.Lcode <= 'z'.charCodeAt(0)) { + // Apply an uppercase effect to the key, since K_A etc are based on the upper-case character codes. + s.Lcode -= 32; + } + } else { + return null; + } + } // Stage 1 - track the true state of the keyboard's modifiers. var osk = this.keyman.osk, prevModState = DOMEventHandlers.states.modStateFlags, curModState = 0x0000; @@ -727,6 +743,7 @@ namespace com.keyman { } else { DOMEventHandlers.states._KeyPressToSwallow = 0; + LeventMatched = LeventMatched || kbdInterface.processKeystroke(util.physicalDevice,Levent.Ltarg,Levent); } }