From 717f26b9424be8d6ec5ee48a92e761363e06c69e Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Mon, 21 Oct 2024 14:28:41 -0600 Subject: [PATCH] Fix handling wayland events --- src/app.rs | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/app.rs b/src/app.rs index 1b12e30..747a1cf 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1348,7 +1348,6 @@ impl Application for App { }); let window_id_opt = core.main_window_id(); - println!("WINDOW ID {:?}", window_id_opt); let mut app = App { core, @@ -3927,9 +3926,23 @@ impl Application for App { let mut subscriptions = vec![ event::listen_with(|event, status, window_id| { - //TODO: why are we getting events for this window Id? + //TODO: why are we getting keyboard events for this window Id? if window_id == window::Id::NONE { - return None; + return match event { + #[cfg(feature = "wayland")] + Event::PlatformSpecific(event::PlatformSpecific::Wayland( + wayland_event, + )) => { + println!("{:?}", wayland_event); + match wayland_event { + WaylandEvent::Output(output_event, output) => { + Some(Message::OutputEvent(output_event, output)) + } + _ => None, + } + } + _ => None, + }; } match event { Event::Keyboard(KeyEvent::KeyPressed { key, modifiers, .. }) => match status { @@ -3940,15 +3953,6 @@ impl Application for App { Some(Message::Modifiers(modifiers)) } Event::Window(WindowEvent::CloseRequested) => Some(Message::WindowClose), - #[cfg(feature = "wayland")] - Event::PlatformSpecific(event::PlatformSpecific::Wayland(wayland_event)) => { - match wayland_event { - WaylandEvent::Output(output_event, output) => { - Some(Message::OutputEvent(output_event, output)) - } - _ => None, - } - } _ => None, } }),