From 69273f2642cc6cc5765c192c97816beb82a6067a Mon Sep 17 00:00:00 2001 From: Antonio de Luna Date: Thu, 22 Oct 2015 12:20:56 -0700 Subject: [PATCH] Fixes #8154 --- ports/glutin/window.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index 781fdc7643b..339259f6df6 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -171,16 +171,13 @@ impl Window { (_, VirtualKeyCode::LWin) => self.toggle_modifier(LEFT_SUPER), (_, VirtualKeyCode::RWin) => self.toggle_modifier(RIGHT_SUPER), (_, key_code) => { - match Window::glutin_key_to_script_key(key_code) { - Ok(key) => { - let state = match element_state { - ElementState::Pressed => KeyState::Pressed, - ElementState::Released => KeyState::Released, - }; - let modifiers = Window::glutin_mods_to_script_mods(self.key_modifiers.get()); - self.event_queue.borrow_mut().push(WindowEvent::KeyEvent(key, state, modifiers)); - } - _ => {} + if let Ok(key) = Window::glutin_key_to_script_key(key_code) { + let state = match element_state { + ElementState::Pressed => KeyState::Pressed, + ElementState::Released => KeyState::Released, + }; + let modifiers = Window::glutin_mods_to_script_mods(self.key_modifiers.get()); + self.event_queue.borrow_mut().push(WindowEvent::KeyEvent(key, state, modifiers)); } } }