Auto merge of #5995 - zmike:glutin-parenting, r=jdm

needed for embedding api usage

Depends on https://github.com/servo/glutin/pull/20

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5995)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-05-13 15:27:47 -05:00
commit a388a76d82
6 changed files with 11 additions and 8 deletions

View file

@ -430,7 +430,7 @@ dependencies = [
[[package]]
name = "glutin"
version = "0.0.26"
source = "git+https://github.com/servo/glutin?branch=servo#11389c9ead188376095297a5a295f53d98129a57"
source = "git+https://github.com/servo/glutin?branch=servo#b28f35aa5b06e7d34ada307a5a1b1e9b9de697a1"
dependencies = [
"android_glue 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gdi32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -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

2
ports/cef/Cargo.lock generated
View file

@ -432,7 +432,7 @@ dependencies = [
[[package]]
name = "glutin"
version = "0.0.26"
source = "git+https://github.com/servo/glutin?branch=servo#11389c9ead188376095297a5a295f53d98129a57"
source = "git+https://github.com/servo/glutin?branch=servo#b28f35aa5b06e7d34ada307a5a1b1e9b9de697a1"
dependencies = [
"android_glue 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gdi32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -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 {

View file

@ -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)
}

View file

@ -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);