diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index f09eb6b51a8..a556bf958b4 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -358,8 +358,10 @@ impl IOCompositor { } } - (Msg::KeyEvent(key, modified), ShutdownState::NotShuttingDown) => { - self.window.handle_key(key, modified); + (Msg::KeyEvent(key, state, modified), ShutdownState::NotShuttingDown) => { + if state == KeyState::Pressed { + self.window.handle_key(key, modified); + } } (Msg::SetCursor(cursor), ShutdownState::NotShuttingDown) => { diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs index 7eaf56798a2..e2f21d0910e 100644 --- a/components/compositing/compositor_task.rs +++ b/components/compositing/compositor_task.rs @@ -91,9 +91,7 @@ impl ScriptListener for Box { } fn send_key_event(&mut self, key: Key, state: KeyState, modifiers: KeyModifiers) { - if state == KeyState::Pressed { - self.send(Msg::KeyEvent(key, modifiers)); - } + self.send(Msg::KeyEvent(key, state, modifiers)); } } @@ -218,7 +216,7 @@ pub enum Msg { /// composite should happen. (See the `scrolling` module.) ScrollTimeout(u64), /// Sends an unconsumed key event back to the compositor. - KeyEvent(Key, KeyModifiers), + KeyEvent(Key, KeyState, KeyModifiers), /// Changes the cursor. SetCursor(Cursor), /// Informs the compositor that the paint task for the given pipeline has exited. diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index c59184f8631..6b71bcc1c78 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -893,7 +893,7 @@ impl Constellation { CompositorEvent::KeyEvent(key, state, mods))).unwrap(); }, None => self.compositor_proxy.clone_compositor_proxy() - .send(CompositorMsg::KeyEvent(key, mods)) + .send(CompositorMsg::KeyEvent(key, state, mods)) } }