mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 13:31:29 +11:00
Android: support multi-touch (#1776)
This commit is contained in:
parent
0861a353d6
commit
5700359a61
|
@ -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.
|
||||
|
@ -17,6 +16,8 @@
|
|||
- **Breaking:** On macOS, removed `WindowExt::request_user_attention`, use `Window::request_user_attention`.
|
||||
- **Breaking:** On X11, removed `WindowExt::set_urgent`, use `Window::request_user_attention`.
|
||||
- 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)
|
||||
|
||||
|
|
|
@ -181,30 +181,37 @@ impl<T: 'static> EventLoop<T> {
|
|||
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);
|
||||
|
||||
if let Some(phase) = phase {
|
||||
for pointer in motion_event.pointers() {
|
||||
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 {
|
||||
event: event::WindowEvent::Touch(
|
||||
event::Touch {
|
||||
device_id,
|
||||
phase,
|
||||
location,
|
||||
id: 0,
|
||||
id: pointer.pointer_id() as u64,
|
||||
force: None,
|
||||
}),
|
||||
},
|
||||
),
|
||||
};
|
||||
call_event_handler!(
|
||||
event_handler,
|
||||
|
@ -214,6 +221,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
InputEvent::KeyEvent(_) => {} // TODO
|
||||
};
|
||||
input_queue.finish_event(event, true);
|
||||
|
|
Loading…
Reference in a new issue