mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Don't unwrap for unknown keys
This commit is contained in:
parent
cf9b927461
commit
1e70d95724
1 changed files with 10 additions and 5 deletions
|
@ -373,11 +373,16 @@ impl Window {
|
||||||
} else {
|
} else {
|
||||||
// Only send the character if we can print it (by ignoring characters like backspace)
|
// Only send the character if we can print it (by ignoring characters like backspace)
|
||||||
if !ch.is_control() {
|
if !ch.is_control() {
|
||||||
let event = WindowEvent::KeyEvent(Some(ch),
|
match Window::char_to_script_key(ch) {
|
||||||
Window::char_to_script_key(ch).unwrap(),
|
Some(key) => {
|
||||||
KeyState::Pressed,
|
let event = WindowEvent::KeyEvent(Some(ch),
|
||||||
modifiers);
|
key,
|
||||||
self.event_queue.borrow_mut().push(event);
|
KeyState::Pressed,
|
||||||
|
modifiers);
|
||||||
|
self.event_queue.borrow_mut().push(event);
|
||||||
|
}
|
||||||
|
None => {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.last_pressed_key.set(None);
|
self.last_pressed_key.set(None);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue