mirror of
https://github.com/servo/servo.git
synced 2025-10-01 00:59:15 +01:00
Auto merge of #25799 - paulrouget:hideWindow, r=Manishearth
Hide window Stop animations when the window is hidden. Tested with both Immersive Mode, and regular window being minimized. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #25794 (GitHub issue number if applicable)
This commit is contained in:
commit
b5b9732509
12 changed files with 78 additions and 1 deletions
|
@ -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 {
|
||||
|
|
|
@ -686,6 +686,14 @@ pub extern "C" fn media_session_action(action: CMediaSessionActionType) {
|
|||
});
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn change_visibility(visible: bool) {
|
||||
catch_any_panic(|| {
|
||||
debug!("change_visibility");
|
||||
call(|s| s.change_visibility(visible));
|
||||
});
|
||||
}
|
||||
|
||||
pub struct WakeupCallback(extern "C" fn());
|
||||
|
||||
impl WakeupCallback {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue