mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-26 03:36:32 +11:00
Android: support multi-touch (#1776)
This commit is contained in:
parent
0861a353d6
commit
5700359a61
2 changed files with 33 additions and 24 deletions
|
@ -1,6 +1,5 @@
|
||||||
# Unreleased
|
# 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 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 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.
|
- 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 macOS, removed `WindowExt::request_user_attention`, use `Window::request_user_attention`.
|
||||||
- **Breaking:** On X11, removed `WindowExt::set_urgent`, 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 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)
|
# 0.23.0 (2020-10-02)
|
||||||
|
|
||||||
|
|
|
@ -181,30 +181,37 @@ impl<T: 'static> EventLoop<T> {
|
||||||
match &event {
|
match &event {
|
||||||
InputEvent::MotionEvent(motion_event) => {
|
InputEvent::MotionEvent(motion_event) => {
|
||||||
let phase = match motion_event.action() {
|
let phase = match motion_event.action() {
|
||||||
MotionAction::Down => Some(event::TouchPhase::Started),
|
MotionAction::Down | MotionAction::PointerDown => {
|
||||||
MotionAction::Up => Some(event::TouchPhase::Ended),
|
Some(event::TouchPhase::Started)
|
||||||
|
}
|
||||||
|
MotionAction::Up | MotionAction::PointerUp => {
|
||||||
|
Some(event::TouchPhase::Ended)
|
||||||
|
}
|
||||||
MotionAction::Move => Some(event::TouchPhase::Moved),
|
MotionAction::Move => Some(event::TouchPhase::Moved),
|
||||||
MotionAction::Cancel => {
|
MotionAction::Cancel => {
|
||||||
Some(event::TouchPhase::Cancelled)
|
Some(event::TouchPhase::Cancelled)
|
||||||
}
|
}
|
||||||
_ => None, // TODO mouse events
|
_ => 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 {
|
let location = PhysicalPosition {
|
||||||
x: pointer.x() as _,
|
x: pointer.x() as _,
|
||||||
y: pointer.y() as _,
|
y: pointer.y() as _,
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(phase) = phase {
|
|
||||||
let event = event::Event::WindowEvent {
|
let event = event::Event::WindowEvent {
|
||||||
window_id,
|
window_id,
|
||||||
event: event::WindowEvent::Touch(event::Touch {
|
event: event::WindowEvent::Touch(
|
||||||
|
event::Touch {
|
||||||
device_id,
|
device_id,
|
||||||
phase,
|
phase,
|
||||||
location,
|
location,
|
||||||
id: 0,
|
id: pointer.pointer_id() as u64,
|
||||||
force: None,
|
force: None,
|
||||||
}),
|
},
|
||||||
|
),
|
||||||
};
|
};
|
||||||
call_event_handler!(
|
call_event_handler!(
|
||||||
event_handler,
|
event_handler,
|
||||||
|
@ -214,6 +221,7 @@ impl<T: 'static> EventLoop<T> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
InputEvent::KeyEvent(_) => {} // TODO
|
InputEvent::KeyEvent(_) => {} // TODO
|
||||||
};
|
};
|
||||||
input_queue.finish_event(event, true);
|
input_queue.finish_event(event, true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue