Add new EventLoopWindowTargetExtUnix trait. (#1026)
* Add new `EventLoopWindowTargetExtUnix` trait. Signed-off-by: Hal Gentz <zegentzy@protonmail.com> * Slide. Signed-off-by: Hal Gentz <zegentzy@protonmail.com> * Travis, damn you. Signed-off-by: Hal Gentz <zegentzy@protonmail.com> * Update CHANGELOG.md
This commit is contained in:
parent
c0c22c8ff1
commit
cf0b8babbd
5 changed files with 89 additions and 72 deletions
|
|
@ -63,7 +63,7 @@ pub struct EventLoop<T: 'static> {
|
|||
event_processor: Rc<RefCell<EventProcessor<T>>>,
|
||||
user_sender: ::calloop::channel::Sender<T>,
|
||||
pending_events: Rc<RefCell<VecDeque<Event<T>>>>,
|
||||
target: Rc<RootELW<T>>,
|
||||
pub(crate) target: Rc<RootELW<T>>,
|
||||
}
|
||||
|
||||
pub struct EventLoopProxy<T: 'static> {
|
||||
|
|
@ -232,12 +232,6 @@ impl<T: 'static> EventLoop<T> {
|
|||
result
|
||||
}
|
||||
|
||||
/// Returns the `XConnection` of this events loop.
|
||||
#[inline]
|
||||
pub fn x_connection(&self) -> &Arc<XConnection> {
|
||||
&get_xtarget(&self.target).xconn
|
||||
}
|
||||
|
||||
pub fn create_proxy(&self) -> EventLoopProxy<T> {
|
||||
EventLoopProxy {
|
||||
user_sender: self.user_sender.clone(),
|
||||
|
|
@ -413,11 +407,18 @@ fn drain_events<T: 'static>(
|
|||
}
|
||||
}
|
||||
|
||||
fn get_xtarget<T>(rt: &RootELW<T>) -> &EventLoopWindowTarget<T> {
|
||||
if let super::EventLoopWindowTarget::X(ref target) = rt.p {
|
||||
target
|
||||
} else {
|
||||
unreachable!();
|
||||
pub(crate) fn get_xtarget<T>(target: &RootELW<T>) -> &EventLoopWindowTarget<T> {
|
||||
match target.p {
|
||||
super::EventLoopWindowTarget::X(ref target) => target,
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> EventLoopWindowTarget<T> {
|
||||
/// Returns the `XConnection` of this events loop.
|
||||
#[inline]
|
||||
pub fn x_connection(&self) -> &Arc<XConnection> {
|
||||
&self.xconn
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue