From 770c93354cd4f6f5dac570687f6996b017da4260 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Tue, 28 Nov 2023 14:42:37 +0100 Subject: [PATCH] Mac: Remove error log when pressing Fn key Closes https://github.com/rust-windowing/winit/issues/3246 --- src/platform_impl/macos/event.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/platform_impl/macos/event.rs b/src/platform_impl/macos/event.rs index 9c4a9a95c6..cdd79297ec 100644 --- a/src/platform_impl/macos/event.rs +++ b/src/platform_impl/macos/event.rs @@ -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]);