From 0439167637e37a9a4c0e3f140ce9faa221c7c4bc Mon Sep 17 00:00:00 2001 From: divVerent Date: Sat, 24 Jun 2023 08:33:17 -0400 Subject: [PATCH] mobile/ebitenmobileview: Android: include keypress runes even for unmapped keys. (#2685) Note that this is a theoretical bug - I do not have a keyboard I can reproduce this. However, if I remove a key from genkeys.go, pressing that key will, after this change, still emit its character to AppendInputChars. Thus, this better supports "odd" international keyboards. Also, make the updateInput calls more consistent - always one call per event. This should change no behavior, but should be more debuggable. Closes #2684 --- mobile/ebitenmobileview/input_android.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mobile/ebitenmobileview/input_android.go b/mobile/ebitenmobileview/input_android.go index 300defa3d..930e3fe11 100644 --- a/mobile/ebitenmobileview/input_android.go +++ b/mobile/ebitenmobileview/input_android.go @@ -142,12 +142,12 @@ func OnKeyDownOnAndroid(keyCode int, unicodeChar int, source int, deviceID int) case source&sourceKeyboard == sourceKeyboard: if key, ok := androidKeyToUIKey[keyCode]; ok { keys[key] = struct{}{} - var runes []rune - if r := rune(unicodeChar); r != 0 && unicode.IsPrint(r) { - runes = []rune{r} - } - updateInput(runes) } + var runes []rune + if r := rune(unicodeChar); r != 0 && unicode.IsPrint(r) { + runes = []rune{r} + } + updateInput(runes) } } @@ -163,8 +163,8 @@ func OnKeyUpOnAndroid(keyCode int, source int, deviceID int) { case source&sourceKeyboard == sourceKeyboard: if key, ok := androidKeyToUIKey[keyCode]; ok { delete(keys, key) - updateInput(nil) } + updateInput(nil) } }