Interrupt AltGr sequence detection on focus lost, fixes #1880
This commit is contained in:
parent
1230a4ce73
commit
6c07136169
|
@ -203,7 +203,7 @@ export default class Keyboard {
|
||||||
if ((code === "ControlLeft") && browser.isWindows() &&
|
if ((code === "ControlLeft") && browser.isWindows() &&
|
||||||
!("ControlLeft" in this._keyDownList)) {
|
!("ControlLeft" in this._keyDownList)) {
|
||||||
this._altGrArmed = true;
|
this._altGrArmed = true;
|
||||||
this._altGrTimeout = setTimeout(this._handleAltGrTimeout.bind(this), 100);
|
this._altGrTimeout = setTimeout(this._interruptAltGrSequence.bind(this), 100);
|
||||||
this._altGrCtrlTime = e.timeStamp;
|
this._altGrCtrlTime = e.timeStamp;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -218,11 +218,7 @@ export default class Keyboard {
|
||||||
|
|
||||||
// We can't get a release in the middle of an AltGr sequence, so
|
// We can't get a release in the middle of an AltGr sequence, so
|
||||||
// abort that detection
|
// abort that detection
|
||||||
if (this._altGrArmed) {
|
this._interruptAltGrSequence();
|
||||||
this._altGrArmed = false;
|
|
||||||
clearTimeout(this._altGrTimeout);
|
|
||||||
this._sendKeyEvent(KeyTable.XK_Control_L, "ControlLeft", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// See comment in _handleKeyDown()
|
// See comment in _handleKeyDown()
|
||||||
if ((browser.isMac() || browser.isIOS()) && (code === 'CapsLock')) {
|
if ((browser.isMac() || browser.isIOS()) && (code === 'CapsLock')) {
|
||||||
|
@ -249,14 +245,20 @@ export default class Keyboard {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleAltGrTimeout() {
|
_interruptAltGrSequence() {
|
||||||
|
if (this._altGrArmed) {
|
||||||
this._altGrArmed = false;
|
this._altGrArmed = false;
|
||||||
clearTimeout(this._altGrTimeout);
|
clearTimeout(this._altGrTimeout);
|
||||||
this._sendKeyEvent(KeyTable.XK_Control_L, "ControlLeft", true);
|
this._sendKeyEvent(KeyTable.XK_Control_L, "ControlLeft", true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_allKeysUp() {
|
_allKeysUp() {
|
||||||
Log.Debug(">> Keyboard.allKeysUp");
|
Log.Debug(">> Keyboard.allKeysUp");
|
||||||
|
|
||||||
|
// Prevent control key being processed after losing focus.
|
||||||
|
this._interruptAltGrSequence();
|
||||||
|
|
||||||
for (let code in this._keyDownList) {
|
for (let code in this._keyDownList) {
|
||||||
this._sendKeyEvent(this._keyDownList[code], code, false);
|
this._sendKeyEvent(this._keyDownList[code], code, false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue