mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Modified constellation key event handler to deal with missing frames
This commit is contained in:
parent
2ae7ed327d
commit
b262fc16e0
1 changed files with 11 additions and 5 deletions
|
@ -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, mods))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn handle_get_pipeline_title_msg(&mut self, pipeline_id: PipelineId) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue