mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fire visibilitychange event appropriately
This commit is contained in:
parent
75c763120f
commit
d90317cfe4
2 changed files with 18 additions and 1 deletions
|
@ -49,7 +49,7 @@ use profile_traits::ipc;
|
|||
use std::cell::Cell;
|
||||
use std::mem;
|
||||
use std::rc::Rc;
|
||||
use webxr_api::{self, EnvironmentBlendMode, Event as XREvent, Frame, SelectEvent, Session};
|
||||
use webxr_api::{self, EnvironmentBlendMode, Event as XREvent, Frame, SelectEvent, Session, Visibility};
|
||||
|
||||
#[dom_struct]
|
||||
pub struct XRSession {
|
||||
|
@ -214,6 +214,22 @@ impl XRSession {
|
|||
frame.set_active(false);
|
||||
}
|
||||
},
|
||||
XREvent::VisibilityChange(v) => {
|
||||
let v = match v {
|
||||
Visibility::Visible => XRVisibilityState::Visible,
|
||||
Visibility::VisibleBlurred => XRVisibilityState::Visible_blurred,
|
||||
Visibility::Hidden => XRVisibilityState::Hidden,
|
||||
};
|
||||
self.visibility_state.set(v);
|
||||
let event = XRSessionEvent::new(
|
||||
&self.global(),
|
||||
atom!("visibilitychange"),
|
||||
false,
|
||||
false,
|
||||
self,
|
||||
);
|
||||
event.upcast::<Event>().fire(self.upcast());
|
||||
},
|
||||
_ => (), // XXXManishearth TBD
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue