mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
auto merge of #4822 : KiChjang/servo/constellation-frame-handling, r=jdm
Attempt at fixing #4795. Code has been written to check for the existence for the current frame, but it seems to pass the condition every time.
This commit is contained in:
commit
58a3cdcbef
3 changed files with 17 additions and 11 deletions
|
@ -358,8 +358,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(Msg::KeyEvent(key, modified), ShutdownState::NotShuttingDown) => {
|
(Msg::KeyEvent(key, state, modified), ShutdownState::NotShuttingDown) => {
|
||||||
self.window.handle_key(key, modified);
|
if state == KeyState::Pressed {
|
||||||
|
self.window.handle_key(key, modified);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(Msg::SetCursor(cursor), ShutdownState::NotShuttingDown) => {
|
(Msg::SetCursor(cursor), ShutdownState::NotShuttingDown) => {
|
||||||
|
|
|
@ -91,9 +91,7 @@ impl ScriptListener for Box<CompositorProxy+'static+Send> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_key_event(&mut self, key: Key, state: KeyState, modifiers: KeyModifiers) {
|
fn send_key_event(&mut self, key: Key, state: KeyState, modifiers: KeyModifiers) {
|
||||||
if state == KeyState::Pressed {
|
self.send(Msg::KeyEvent(key, state, modifiers));
|
||||||
self.send(Msg::KeyEvent(key, modifiers));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +216,7 @@ pub enum Msg {
|
||||||
/// composite should happen. (See the `scrolling` module.)
|
/// composite should happen. (See the `scrolling` module.)
|
||||||
ScrollTimeout(u64),
|
ScrollTimeout(u64),
|
||||||
/// Sends an unconsumed key event back to the compositor.
|
/// Sends an unconsumed key event back to the compositor.
|
||||||
KeyEvent(Key, KeyModifiers),
|
KeyEvent(Key, KeyState, KeyModifiers),
|
||||||
/// Changes the cursor.
|
/// Changes the cursor.
|
||||||
SetCursor(Cursor),
|
SetCursor(Cursor),
|
||||||
/// Informs the compositor that the paint task for the given pipeline has exited.
|
/// Informs the compositor that the paint task for the given pipeline has exited.
|
||||||
|
|
|
@ -885,11 +885,17 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_key_msg(&self, key: Key, state: KeyState, mods: KeyModifiers) {
|
fn handle_key_msg(&self, key: Key, state: KeyState, mods: KeyModifiers) {
|
||||||
self.current_frame().as_ref().map(|frame| {
|
match *self.current_frame() {
|
||||||
let ScriptControlChan(ref chan) = frame.pipeline.borrow().script_chan;
|
Some(ref frame) => {
|
||||||
chan.send(ConstellationControlMsg::SendEvent(
|
let ScriptControlChan(ref chan) = frame.pipeline.borrow().script_chan;
|
||||||
frame.pipeline.borrow().id, CompositorEvent::KeyEvent(key, state, mods))).unwrap();
|
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) {
|
fn handle_get_pipeline_title_msg(&mut self, pipeline_id: PipelineId) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue