mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-24 08:37:42 +00:00
Merge pull request #6902 from keymanapp/fix/web/block-set-layer-on-desktop
fix(web): layer-setting ops should not trigger for hardware keystroke processing 🖇️
This commit is contained in:
commit
b8fd5eea31
4 changed files with 24 additions and 19 deletions
|
|
@ -921,7 +921,8 @@ namespace com.keyman.text {
|
|||
*/
|
||||
setStore(systemId: number, strValue: string, outputTarget: OutputTarget): boolean {
|
||||
this.resetContextCache();
|
||||
if(systemId == KeyboardInterface.TSS_LAYER) {
|
||||
// Unique case: we only allow set(&layer) ops from keyboard rules triggered by touch OSKs.
|
||||
if(systemId == KeyboardInterface.TSS_LAYER && this.activeDevice.touchable) {
|
||||
// Denote the changed store as part of the matched rule's behavior.
|
||||
this.ruleBehavior.setStore[systemId] = strValue;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -731,7 +731,7 @@ namespace com.keyman.text {
|
|||
} else if(KeyboardProcessor.isModifier(Levent)) {
|
||||
this.activeKeyboard.notify(Levent.Lcode, outputTarget, isKeyDown ? 1 : 0);
|
||||
// For eventual integration - we bypass an OSK update for physical keystrokes when in touch mode.
|
||||
if(!Levent.device.touchable) {
|
||||
if(!this.contextDevice.touchable) {
|
||||
return this._UpdateVKShift(Levent); // I2187
|
||||
} else {
|
||||
return true;
|
||||
|
|
@ -740,7 +740,9 @@ namespace com.keyman.text {
|
|||
|
||||
if(Levent.LmodifierChange) {
|
||||
this.activeKeyboard.notify(0, outputTarget, 1);
|
||||
this._UpdateVKShift(Levent);
|
||||
if(!this.contextDevice.touchable) {
|
||||
this._UpdateVKShift(Levent);
|
||||
}
|
||||
}
|
||||
|
||||
// No modifier keypresses detected.
|
||||
|
|
@ -750,7 +752,9 @@ namespace com.keyman.text {
|
|||
resetContext() {
|
||||
this.layerId = 'default';
|
||||
this.keyboardInterface.resetContextCache();
|
||||
this._UpdateVKShift(null);
|
||||
if(!this.contextDevice.touchable) {
|
||||
this._UpdateVKShift(null);
|
||||
}
|
||||
};
|
||||
|
||||
setNumericLayer(device: utils.DeviceSpec) {
|
||||
|
|
|
|||
|
|
@ -117,20 +117,9 @@ if(!window['keyman']['initialized']) {
|
|||
|
||||
util.attachDOMEvent(document, 'keyup', keymanweb.hotkeyManager._Process, false);
|
||||
|
||||
/**
|
||||
* Reset OSK shift states when entering or exiting the active element
|
||||
**/
|
||||
function resetVKShift() {
|
||||
let keyman = com.keyman.singleton;
|
||||
if(!keyman.uiManager.isActivating && keyman.osk?.vkbd) {
|
||||
keyman.core.keyboardProcessor._UpdateVKShift(null); //this should be enabled !!!!! TODO
|
||||
}
|
||||
}
|
||||
|
||||
// We need to track this handler, as it causes... interesting... interactions during testing in certain browsers.
|
||||
keymanweb['pageFocusHandler'] = resetVKShift;
|
||||
util.attachDOMEvent(window, 'focus', keymanweb['pageFocusHandler'], false); // I775
|
||||
util.attachDOMEvent(window, 'blur', keymanweb['pageFocusHandler'], false); // I775
|
||||
util.attachDOMEvent(window, 'focus', keymanweb.pageFocusHandler, false); // I775
|
||||
util.attachDOMEvent(window, 'blur', keymanweb.pageFocusHandler, false); // I775
|
||||
|
||||
// Initialize supplementary plane string extensions
|
||||
String.kmwEnableSupplementaryPlane(true);
|
||||
|
|
|
|||
|
|
@ -176,6 +176,17 @@ namespace com.keyman {
|
|||
this.touchAliasing = this.util.device.touchable ? this.domManager.touchHandlers : this.domManager.nonTouchHandlers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset context when entering or exiting the active element.
|
||||
* Will also trigger OSK shift state / layer reset.
|
||||
**/
|
||||
pageFocusHandler = () => {
|
||||
if(!this.uiManager.isActivating && this.osk?.vkbd) {
|
||||
this.core.resetContext(null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers a KeymanWeb engine shutdown to facilitate a full system reset.
|
||||
* This function is designed for use with KMW unit-testing, which reloads KMW
|
||||
|
|
@ -183,8 +194,8 @@ namespace com.keyman {
|
|||
*/
|
||||
['shutdown']() {
|
||||
// Disable page focus/blur events, which can sometimes trigger and cause parallel KMW instances in testing.
|
||||
this.util.detachDOMEvent(window, 'focus', this['pageFocusHandler'], false);
|
||||
this.util.detachDOMEvent(window, 'blur', this['pageFocusHandler'], false);
|
||||
this.util.detachDOMEvent(window, 'focus', this.pageFocusHandler, false);
|
||||
this.util.detachDOMEvent(window, 'blur', this.pageFocusHandler, false);
|
||||
|
||||
this.domManager.shutdown();
|
||||
this.osk.shutdown();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue