aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/compositing/compositor.rs6
-rw-r--r--components/compositing/compositor_task.rs6
-rw-r--r--components/compositing/constellation.rs16
3 files changed, 17 insertions, 11 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs
index e9e0f6bf8d2..7ece8277d61 100644
--- a/components/compositing/compositor.rs
+++ b/components/compositing/compositor.rs
@@ -358,8 +358,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
}
- (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<CompositorProxy+'static+Send> {
}
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 45324165d0d..6b71bcc1c78 100644
--- a/components/compositing/constellation.rs
+++ b/components/compositing/constellation.rs
@@ -885,11 +885,17 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
fn handle_key_msg(&self, key: Key, state: KeyState, mods: KeyModifiers) {
- self.current_frame().as_ref().map(|frame| {
- let ScriptControlChan(ref chan) = frame.pipeline.borrow().script_chan;
- chan.send(ConstellationControlMsg::SendEvent(
- frame.pipeline.borrow().id, CompositorEvent::KeyEvent(key, state, mods))).unwrap();
- });
+ match *self.current_frame() {
+ Some(ref frame) => {
+ let ScriptControlChan(ref chan) = frame.pipeline.borrow().script_chan;
+ chan.send(ConstellationControlMsg::SendEvent(
+ frame.pipeline.borrow().id,
+ CompositorEvent::KeyEvent(key, state, mods))).unwrap();
+ },
+ None => self.compositor_proxy.clone_compositor_proxy()
+ .send(CompositorMsg::KeyEvent(key, state, mods))
+ }
+
}
fn handle_get_pipeline_title_msg(&mut self, pipeline_id: PipelineId) {