mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-29 05:14:48 +00:00
Fix backspace handling
On macOS at least, backspace triggers a character input event as well as key down/release -- the key_* handlers trigger as well as doCommandBySelector. We're not interested in backspace as an input character though. More generally, let's exclude control characters. This could be extended in the future to more categories.
This commit is contained in:
parent
0d751e6627
commit
6bcbf082ff
1 changed files with 13 additions and 11 deletions
|
@ -371,17 +371,19 @@ impl EventLoop {
|
|||
ref window_id,
|
||||
event: winit::event::WindowEvent::ReceivedCharacter(ch),
|
||||
} => {
|
||||
crate::animations::update_animations();
|
||||
ALL_WINDOWS.with(|windows| {
|
||||
if let Some(Some(window)) =
|
||||
windows.borrow().get(&window_id).map(|weakref| weakref.upgrade())
|
||||
{
|
||||
let key_event = KeyEvent::CharacterInput(ch.into());
|
||||
window.clone().process_key_input(&key_event, component);
|
||||
// FIXME: remove this, it should be based on actual changes rather than this
|
||||
window.request_redraw();
|
||||
}
|
||||
});
|
||||
if !ch.is_control() {
|
||||
crate::animations::update_animations();
|
||||
ALL_WINDOWS.with(|windows| {
|
||||
if let Some(Some(window)) =
|
||||
windows.borrow().get(&window_id).map(|weakref| weakref.upgrade())
|
||||
{
|
||||
let key_event = KeyEvent::CharacterInput(ch.into());
|
||||
window.clone().process_key_input(&key_event, component);
|
||||
// FIXME: remove this, it should be based on actual changes rather than this
|
||||
window.request_redraw();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
_ => (),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue