Skip to content

Instantly share code, notes, and snippets.

@paulrouget
Created May 15, 2017 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulrouget/e131558e298b5cbd33c02a94ad2cc5ec to your computer and use it in GitHub Desktop.
Save paulrouget/e131558e298b5cbd33c02a94ad2cc5ec to your computer and use it in GitHub Desktop.
diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs
index ddd5398845..0f69b30a9e 100644
--- a/ports/glutin/window.rs
+++ b/ports/glutin/window.rs
@@ -1179,7 +1179,15 @@ impl WindowMethods for Window {
}
fn prepare_for_composite(&self, _width: usize, _height: usize) -> bool {
- true
+ match self.kind {
+ WindowKind::Window(ref window) => {
+ unsafe { window.make_current().expect("Failed to make context current!") };
+ true
+ }
+ WindowKind::Headless(ref context) => {
+ true
+ }
+ }
}
/// Helper function to handle keyboard events.
diff --git a/ports/servo/main.rs b/ports/servo/main.rs
index 6534aed75c..0ee3476443 100644
--- a/ports/servo/main.rs
/// Helper function to handle keyboard events.
diff --git a/ports/servo/main.rs b/ports/servo/main.rs
index 6534aed75c..0ee3476443 100644
--- a/ports/servo/main.rs
+++ b/ports/servo/main.rs
@@ -137,30 +137,34 @@ fn main() {
process::exit(0);
}
- let window = app::create_window(None);
+ let window1 = app::create_window(None);
+ let window2 = app::create_window(None);
// Our wrapper around `Browser` that also implements some
// callbacks required by the glutin window implementation.
- let mut browser = BrowserWrapper {
- browser: Browser::new(window.clone()),
+ let mut browser1 = BrowserWrapper {
+ browser: Browser::new(window1.clone()),
};
- browser.browser.setup_logging();
+ let mut browser2 = BrowserWrapper {
+ browser: Browser::new(window2.clone()),
+ };
+
+ // browser.browser.setup_logging();
- register_glutin_resize_handler(&window, &mut browser);
+ // register_glutin_resize_handler(&window, &mut browser);
- browser.browser.handle_events(vec![WindowEvent::InitializeCompositing]);
+ browser1.browser.handle_events(vec![WindowEvent::InitializeCompositing]);
+ browser2.browser.handle_events(vec![WindowEvent::InitializeCompositing]);
// Feed events from the window to the browser until the browser
// says to stop.
loop {
- let should_continue = browser.browser.handle_events(window.wait_events());
- if !should_continue {
- break;
- }
+ browser1.browser.handle_events(window1.wait_events());
+ browser2.browser.handle_events(window2.wait_events());
}
- unregister_glutin_resize_handler(&window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment