diff --git a/src/platform_impl/linux/wayland/event_loop/mod.rs b/src/platform_impl/linux/wayland/event_loop/mod.rs index 0ce019f6..61563475 100644 --- a/src/platform_impl/linux/wayland/event_loop/mod.rs +++ b/src/platform_impl/linux/wayland/event_loop/mod.rs @@ -15,7 +15,7 @@ use crate::application::ApplicationHandler; use crate::cursor::OnlyCursorImage; use crate::dpi::LogicalSize; use crate::error::{EventLoopError, OsError, RequestError}; -use crate::event::{Event, StartCause, SurfaceSizeWriter, WindowEvent}; +use crate::event::{DeviceEvent, StartCause, SurfaceSizeWriter, WindowEvent}; use crate::event_loop::{ ActiveEventLoop as RootActiveEventLoop, ControlFlow, DeviceEvents, OwnedDisplayHandle as CoreOwnedDisplayHandle, @@ -38,6 +38,12 @@ pub use crate::event_loop::EventLoopProxy as CoreEventLoopProxy; type WaylandDispatcher = calloop::Dispatcher<'static, WaylandSource, WinitState>; +#[derive(Debug)] +pub(crate) enum Event { + WindowEvent { window_id: WindowId, event: WindowEvent }, + DeviceEvent { event: DeviceEvent }, +} + /// The Wayland event loop. pub struct EventLoop { /// Has `run` or `run_on_demand` been called or a call to `pump_events` that starts the loop @@ -383,10 +389,9 @@ impl EventLoop { Event::WindowEvent { window_id, event } => { app.window_event(&self.active_event_loop, window_id, event) }, - Event::DeviceEvent { device_id, event } => { - app.device_event(&self.active_event_loop, device_id, event) + Event::DeviceEvent { event } => { + app.device_event(&self.active_event_loop, None, event) }, - _ => unreachable!("event which is neither device nor window event."), } } @@ -399,10 +404,9 @@ impl EventLoop { Event::WindowEvent { window_id, event } => { app.window_event(&self.active_event_loop, window_id, event) }, - Event::DeviceEvent { device_id, event } => { - app.device_event(&self.active_event_loop, device_id, event) + Event::DeviceEvent { event } => { + app.device_event(&self.active_event_loop, None, event) }, - _ => unreachable!("event which is neither device nor window event."), } } diff --git a/src/platform_impl/linux/wayland/event_loop/sink.rs b/src/platform_impl/linux/wayland/event_loop/sink.rs index a7ad7a22..c1c08b5c 100644 --- a/src/platform_impl/linux/wayland/event_loop/sink.rs +++ b/src/platform_impl/linux/wayland/event_loop/sink.rs @@ -2,7 +2,8 @@ use std::vec::Drain; -use crate::event::{DeviceEvent, Event, WindowEvent}; +use super::Event; +use crate::event::{DeviceEvent, WindowEvent}; use crate::window::WindowId; /// An event loop's sink to deliver events from the Wayland event callbacks @@ -26,7 +27,7 @@ impl EventSink { /// Add new device event to a queue. #[inline] pub fn push_device_event(&mut self, event: DeviceEvent) { - self.window_events.push(Event::DeviceEvent { event, device_id: None }); + self.window_events.push(Event::DeviceEvent { event }); } /// Add new window event to a queue.