Move available_monitors and primary_monitor to EventLoopWindowTarget (#1616)

This commit is contained in:
Xavier L'Heureux 2020-07-04 15:46:41 -04:00 committed by GitHub
parent dd866a74a6
commit 3d5d05eac7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 121 additions and 110 deletions

View file

@ -155,11 +155,20 @@ impl<T> EventLoop<T> {
event_loop_proxy: self.event_loop.create_proxy(),
}
}
}
impl<T> Deref for EventLoop<T> {
type Target = EventLoopWindowTarget<T>;
fn deref(&self) -> &EventLoopWindowTarget<T> {
self.event_loop.window_target()
}
}
impl<T> EventLoopWindowTarget<T> {
/// Returns the list of all the monitors available on the system.
#[inline]
pub fn available_monitors(&self) -> impl Iterator<Item = MonitorHandle> {
self.event_loop
self.p
.available_monitors()
.into_iter()
.map(|inner| MonitorHandle { inner })
@ -169,18 +178,11 @@ impl<T> EventLoop<T> {
#[inline]
pub fn primary_monitor(&self) -> MonitorHandle {
MonitorHandle {
inner: self.event_loop.primary_monitor(),
inner: self.p.primary_monitor(),
}
}
}
impl<T> Deref for EventLoop<T> {
type Target = EventLoopWindowTarget<T>;
fn deref(&self) -> &EventLoopWindowTarget<T> {
self.event_loop.window_target()
}
}
/// Used to send custom events to `EventLoop`.
pub struct EventLoopProxy<T: 'static> {
event_loop_proxy: platform_impl::EventLoopProxy<T>,