Implement AsFd/AsRawFd for EventLoop<T>
This should help other crates to integrate winit's event loop into their bigger event loop without adding an extra thread.
This commit is contained in:
parent
b938fe9df5
commit
c48116a8fd
5 changed files with 70 additions and 1 deletions
|
|
@ -32,7 +32,7 @@ use std::{
|
|||
ops::Deref,
|
||||
os::{
|
||||
raw::*,
|
||||
unix::io::{AsRawFd, BorrowedFd},
|
||||
unix::io::{AsFd, AsRawFd, BorrowedFd, RawFd},
|
||||
},
|
||||
ptr,
|
||||
rc::Rc,
|
||||
|
|
@ -658,6 +658,18 @@ impl<T: 'static> EventLoop<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> AsFd for EventLoop<T> {
|
||||
fn as_fd(&self) -> BorrowedFd<'_> {
|
||||
self.event_loop.as_fd()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> AsRawFd for EventLoop<T> {
|
||||
fn as_raw_fd(&self) -> RawFd {
|
||||
self.event_loop.as_raw_fd()
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn get_xtarget<T>(target: &RootELW<T>) -> &EventLoopWindowTarget<T> {
|
||||
match target.p {
|
||||
super::EventLoopWindowTarget::X(ref target) => target,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue