Finish the integration of webxr into the Cargo workspace (#35229)

- Run `cargo fmt` on `webxr` and `webxr-api`
- Fix clippy warnings in the existing `webxr` code
- Integrate the new crates into the workspace
- Expose `webxr` via the libservo API rather than requiring embedders to
  depend on it explicitly.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-01-31 17:41:57 +01:00 committed by GitHub
parent a4c6c205d2
commit 5466c27f6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 448 additions and 649 deletions

View file

@ -2,33 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::DiscoveryAPI;
use crate::Display;
use crate::EntityType;
use crate::Error;
use crate::Floor;
use crate::Handedness;
use crate::Input;
use crate::InputId;
use crate::InputSource;
use crate::LeftEye;
use crate::Native;
use crate::Receiver;
use crate::RightEye;
use crate::SelectEvent;
use crate::SelectKind;
use crate::Sender;
use crate::TargetRayMode;
use crate::Triangle;
use crate::Viewer;
use crate::Viewport;
use crate::Visibility;
use euclid::{Point2D, Rect, RigidTransform3D, Transform3D};
#[cfg(feature = "ipc")]
use serde::{Deserialize, Serialize};
use crate::{
DiscoveryAPI, Display, EntityType, Error, Floor, Handedness, Input, InputId, InputSource,
LeftEye, Native, Receiver, RightEye, SelectEvent, SelectKind, Sender, TargetRayMode, Triangle,
Viewer, Viewport, Visibility,
};
/// A trait for discovering mock XR devices
pub trait MockDiscoveryAPI<GL>: 'static {
fn simulate_device_connection(
@ -103,7 +86,7 @@ pub enum MockInputMsg {
SetGripOrigin(Option<RigidTransform3D<f32, Input, Native>>),
/// Note: SelectEvent::Select here refers to a complete Select event,
/// not just the end event, i.e. it refers to
/// https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-simulateselect
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-simulateselect>
TriggerSelect(SelectKind, SelectEvent),
Disconnect,
Reconnect,