From d1a7749df56656e356840112ebcbb3c9f34de248 Mon Sep 17 00:00:00 2001 From: alula <6276139+alula@users.noreply.github.com> Date: Tue, 12 Jan 2021 08:25:56 +0100 Subject: [PATCH] Android: Do not mark unhandled events as handled. (#1820) --- CHANGELOG.md | 1 + src/platform_impl/android/mod.rs | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea0df5a7..143be66d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - On Windows, change the default window size (1024x768) to match the default on other desktop platforms (800x600). - On Windows, fix bug causing mouse capture to not be released. - On Windows, fix fullscreen not preserving minimized/maximized state. +- On Android, unimplemented events are marked as unhandled on the native event loop. # 0.24.0 (2020-12-09) diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs index b8df4515..31447ddd 100644 --- a/src/platform_impl/android/mod.rs +++ b/src/platform_impl/android/mod.rs @@ -176,6 +176,7 @@ impl EventLoop { if let Some(input_queue) = ndk_glue::input_queue().as_ref() { while let Some(event) = input_queue.get_event() { if let Some(event) = input_queue.pre_dispatch(event) { + let mut handled = true; let window_id = window::WindowId(WindowId); let device_id = event::DeviceId(DeviceId); match &event { @@ -191,7 +192,10 @@ impl EventLoop { MotionAction::Cancel => { Some(event::TouchPhase::Cancelled) } - _ => None, // TODO mouse events + _ => { + handled = false; + None // TODO mouse events + } }; if let Some(phase) = phase { let pointers: Box< @@ -235,9 +239,12 @@ impl EventLoop { } } } - InputEvent::KeyEvent(_) => {} // TODO + InputEvent::KeyEvent(_) => { + // TODO + handled = false; + } }; - input_queue.finish_event(event, true); + input_queue.finish_event(event, handled); } } }