split window code and browser code in two different files

This commit is contained in:
Paul Rouget 2018-02-22 10:22:53 +01:00
parent 34c2150e4f
commit 1cdba8843d
9 changed files with 478 additions and 417 deletions

View file

@ -107,7 +107,7 @@ use webvr::{WebVRThread, WebVRCompositorHandler};
pub use gleam::gl;
pub use servo_config as config;
pub use servo_url as url;
pub use msg::constellation_msg::TopLevelBrowsingContextId as BrowserId;
pub use msg::constellation_msg::{KeyState, TopLevelBrowsingContextId as BrowserId};
/// The in-process interface to Servo.
///
@ -372,6 +372,14 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
(_, ShutdownState::ShuttingDown) => {},
(EmbedderMsg::KeyEvent(top_level_browsing_context, ch, key, state, modified),
ShutdownState::NotShuttingDown) => {
if state == KeyState::Pressed {
let msg = EmbedderMsg::KeyEvent(top_level_browsing_context, ch, key, state, modified);
self.embedder_events.push(msg);
}
},
(msg, ShutdownState::NotShuttingDown) => {
self.embedder_events.push(msg);
},
@ -383,7 +391,7 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
::std::mem::replace(&mut self.embedder_events, Vec::new())
}
pub fn handle_events(&mut self, events: Vec<WindowEvent>) -> bool {
pub fn handle_events(&mut self, events: Vec<WindowEvent>) {
if self.compositor.receive_messages() {
self.receive_messages();
}
@ -392,8 +400,9 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
}
if self.compositor.shutdown_state != ShutdownState::FinishedShuttingDown {
self.compositor.perform_updates();
} else {
self.embedder_events.push(EmbedderMsg::Shutdown);
}
self.compositor.shutdown_state != ShutdownState::FinishedShuttingDown
}
pub fn repaint_synchronously(&mut self) {