Stop keyboard injection as soon as any real keyboard activity is detected

This commit is contained in:
Jeff Parsons 2017-06-15 16:48:12 -07:00 committed by Jeff Parsons
commit 8f8082d170
5 changed files with 14 additions and 9 deletions

View file

@ -1359,6 +1359,11 @@ class Keyboard extends Component {
var keyCode = event.keyCode;
/*
* Let's stop any injection currently in progress...
*/
this.sInjectBuffer = "";
/*
* Although it would be nice to pay attention ONLY to these "up" and "down" events, and ignore "press"
* events, iOS devices force us to process "press" events, because they don't give us shift-key events,
@ -1499,6 +1504,11 @@ class Keyboard extends Component {
event = event || window.event;
var keyCode = event.which || event.keyCode;
/*
* Let's stop any injection currently in progress...
*/
this.sInjectBuffer = "";
if (this.fAllDown) {
var simCode = this.checkActiveKey();
if (simCode && this.isAlphaKey(simCode) && this.isAlphaKey(keyCode) && simCode != keyCode) {
@ -1510,11 +1520,6 @@ class Keyboard extends Component {
}
}
/*
* Let's stop any injection currently in progress, too
*/
this.sInjectBuffer = "";
var fPass = !Keyboard.SIMCODES[keyCode] || !!(this.bitsState & Keyboard.STATE.CMD);
if (!COMPILED && this.messageEnabled(Messages.KEYS)) {