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

This commit is contained in:
daxpedda 2023-07-10 02:02:38 +02:00 committed by GitHub
parent bd890e69aa
commit 5e0e1e96bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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> {