On Web, implement WindowEvent::Occluded (#2940)

This commit is contained in:
daxpedda
2023-07-10 02:02:38 +02:00
committed by Kirill Chibisov
parent 7a4ce631bd
commit 5fa4b8f003
9 changed files with 165 additions and 9 deletions

View File

@@ -720,6 +720,16 @@ impl<T> EventLoopWindowTarget<T> {
}
},
);
let runner = self.runner.clone();
canvas.on_intersection(move |is_intersecting| {
if backend::is_visible(runner.window()) {
runner.send_event(Event::WindowEvent {
window_id: RootWindowId(id),
event: WindowEvent::Occluded(!is_intersecting),
});
}
})
}
pub fn available_monitors(&self) -> VecDequeIter<MonitorHandle> {