diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a536e6068..a71e530c5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,5 @@ # Unreleased -- On Windows, fix bug causing message boxes to appear delayed. - On Android, calling `WindowEvent::Focused` now works properly instead of always returning false. - On Windows, fix alt-tab behaviour by removing borderless fullscreen "always on top" flag. - On Windows, fix bug preventing windows with transparency enabled from having fully-opaque regions. @@ -14,6 +13,8 @@ - On Wayland, the keypad arrow keys are now recognized. - **Breaking** Rename `desktop::EventLoopExtDesktop` to `run_return::EventLoopExtRunReturn`. - On Wayland, default font size in CSD increased from 11 to 17. +- On Windows, fix bug causing message boxes to appear delayed. +- On Android, support multi-touch. # 0.23.0 (2020-10-02) diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs index 0b4812e3c6..3531e4b0a7 100644 --- a/src/platform_impl/android/mod.rs +++ b/src/platform_impl/android/mod.rs @@ -181,37 +181,45 @@ impl EventLoop { match &event { InputEvent::MotionEvent(motion_event) => { let phase = match motion_event.action() { - MotionAction::Down => Some(event::TouchPhase::Started), - MotionAction::Up => Some(event::TouchPhase::Ended), + MotionAction::Down | MotionAction::PointerDown => { + Some(event::TouchPhase::Started) + } + MotionAction::Up | MotionAction::PointerUp => { + Some(event::TouchPhase::Ended) + } MotionAction::Move => Some(event::TouchPhase::Moved), MotionAction::Cancel => { Some(event::TouchPhase::Cancelled) } _ => None, // TODO mouse events }; - let pointer = motion_event.pointer_at_index(0); - let location = PhysicalPosition { - x: pointer.x() as _, - y: pointer.y() as _, - }; if let Some(phase) = phase { - let event = event::Event::WindowEvent { - window_id, - event: event::WindowEvent::Touch(event::Touch { - device_id, - phase, - location, - id: 0, - force: None, - }), - }; - call_event_handler!( - event_handler, - self.window_target(), - control_flow, - event - ); + for pointer in motion_event.pointers() { + let location = PhysicalPosition { + x: pointer.x() as _, + y: pointer.y() as _, + }; + + let event = event::Event::WindowEvent { + window_id, + event: event::WindowEvent::Touch( + event::Touch { + device_id, + phase, + location, + id: pointer.pointer_id() as u64, + force: None, + }, + ), + }; + call_event_handler!( + event_handler, + self.window_target(), + control_flow, + event + ); + } } } InputEvent::KeyEvent(_) => {} // TODO