Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd event support, use for disconnection and inputs #20
Conversation
834d906
to
b7d5165
|
Okay, session ending is a total mess. We need:
Currently, there are a bunch of things preventing this from happening:
I think this will need a bunch of changes to work right. I think we should just land this PR and servo/servo#23814 first as it improves some of the tests and makes them less flaky, then overhaul how we do mocking. The changes we need:
This will change a lot of things, thus the preference for landing the progress we have so far as-is to deal with intermittents. |
|
OK, I agree that this isn't perfect, but can land. I had a bunch of niggles but none of them are show-stoppers. |
| fn connected(&mut self) -> bool; | ||
|
|
||
| /// Quit the session | ||
| fn quit(&mut self); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Manishearth
Jul 22, 2019
Author
Member
Then XRSession would have to store an Option<Session> for no good reason.
| fn set_event_callback(&mut self, callback: Box<dyn EventCallback>); | ||
|
|
||
| /// Whether the device is still connected | ||
| fn connected(&mut self) -> bool; |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| /// Input source disconnected | ||
| RemoveInput(InputId), | ||
| /// Session ended by device | ||
| SessionEnd, |
This comment has been minimized.
This comment has been minimized.
asajeffrey
Jul 22, 2019
Member
Should there be an event for the device being disconnected too? Blur / focus events?
This comment has been minimized.
This comment has been minimized.
Manishearth
Jul 22, 2019
Author
Member
Same thing as SessionEnd from the POV of the device IMO.
Blur/Focus yes, I just haven't gotten to it yet.
This comment has been minimized.
This comment has been minimized.
|
|
||
| fn quit(&mut self) { | ||
| self.connected = false; | ||
| self.events.callback(Event::SessionEnd); |
This comment has been minimized.
This comment has been minimized.
| struct HeadlessDevice { | ||
| gl: Rc<dyn Gl>, | ||
| floor_transform: TypedRigidTransform3D<f32, Native, Floor>, | ||
| viewer_origin: TypedRigidTransform3D<f32, Viewer, Native>, | ||
| views: Views, | ||
| receiver: Receiver<MockDeviceMsg>, | ||
| events: EventBuffer, | ||
| inputs: Vec<InputInfo>, | ||
| disconnect_callbacks: Vec<Sender<()>>, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Manishearth
Jul 22, 2019
Author
Member
The mock API requires we signal disconnection to have succeeded.
| } else { | ||
| for callback in self.disconnect_callbacks.drain(..) { | ||
| let _ = callback.send(()); | ||
| } |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@bors-servo r=asajeffrey |
|
|
Add event support, use for disconnection and inputs Allow the device to send events back to script r? @asajeffrey
|
@bors-servo r=asajeffrey |
|
|
Add event support, use for disconnection and inputs Allow the device to send events back to script r? @asajeffrey
|
|
|
@bors-servo r=asajeffrey |
|
|
Add event support, use for disconnection and inputs Allow the device to send events back to script r? @asajeffrey
|
|
|
@bors-servo r=asajeffrey |
|
|
Add event support, use for disconnection and inputs Allow the device to send events back to script r? @asajeffrey
|
|
Partial support for events in WebXR Needs servo/webxr#20 r? @asajeffrey <!-- 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/23814) <!-- Reviewable:end -->
Partial support for events in WebXR Needs servo/webxr#20 r? @asajeffrey <!-- 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/23814) <!-- Reviewable:end -->
Manishearth commentedJul 19, 2019
Allow the device to send events back to script
r? @asajeffrey