Remove DeviceEvent::Motion and WindowEvent::AxisMotion

We decided to remove them because they contained too little information
for the user to be useful. The assumption is that they were originally
implemented to enable gamepad support, which we already decided we are
not going to add directly to Winit.
This commit is contained in:
daxpedda 2024-08-05 12:15:53 +02:00 committed by GitHub
parent b7a7f59298
commit 546962c904
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 9 additions and 79 deletions

View file

@ -66,12 +66,6 @@ impl Dispatch<ZwpRelativePointerV1, GlobalData, WinitState> for RelativePointerS
},
_ => return,
};
state
.events_sink
.push_device_event(DeviceEvent::Motion { axis: 0, value: dx_unaccel }, super::DeviceId);
state
.events_sink
.push_device_event(DeviceEvent::Motion { axis: 1, value: dy_unaccel }, super::DeviceId);
state.events_sink.push_device_event(
DeviceEvent::MouseMotion { delta: (dx_unaccel, dy_unaccel) },
super::DeviceId,

View file

@ -1147,7 +1147,7 @@ impl EventProcessor {
let x = unsafe { *value };
let event = if let Some(&mut (_, ref mut info)) =
if let Some(&mut (_, ref mut info)) =
physical_device.scroll_axes.iter_mut().find(|&&mut (axis, _)| axis == i as _)
{
let delta = (x - info.position) / info.increment;
@ -1160,12 +1160,9 @@ impl EventProcessor {
ScrollOrientation::Vertical => MouseScrollDelta::LineDelta(0.0, -delta as f32),
};
WindowEvent::MouseWheel { device_id, delta, phase: TouchPhase::Moved }
} else {
WindowEvent::AxisMotion { device_id, axis: i as u32, value: unsafe { *value } }
};
events.push(Event::WindowEvent { window_id, event });
let event = WindowEvent::MouseWheel { device_id, delta, phase: TouchPhase::Moved };
events.push(Event::WindowEvent { window_id, event });
}
value = unsafe { value.offset(1) };
}
@ -1446,12 +1443,6 @@ impl EventProcessor {
_ => {},
}
let event = Event::DeviceEvent {
device_id: did,
event: DeviceEvent::Motion { axis: i as u32, value: x },
};
callback(&self.target, event);
value = unsafe { value.offset(1) };
}