-
Notifications
You must be signed in to change notification settings - Fork 919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion failure on MacOS when pressing globe key #2872
Comments
This is likely from this part of Not sure why it would throw that assertion though? Could you try with Also, what MacOS version are you using? |
I've hit the error myself a few times now, not sure exactly what causes it, but I think it is when |
Currently running MacOS 13.4.1 on M1, winit master (c5941d1). I've added a couple of print statements and it seems the function bails when calling diff --git a/src/platform_impl/macos/event.rs b/src/platform_impl/macos/event.rs
index 785647e3..5a50cae3 100644
--- a/src/platform_impl/macos/event.rs
+++ b/src/platform_impl/macos/event.rs
@@ -113,8 +113,10 @@ pub fn get_modifierless_char(scancode: u16) -> Key {
}
fn get_logical_key_char(ns_event: &NSEvent, modifierless_chars: &str) -> Key {
- let string = ns_event
- .charactersIgnoringModifiers()
+ eprintln!("get_logical_key_char?: {:?}", ns_event);
+ let t = ns_event.charactersIgnoringModifiers();
+ eprintln!("get_logical_key_char in the middle");
+ let string = t
.map(|s| s.to_string())
.unwrap_or_else(String::new);
if string.is_empty() { % cargo run --example=window >/dev/null
Finished dev [unoptimized + debuginfo] target(s) in 0.13s
Running `target/debug/examples/window`
get_logical_key_char?: NSEvent { __inner: NSEvent: type=FlagsChanged loc=(-560.422,-150.617) time=94696.0 flags=0x800100 win=0x12184c240 winNum=3735 ctxt=0x0 keyCode=63 }
2023-07-13 11:17:13.691 window[55081:1023564] *** Assertion failure in -[NSEvent charactersIgnoringModifiers], NSEvent.m:2699
get_logical_key_char?: NSEvent { __inner: NSEvent: type=FlagsChanged loc=(-563.398,-143.344) time=94696.2 flags=0x100 win=0x12184c240 winNum=3735 ctxt=0x0 keyCode=63 }
2023-07-13 11:17:13.811 window[55081:1023564] *** Assertion failure in -[NSEvent charactersIgnoringModifiers], NSEvent.m:2699 Indeed, the docs for
|
Given that you have a log around already, could you press |
Sure thing. 🌐 + no modifiers:
🌐 + Shift:
🌐 + Command:
🌐 + Option:
🌐 + Control:
|
I was interested more in pressing them without a globe key. If you have such an option. |
Ah, ok. I've attempted to filter out noisy messages, hopefully I haven't excluded anything important.
|
I was hoping for messages like
But I can look myself once I have time. I'd at least |
|
@madsmtm do you have an idea what is happening here? I guess we should sort of check event type before calling other funcs in update modifiers? |
I am hitting this same issue on macOS Ventura when using Using b2b4564 with the patch above, this is the output:
To be clear, here are the steps:
|
I think what we should be doing, is not to try get the characters when the flag is being pressed? it's not like flag could produce the character input. I'll try to repro that once I want to work on macOS stuff. |
Sometimes FlagsChanged events don't carry any KeyCode information, thus we can't create a synthetic presses events for them. However in such cases, modifiers information is still accurate, thus propagate it. Fixes rust-windowing#2872.
Sometimes FlagsChanged events don't carry any KeyCode information, thus we can't create a synthetic presses events for them. However in such cases, modifiers information is still accurate, thus propagate it. Fixes #2872.
Sometimes FlagsChanged events don't carry any KeyCode information, thus we can't create a synthetic presses events for them. However in such cases, modifiers information is still accurate, thus propagate it. Fixes rust-windowing#2872.
Sometimes FlagsChanged events don't carry any KeyCode information, thus we can't create a synthetic presses events for them. However in such cases, modifiers information is still accurate, thus propagate it. Fixes #2872.
On MacOS, pressing
🌐
in a winit window triggers an error message:The text was updated successfully, but these errors were encountered: