diff --git a/lime/_backend/html5/HTML5Application.hx b/lime/_backend/html5/HTML5Application.hx index fe2ac6eff..249e7bcb7 100644 --- a/lime/_backend/html5/HTML5Application.hx +++ b/lime/_backend/html5/HTML5Application.hx @@ -192,7 +192,7 @@ class HTML5Application { //} var keyCode = cast convertKeyCode (event.keyCode != null ? event.keyCode : event.which); - var modifier = (event.shiftKey ? (KeyModifier.SHIFT) : 0) | (event.ctrlKey ? (KeyModifier.CTRL) : 0) | (event.altKey ? (KeyModifier.ALT) : 0) | (event.metaKey ? (KeyModifier.META) : 0); + var modifier = cast (event.shiftKey ? (KeyModifier.SHIFT) : 0) | (event.ctrlKey ? (KeyModifier.CTRL) : 0) | (event.altKey ? (KeyModifier.ALT) : 0) | (event.metaKey ? (KeyModifier.META) : 0); if (event.type == "keydown") { @@ -200,7 +200,15 @@ class HTML5Application { if (parent.window.enableTextEvents) { - parent.window.onTextInput.dispatch (String.fromCharCode (event.keyCode)); + if (event.keyCode >= 65 && event.keyCode <= 90 && !modifier.shiftKey) { + + parent.window.onTextInput.dispatch (String.fromCharCode (event.keyCode + 32)); + + } else { + + parent.window.onTextInput.dispatch (String.fromCharCode (event.keyCode)); + + } } diff --git a/lime/ui/KeyCode.hx b/lime/ui/KeyCode.hx index 34ccb9d9c..64f775d36 100644 --- a/lime/ui/KeyCode.hx +++ b/lime/ui/KeyCode.hx @@ -241,5 +241,11 @@ package lime.ui; var EJECT = 0x40000119; var SLEEP = 0x4000011A; + @:op(A > B) private static inline function gt (a:KeyCode, b:KeyCode):Bool { return (a:Int) > (b:Int); } + @:op(A >= B) private static inline function gte (a:KeyCode, b:KeyCode):Bool { return (a:Int) >= (b:Int); } + @:op(A < B) private static inline function lt (a:KeyCode, b:KeyCode):Bool { return (a:Int) < (b:Int); } + @:op(A <= B) private static inline function lte (a:KeyCode, b:KeyCode):Bool { return (a:Int) <= (b:Int); } + @:op(A + B) private static inline function plus (a:KeyCode, b:Int):KeyCode { return (a:Int) + b; } -} + +} \ No newline at end of file