mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Implement Gamepad API
This commit is contained in:
parent
69eda6a60c
commit
0158b5b2af
27 changed files with 1193 additions and 96 deletions
|
@ -102,7 +102,6 @@ use script_traits::{LayoutMsg as FromLayoutMsg, ScriptMsg as FromScriptMsg, Scri
|
|||
use script_traits::{LogEntry, ServiceWorkerMsg, webdriver_msg};
|
||||
use script_traits::{MozBrowserErrorType, MozBrowserEvent, WebDriverCommandMsg, WindowSizeData};
|
||||
use script_traits::{SWManagerMsg, ScopeThings, WindowSizeType};
|
||||
use script_traits::WebVREventMsg;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use servo_config::opts;
|
||||
use servo_config::prefs::PREFS;
|
||||
|
@ -124,7 +123,7 @@ use style_traits::cursor::Cursor;
|
|||
use style_traits::viewport::ViewportConstraints;
|
||||
use timer_scheduler::TimerScheduler;
|
||||
use webrender_traits;
|
||||
use webvr_traits::WebVRMsg;
|
||||
use webvr_traits::{WebVREvent, WebVRMsg};
|
||||
|
||||
/// The `Constellation` itself. In the servo browser, there is one
|
||||
/// constellation, which maintains all of the browser global data.
|
||||
|
@ -897,9 +896,9 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
assert!(self.webvr_thread.is_none());
|
||||
self.webvr_thread = Some(webvr_thread)
|
||||
}
|
||||
FromCompositorMsg::WebVREvent(pipeline_ids, event) => {
|
||||
debug!("constellation got WebVR event");
|
||||
self.handle_webvr_event(pipeline_ids, event);
|
||||
FromCompositorMsg::WebVREvents(pipeline_ids, events) => {
|
||||
debug!("constellation got {:?} WebVR events", events.len());
|
||||
self.handle_webvr_events(pipeline_ids, events);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1326,12 +1325,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
}
|
||||
}
|
||||
|
||||
fn handle_webvr_event(&mut self, ids: Vec<PipelineId>, event: WebVREventMsg) {
|
||||
fn handle_webvr_events(&mut self, ids: Vec<PipelineId>, events: Vec<WebVREvent>) {
|
||||
for id in ids {
|
||||
match self.pipelines.get_mut(&id) {
|
||||
Some(ref pipeline) => {
|
||||
// Notify script thread
|
||||
let _ = pipeline.event_loop.send(ConstellationControlMsg::WebVREvent(id, event.clone()));
|
||||
let _ = pipeline.event_loop.send(ConstellationControlMsg::WebVREvents(id, events.clone()));
|
||||
},
|
||||
None => warn!("constellation got webvr event for dead pipeline")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue