refactor(web): starts cleanup of mnemonic swallowKeypress use

This commit is contained in:
jahorton 2020-03-26 21:22:28 +07:00
parent cf0599fd66
commit 4e778edb27
4 changed files with 10 additions and 13 deletions

View file

@ -232,6 +232,13 @@ namespace com.keyman.dom {
e.preventDefault();
e.stopPropagation();
}
processor.swallowKeypress = (Levent.Lcode != 8 ? Levent.Lcode != 0 : false);
if(Levent.Lcode == 8) {
processor.swallowKeypress = false;
}
} else {
processor.swallowKeypress = false;
}
return !LeventMatched;

View file

@ -448,7 +448,7 @@ namespace com.keyman.text {
// Now that we have a valid key event, hand it off to the Processor for execution.
// This allows the Processor to also handle any predictive-text tasks necessary.
let retVal = com.keyman.osk.PreProcessor.processClick(Lkc, null);
let retVal = com.keyman.osk.PreProcessor.handleClick(Lkc, null);
// Special case for embedded to pass K_TAB back to device to process
if(Lkc.Lcode == Codes.keyCodes["K_TAB"] || Lkc.Lcode == Codes.keyCodes["K_TABBACK"]

View file

@ -106,7 +106,7 @@ namespace com.keyman.osk {
com.keyman.dom.DOMEventHandlers.states._IgnoreNextSelChange = 0;
}
let retVal = PreProcessor.processClick(Lkc, e);
let retVal = PreProcessor.handleClick(Lkc, e);
// Now that processing is done, we can do a bit of post-processing, too.
keyman.uiManager.setActivatingUI(false); // I2498 - KeymanWeb OSK does not accept clicks in FF when using automatic UI
@ -119,7 +119,7 @@ namespace com.keyman.osk {
// Created during refactoring for web-core. Mostly serves to hold DOM-dependent
// code that affects both 'native' and 'embedded' mode OSK use after the KeyEvent
// object has been properly instantiated.
static processClick(Lkc: text.KeyEvent, e: KeyElement) {
static handleClick(Lkc: text.KeyEvent, e: KeyElement) {
let keyman = com.keyman.singleton;
// Exclude menu and OSK hide keys from normal click processing
if(Lkc.kName == 'K_LOPT' || Lkc.kName == 'K_ROPT') {

View file

@ -266,8 +266,6 @@ namespace com.keyman.text {
e = null as osk.KeyElement; // Cast is necessary for TS type-checking later in the method.
}
this.swallowKeypress = false;
// The default OSK layout for desktop devices does not include nextlayer info, relying on modifier detection here.
// It's the OSK equivalent to doModifierPress on 'desktop' form factors.
if((formFactor == FormFactor.Desktop || this.activeKeyboard.usesDesktopLayoutOnDevice(keyEvent.device)) && fromOSK) {
@ -383,14 +381,6 @@ namespace com.keyman.text {
// For DOM-aware targets, this will trigger a DOM event page designers may listen for.
outputTarget.doInputEvent();
}
this.swallowKeypress = (e && keyEvent.Lcode != 8 ? keyEvent.Lcode != 0 : false);
if(keyEvent.Lcode == 8) {
this.swallowKeypress = false;
}
return false;
} else {
this.swallowKeypress = false;
}
/* I732 END - 13/03/2007 MCD: End Positional Layout support in OSK */