Remove generic parameter T from EventLoopWindowTarget (#3298)
This commit is contained in:
parent
169cd39f93
commit
22311802b5
37 changed files with 174 additions and 210 deletions
|
|
@ -63,7 +63,7 @@ pub struct EventLoop<T: 'static> {
|
|||
connection: Connection,
|
||||
|
||||
/// Event loop window target.
|
||||
window_target: RootEventLoopWindowTarget<T>,
|
||||
window_target: RootEventLoopWindowTarget,
|
||||
|
||||
// XXX drop after everything else, just to be safe.
|
||||
/// Calloop's event loop.
|
||||
|
|
@ -167,7 +167,6 @@ impl<T: 'static> EventLoop<T> {
|
|||
control_flow: Cell::new(ControlFlow::default()),
|
||||
exit: Cell::new(None),
|
||||
state: RefCell::new(winit_state),
|
||||
_marker: PhantomData,
|
||||
};
|
||||
|
||||
let event_loop = Self {
|
||||
|
|
@ -191,7 +190,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
|
||||
pub fn run_on_demand<F>(&mut self, mut event_handler: F) -> Result<(), EventLoopError>
|
||||
where
|
||||
F: FnMut(Event<T>, &RootEventLoopWindowTarget<T>),
|
||||
F: FnMut(Event<T>, &RootEventLoopWindowTarget),
|
||||
{
|
||||
if self.loop_running {
|
||||
return Err(EventLoopError::AlreadyRunning);
|
||||
|
|
@ -222,7 +221,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
|
||||
pub fn pump_events<F>(&mut self, timeout: Option<Duration>, mut callback: F) -> PumpStatus
|
||||
where
|
||||
F: FnMut(Event<T>, &RootEventLoopWindowTarget<T>),
|
||||
F: FnMut(Event<T>, &RootEventLoopWindowTarget),
|
||||
{
|
||||
if !self.loop_running {
|
||||
self.loop_running = true;
|
||||
|
|
@ -249,7 +248,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
|
||||
pub fn poll_events_with_timeout<F>(&mut self, mut timeout: Option<Duration>, mut callback: F)
|
||||
where
|
||||
F: FnMut(Event<T>, &RootEventLoopWindowTarget<T>),
|
||||
F: FnMut(Event<T>, &RootEventLoopWindowTarget),
|
||||
{
|
||||
let cause = loop {
|
||||
let start = Instant::now();
|
||||
|
|
@ -325,7 +324,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
|
||||
fn single_iteration<F>(&mut self, callback: &mut F, cause: StartCause)
|
||||
where
|
||||
F: FnMut(Event<T>, &RootEventLoopWindowTarget<T>),
|
||||
F: FnMut(Event<T>, &RootEventLoopWindowTarget),
|
||||
{
|
||||
// NOTE currently just indented to simplify the diff
|
||||
|
||||
|
|
@ -530,7 +529,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn window_target(&self) -> &RootEventLoopWindowTarget<T> {
|
||||
pub fn window_target(&self) -> &RootEventLoopWindowTarget {
|
||||
&self.window_target
|
||||
}
|
||||
|
||||
|
|
@ -602,7 +601,7 @@ impl<T> AsRawFd for EventLoop<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct EventLoopWindowTarget<T> {
|
||||
pub struct EventLoopWindowTarget {
|
||||
/// The event loop wakeup source.
|
||||
pub event_loop_awakener: calloop::ping::Ping,
|
||||
|
||||
|
|
@ -624,11 +623,9 @@ pub struct EventLoopWindowTarget<T> {
|
|||
|
||||
/// Connection to the wayland server.
|
||||
pub connection: Connection,
|
||||
|
||||
_marker: std::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T> EventLoopWindowTarget<T> {
|
||||
impl EventLoopWindowTarget {
|
||||
pub(crate) fn set_control_flow(&self, control_flow: ControlFlow) {
|
||||
self.control_flow.set(control_flow)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use crate::platform_impl::platform::VideoModeHandle as PlatformVideoModeHandle;
|
|||
|
||||
use super::event_loop::EventLoopWindowTarget;
|
||||
|
||||
impl<T> EventLoopWindowTarget<T> {
|
||||
impl EventLoopWindowTarget {
|
||||
#[inline]
|
||||
pub fn available_monitors(&self) -> impl Iterator<Item = MonitorHandle> {
|
||||
self.state
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ pub struct Window {
|
|||
}
|
||||
|
||||
impl Window {
|
||||
pub(crate) fn new<T>(
|
||||
event_loop_window_target: &EventLoopWindowTarget<T>,
|
||||
pub(crate) fn new(
|
||||
event_loop_window_target: &EventLoopWindowTarget,
|
||||
attributes: WindowAttributes,
|
||||
platform_attributes: PlatformAttributes,
|
||||
) -> Result<Self, RootOsError> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue