On macOS, remove spurious error logging when handling Fn

Fixes #3246.
This commit is contained in:
Emil Ernerfeldt 2023-11-28 20:19:16 +01:00 committed by GitHub
parent 17296e9878
commit a7241b3db3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -11,6 +11,8 @@ Unreleased` header.
# Unreleased
- On macOS, remove spurious error logging when handling `Fn`.
# 0.29.4
- Fix crash when running iOS app on macOS.

View file

@ -88,7 +88,9 @@ pub fn get_modifierless_char(scancode: u16) -> Key {
return Key::Unidentified(NativeKey::MacOS(scancode));
}
if result_len == 0 {
log::error!("`UCKeyTranslate` was succesful but gave a string of 0 length.");
// This is fine - not all keys have text representation.
// For instance, users that have mapped the `Fn` key to toggle
// keyboard layouts will hit this code path.
return Key::Unidentified(NativeKey::MacOS(scancode));
}
let chars = String::from_utf16_lossy(&string[0..result_len as usize]);