mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
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:
parent
1b9a7439f4
commit
0439167637
@ -142,12 +142,12 @@ func OnKeyDownOnAndroid(keyCode int, unicodeChar int, source int, deviceID int)
|
|||||||
case source&sourceKeyboard == sourceKeyboard:
|
case source&sourceKeyboard == sourceKeyboard:
|
||||||
if key, ok := androidKeyToUIKey[keyCode]; ok {
|
if key, ok := androidKeyToUIKey[keyCode]; ok {
|
||||||
keys[key] = struct{}{}
|
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:
|
case source&sourceKeyboard == sourceKeyboard:
|
||||||
if key, ok := androidKeyToUIKey[keyCode]; ok {
|
if key, ok := androidKeyToUIKey[keyCode]; ok {
|
||||||
delete(keys, key)
|
delete(keys, key)
|
||||||
updateInput(nil)
|
|
||||||
}
|
}
|
||||||
|
updateInput(nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user