diff options
author | Paul Rouget <me@paulrouget.com> | 2020-02-19 14:09:50 +0100 |
---|---|---|
committer | Paul Rouget <me@paulrouget.com> | 2020-02-19 14:10:49 +0100 |
commit | 6ddde1a3e1284a91f3088bf48d72d9425505df12 (patch) | |
tree | a1ff09268d6dc23454f3c95c3766f2cb66dda7a1 /ports/libsimpleservo/api/src | |
parent | 5597ccf57ddc2b77fcb4a8071f575b0dc9389a12 (diff) | |
download | servo-6ddde1a3e1284a91f3088bf48d72d9425505df12.tar.gz servo-6ddde1a3e1284a91f3088bf48d72d9425505df12.zip |
Stop animations when window is hidden (API + UWP)
Diffstat (limited to 'ports/libsimpleservo/api/src')
-rw-r--r-- | ports/libsimpleservo/api/src/lib.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ports/libsimpleservo/api/src/lib.rs b/ports/libsimpleservo/api/src/lib.rs index 2489760052f..1d62d642be1 100644 --- a/ports/libsimpleservo/api/src/lib.rs +++ b/ports/libsimpleservo/api/src/lib.rs @@ -487,6 +487,17 @@ impl ServoGlue { self.process_event(WindowEvent::MediaSessionAction(action)) } + pub fn change_visibility(&mut self, visible: bool) -> Result<(), &'static str> { + info!("change_visibility"); + if let Ok(id) = self.get_browser_id() { + let event = WindowEvent::ChangeBrowserVisibility(id, visible); + self.process_event(event) + } else { + // Ignore visibility change if no browser has been created yet. + Ok(()) + } + } + fn process_event(&mut self, event: WindowEvent) -> Result<(), &'static str> { self.events.push(event); if !self.batch_mode { |