diff options
author | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-10-09 12:16:35 +0200 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2019-11-20 13:33:15 +0100 |
commit | 89d9e3ad78ce4698dfab9b2fc310a20f4964e380 (patch) | |
tree | fff14daecb40dd3325c49be860604e1adff7b08b /ports | |
parent | 4d147d2c56465405e7c3281073ef57fe1bd1c062 (diff) | |
download | servo-89d9e3ad78ce4698dfab9b2fc310a20f4964e380.tar.gz servo-89d9e3ad78ce4698dfab9b2fc310a20f4964e380.zip |
Introduce embedder MediaSessionEvent and move active session to Servo
Diffstat (limited to 'ports')
-rw-r--r-- | ports/libsimpleservo/api/src/lib.rs | 9 | ||||
-rw-r--r-- | ports/libsimpleservo/capi/src/lib.rs | 11 |
2 files changed, 11 insertions, 9 deletions
diff --git a/ports/libsimpleservo/api/src/lib.rs b/ports/libsimpleservo/api/src/lib.rs index 4f1d0aa6a22..b7f0d3587b4 100644 --- a/ports/libsimpleservo/api/src/lib.rs +++ b/ports/libsimpleservo/api/src/lib.rs @@ -42,6 +42,7 @@ thread_local! { /// It will be called to notify embedder that some events are available, /// and that perform_updates need to be called pub use servo::embedder_traits::EventLoopWaker; +pub use servo::embedder_traits::MediaSessionEvent; pub struct InitOptions { pub args: Vec<String>, @@ -130,8 +131,8 @@ pub trait HostTrait { fn get_clipboard_contents(&self) -> Option<String>; /// Sets system clipboard contents fn set_clipboard_contents(&self, contents: String); - /// Called when a media session is activated or deactivated. - fn on_media_session(&self, active: bool); + /// Called when there is a new media session event. + fn on_media_session_event(&self, event: MediaSessionEvent); } pub struct ServoGlue { @@ -583,8 +584,8 @@ impl ServoGlue { EmbedderMsg::HideIME => { self.callbacks.host_callbacks.on_ime_state_changed(false); }, - EmbedderMsg::MediaSession(active) => { - self.callbacks.host_callbacks.on_media_session(active); + EmbedderMsg::MediaSessionEvent(event) => { + self.callbacks.host_callbacks.on_media_session_event(event); }, EmbedderMsg::Status(..) | EmbedderMsg::SelectFiles(..) | diff --git a/ports/libsimpleservo/capi/src/lib.rs b/ports/libsimpleservo/capi/src/lib.rs index 4fbd239000e..57043407879 100644 --- a/ports/libsimpleservo/capi/src/lib.rs +++ b/ports/libsimpleservo/capi/src/lib.rs @@ -17,7 +17,7 @@ use env_logger; use log::LevelFilter; use simpleservo::{self, gl_glue, ServoGlue, SERVO}; use simpleservo::{ - Coordinates, EventLoopWaker, HostTrait, InitOptions, MouseButton, VRInitOptions, + Coordinates, EventLoopWaker, HostTrait, InitOptions, MediaSessionEvent, MouseButton, VRInitOptions, }; use std::ffi::{CStr, CString}; #[cfg(target_os = "windows")] @@ -216,7 +216,8 @@ pub struct CHostCallbacks { pub on_ime_state_changed: extern "C" fn(show: bool), pub get_clipboard_contents: extern "C" fn() -> *const c_char, pub set_clipboard_contents: extern "C" fn(contents: *const c_char), - pub on_media_session: extern "C" fn(active: bool), + // TODO(ferjm) pass C representation of media event. + pub on_media_session_event: extern "C" fn(), } /// Servo options @@ -710,8 +711,8 @@ impl HostTrait for HostCallbacks { (self.0.set_clipboard_contents)(contents.as_ptr()); } - fn on_media_session(&self, active: bool) { - debug!("on_media_session (active: {:?})", active); - (self.0.on_media_session)(active); + fn on_media_session_event(&self, event: MediaSessionEvent) { + debug!("on_media_session_event (event: {:?})", event); + (self.0.on_media_session_event)(); } } |