diff options
Diffstat (limited to 'components/servo/lib.rs')
-rw-r--r-- | components/servo/lib.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/components/servo/lib.rs b/components/servo/lib.rs index a54d5dd52dd..0baf5be6f6f 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -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) { |