diff options
-rw-r--r-- | components/servo/main.rs | 2 | ||||
-rw-r--r-- | ports/cef/browser.rs | 2 | ||||
-rw-r--r-- | ports/glutin/lib.rs | 6 | ||||
-rw-r--r-- | ports/glutin/window.rs | 5 |
4 files changed, 9 insertions, 6 deletions
diff --git a/components/servo/main.rs b/components/servo/main.rs index 0358a971b3e..53002888b4a 100644 --- a/components/servo/main.rs +++ b/components/servo/main.rs @@ -53,7 +53,7 @@ fn main() { let window = if opts::get().headless { None } else { - Some(app::create_window()) + Some(app::create_window(std::ptr::null_mut())) }; // Our wrapper around `Browser` that also implements some diff --git a/ports/cef/browser.rs b/ports/cef/browser.rs index 90e13801bec..58b3a8b1919 100644 --- a/ports/cef/browser.rs +++ b/ports/cef/browser.rs @@ -96,7 +96,7 @@ impl ServoCefBrowser { let host = ServoCefBrowserHost::new(client.clone()).as_cef_interface(); let servo_browser = if window_info.windowless_rendering_enabled == 0 { - let glutin_window = glutin_app::create_window(); + let glutin_window = glutin_app::create_window(window_info.parent_window as glutin_app::WindowID); let servo_browser = Browser::new(Some(glutin_window.clone())); ServoBrowser::OnScreen(servo_browser) } else { diff --git a/ports/glutin/lib.rs b/ports/glutin/lib.rs index b655bf4ef7f..a0104edb991 100644 --- a/ports/glutin/lib.rs +++ b/ports/glutin/lib.rs @@ -30,11 +30,13 @@ use util::opts; pub mod window; +pub type WindowID = glutin::WindowID; + pub trait NestedEventLoopListener { fn handle_event_from_nested_event_loop(&mut self, event: WindowEvent) -> bool; } -pub fn create_window() -> Rc<Window> { +pub fn create_window(parent: WindowID) -> Rc<Window> { // Read command-line options. let opts = opts::get(); let foreground = opts.output_file.is_none(); @@ -42,5 +44,5 @@ pub fn create_window() -> Rc<Window> { let size = opts.initial_window_size.as_f32() * scale_factor; // Open a window. - Window::new(foreground, size.as_uint().cast().unwrap()) + Window::new(foreground, size.as_uint().cast().unwrap(), parent) } diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index 48a1c9b61c9..8518833a604 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -71,12 +71,13 @@ pub struct Window { #[cfg(feature = "window")] impl Window { - pub fn new(is_foreground: bool, window_size: TypedSize2D<DevicePixel, u32>) -> Rc<Window> { + pub fn new(is_foreground: bool, window_size: TypedSize2D<DevicePixel, u32>, parent: glutin::WindowID) -> Rc<Window> { let mut glutin_window = glutin::WindowBuilder::new() .with_title("Servo".to_string()) .with_dimensions(window_size.to_untyped().width, window_size.to_untyped().height) .with_gl(Window::gl_version()) .with_visibility(is_foreground) + .with_parent(parent) .build() .unwrap(); unsafe { glutin_window.make_current() }; @@ -614,7 +615,7 @@ pub struct Window { #[cfg(feature = "headless")] impl Window { - pub fn new(_is_foreground: bool, window_size: TypedSize2D<DevicePixel, u32>) -> Rc<Window> { + pub fn new(_is_foreground: bool, window_size: TypedSize2D<DevicePixel, u32>, _parent: glutin::WindowID) -> Rc<Window> { let window_size = window_size.to_untyped(); let headless_builder = glutin::HeadlessRendererBuilder::new(window_size.width, window_size.height); |