@ -583,16 +583,23 @@ void EmscriptenApplication::setupCallbacks(bool resizable) {
( [ ] ( int , const EmscriptenKeyboardEvent * event , void * userData ) - > Int {
( [ ] ( int , const EmscriptenKeyboardEvent * event , void * userData ) - > Int {
EmscriptenApplication & app = * static_cast < EmscriptenApplication * > ( userData ) ;
EmscriptenApplication & app = * static_cast < EmscriptenApplication * > ( userData ) ;
const Containers : : StringView key = event - > key ;
const Containers : : StringView key = event - > key ;
KeyEvent e { * event } ;
app . keyPressEvent ( e ) ;
bool accepted = e . isAccepted ( ) ;
/* If the key name is a single letter or a start of an UTF-8
/* If the key name is a single letter or a start of an UTF-8
sequence , pass it to the text input event as well */
sequence , pass it to the text input event as well . Both SDL and
GLFW emit key press first and text input after , do it in the
same order here . */
if ( app . isTextInputActive ( ) & & key . size ( ) = = 1 | | ( key . size ( ) > = 1 & & UnsignedByte ( key [ 0 ] ) > 127 ) ) {
if ( app . isTextInputActive ( ) & & key . size ( ) = = 1 | | ( key . size ( ) > = 1 & & UnsignedByte ( key [ 0 ] ) > 127 ) ) {
TextInputEvent e { * event , key } ;
TextInputEvent t e{ * event , key } ;
app . textInputEvent ( e ) ;
app . textInputEvent ( t e) ;
return e . isAccepted ( ) ;
accepted = accepted | | t e. isAccepted ( ) ;
}
}
KeyEvent e { * event } ;
app . keyPressEvent ( e ) ;
/* Accepting either the key event, the text input event, or both
return e . isAccepted ( ) ;
should stop it from propagating further */
return accepted ;
} ) ) ;
} ) ) ;
emscripten_set_keyup_callback ( keyboardListeningElement , this , false ,
emscripten_set_keyup_callback ( keyboardListeningElement , this , false ,