aboutsummaryrefslogtreecommitdiffstats
path: root/components/servo/lib.rs
diff options
context:
space:
mode:
authorPaul Rouget <me@paulrouget.com>2018-02-22 10:22:53 +0100
committerPaul Rouget <me@paulrouget.com>2018-03-22 08:07:32 +0100
commit1cdba8843d7bc10834d2ce1b2904eedd99e7ac00 (patch)
tree59102cc49d486dea784a9ffb6cdb5d5bff78ba69 /components/servo/lib.rs
parent34c2150e4f1a2a0ca2569bddc824653309b63c90 (diff)
downloadservo-1cdba8843d7bc10834d2ce1b2904eedd99e7ac00.tar.gz
servo-1cdba8843d7bc10834d2ce1b2904eedd99e7ac00.zip
split window code and browser code in two different files
Diffstat (limited to 'components/servo/lib.rs')
-rw-r--r--components/servo/lib.rs15
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) {