Make DeviceId contain device id's on Android

This commit is contained in:
Fredrik Fornwall
2023-10-03 23:23:18 +02:00
committed by Kirill Chibisov
parent 3af256260e
commit 4385c17cbb
2 changed files with 5 additions and 4 deletions

View File

@@ -27,6 +27,7 @@ And please only add new entries to the top of this list, right below the `# Unre
- On X11, fix event loop not waking up on `ControlFlow::Poll` and `ControlFlow::WaitUntil`.
- **Breaking:** Change default `ControlFlow` from `Poll` to `Wait`.
- **Breaking:** remove `DeviceEvent::Text`.
- On Android, fix `DeviceId` to contain device id's.
# 0.29.1-beta

View File

@@ -387,7 +387,7 @@ impl<T: 'static> EventLoop<T> {
match event {
InputEvent::MotionEvent(motion_event) => {
let window_id = window::WindowId(WindowId);
let device_id = event::DeviceId(DeviceId);
let device_id = event::DeviceId(DeviceId(motion_event.device_id()));
let phase = match motion_event.action() {
MotionAction::Down | MotionAction::PointerDown => {
@@ -459,7 +459,7 @@ impl<T: 'static> EventLoop<T> {
let event = event::Event::WindowEvent {
window_id: window::WindowId(WindowId),
event: event::WindowEvent::KeyboardInput {
device_id: event::DeviceId(DeviceId),
device_id: event::DeviceId(DeviceId(key.device_id())),
event: event::KeyEvent {
state,
physical_key: keycodes::to_physical_keycode(keycode),
@@ -739,11 +739,11 @@ impl From<u64> for WindowId {
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceId;
pub struct DeviceId(i32);
impl DeviceId {
pub const fn dummy() -> Self {
DeviceId
DeviceId(0)
}
}