mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-26 22:53:15 -04:00
Let the users wake up the event loop and then they could poll their user sources. Co-authored-by: Mads Marquart <mads@marquart.dk> Co-authored-by: daxpedda <daxpedda@gmail.com>
20 lines
369 B
Rust
20 lines
369 B
Rust
//! An event loop proxy.
|
|
|
|
use sctk::reexports::calloop::ping::Ping;
|
|
|
|
/// A handle that can be sent across the threads and used to wake up the `EventLoop`.
|
|
#[derive(Clone)]
|
|
pub struct EventLoopProxy {
|
|
ping: Ping,
|
|
}
|
|
|
|
impl EventLoopProxy {
|
|
pub fn new(ping: Ping) -> Self {
|
|
Self { ping }
|
|
}
|
|
|
|
pub fn wake_up(&self) {
|
|
self.ping.ping();
|
|
}
|
|
}
|