diff --git a/Cargo.lock b/Cargo.lock index ada44cd808a4..623c094c9cf8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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)", diff --git a/ports/glutin/Cargo.toml b/ports/glutin/Cargo.toml index e6642e17ce82..cae8a6287813 100644 --- a/ports/glutin/Cargo.toml +++ b/ports/glutin/Cargo.toml @@ -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" diff --git a/ports/glutin/embedder.rs b/ports/glutin/embedder.rs index 565f12fe5c03..36756d64a2fc 100644 --- a/ports/glutin/embedder.rs +++ b/ports/glutin/embedder.rs @@ -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); + } + } + } }