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
Deprecate ReceivedCharacter
#12868
Deprecate ReceivedCharacter
#12868
Conversation
da31c8f
to
fd8b331
Compare
What needs to be done before you can take this out of draft? |
If we deprecate received character, what's the recommended way to say get a capital character for a text box |
Just need to fix the CI errors, should have time shortly :) |
See the updated |
@@ -1,3 +1,4 @@ | |||
#![allow(deprecated)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be localized to where they're supposed to be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this achieved for the WinitEvent
enum in winit_event.rs
? I've tried the following placements:
#[allow(deprecated)]
pub enum WinitEvent {
// ..
#[allow(deprecated)]
ReceivedCharacter(#[allow(deprecated)] ReceivedCharacter),
// ..
}
but clippy still seems to complain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it needs to go on the functions that use the WinitEvent
I tried it out and it does seem to provide what is needed, but it's not an exact 1-1 replacement, since it includes both pressed and released events. The equivalent to // Before
fn my_system(events: EventReader<ReceivedCharater>) {
for event in events.read() {
info!("{}", event.char);
}
}
// After
fn my_system(events: EventReader<ReceivedCharater>) {
for event in events.read().filter(|event| event.state == ButtonState::Released) {
if let Key::Character(character) = &event.logical_key {
info!("{}", character);
}
}
} |
Yeah I accounted for this in the |
Co-authored-by: Mike <mike.hsu@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good: the migration guide is solid. I won't block on figuring out how to localize those deprecated warnings: they'll be cleaned up shortly after the release anyways.
Does clippy warn on unused |
Objective
ReceivedCharacter
#12639.Solution
ReceivedCharacter
.ReceivedCharacter
withKeyboardInput
in the relevant examples.Migration Guide
ReceivedCharacter
is now deprecated, useKeyboardInput
instead.Before:
After: