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
This commit is contained in:
divVerent 2023-06-24 08:33:17 -04:00 committed by GitHub
parent ede787c228
commit 1a9bff390d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}
}