Auto merge of #23721 - asajeffrey:webxr-glwindow, r=Manishearth

Register a glwindow test XR device

<!-- Please describe your changes on the following line: -->

Registers a test WebXR device with the glutin port.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes do not require tests because it's webxr plumbing

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23721)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-07-06 09:44:53 -04:00 committed by GitHub
commit ba0628ae20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 3 deletions

5
Cargo.lock generated
View file

@ -4119,6 +4119,7 @@ dependencies = [
"sig 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tinyfiledialogs 3.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"webxr 0.0.1 (git+https://github.com/servo/webxr)",
"webxr-api 0.0.1 (git+https://github.com/servo/webxr)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"winres 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"x11 2.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -5510,7 +5511,7 @@ dependencies = [
[[package]]
name = "webxr"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#f8bfa261bcd54bfeb47f68f23043e547153d7491"
source = "git+https://github.com/servo/webxr#39600af83b714e910389c912706d7cd06406c7bb"
dependencies = [
"euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",
@ -5521,7 +5522,7 @@ dependencies = [
[[package]]
name = "webxr-api"
version = "0.0.1"
source = "git+https://github.com/servo/webxr#f8bfa261bcd54bfeb47f68f23043e547153d7491"
source = "git+https://github.com/servo/webxr#39600af83b714e910389c912706d7cd06406c7bb"
dependencies = [
"euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -59,7 +59,8 @@ log = "0.4"
rust-webvr = { version = "0.13", features = ["glwindow"] }
servo-media = {git = "https://github.com/servo/media"}
tinyfiledialogs = "3.0"
webxr = { git = "https://github.com/servo/webxr", features = ["glwindow"] }
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
webxr = { git = "https://github.com/servo/webxr", features = ["ipc", "glwindow"] }
[target.'cfg(any(target_os = "linux", target_os = "windows"))'.dependencies]
image = "0.21"

View file

@ -71,4 +71,20 @@ impl EmbedderMethods for EmbedderCallbacks {
// FIXME: support headless mode
}
}
fn register_webxr(&mut self, xr: &mut webxr_api::MainThreadRegistry) {
if !opts::get().headless {
if pref!(dom.webxr.test) {
warn!("Creating test XR device");
let gl = self.gl.clone();
let events_loop_clone = self.events_loop.clone();
let events_loop_factory = Box::new(move || {
events_loop_clone.borrow_mut().take().ok_or(EventsLoopClosed)
});
let gl_version = app::gl_version();
let discovery = webxr::glwindow::GlWindowDiscovery::new(gl, events_loop_factory, gl_version);
xr.register(discovery);
}
}
}
}