mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 15:13:13 -04:00
Remove DeviceEvent::Added and Removed
This had no real use because we don't expose any information on `DeviceId` except on Windows. But there we only expose the name. The assumption is that this was originally added for gamepad support, which never made it into Winit.
This commit is contained in:
@@ -280,7 +280,7 @@ impl EventProcessor {
|
||||
|
||||
xinput2::XI_HierarchyChanged => {
|
||||
let xev: &XIHierarchyEvent = unsafe { xev.as_event() };
|
||||
self.xinput2_hierarchy_changed(xev, &mut callback);
|
||||
self.xinput2_hierarchy_changed(xev);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
@@ -1496,10 +1496,7 @@ impl EventProcessor {
|
||||
});
|
||||
}
|
||||
|
||||
fn xinput2_hierarchy_changed<F>(&mut self, xev: &XIHierarchyEvent, mut callback: F)
|
||||
where
|
||||
F: FnMut(&RootAEL, Event),
|
||||
{
|
||||
fn xinput2_hierarchy_changed(&mut self, xev: &XIHierarchyEvent) {
|
||||
let wt = Self::window_target(&self.target);
|
||||
|
||||
// Set the timestamp.
|
||||
@@ -1508,15 +1505,7 @@ impl EventProcessor {
|
||||
for info in infos {
|
||||
if 0 != info.flags & (xinput2::XISlaveAdded | xinput2::XIMasterAdded) {
|
||||
self.init_device(info.deviceid as xinput::DeviceId);
|
||||
callback(&self.target, Event::DeviceEvent {
|
||||
device_id: mkdid(info.deviceid as xinput::DeviceId),
|
||||
event: DeviceEvent::Added,
|
||||
});
|
||||
} else if 0 != info.flags & (xinput2::XISlaveRemoved | xinput2::XIMasterRemoved) {
|
||||
callback(&self.target, Event::DeviceEvent {
|
||||
device_id: mkdid(info.deviceid as xinput::DeviceId),
|
||||
event: DeviceEvent::Removed,
|
||||
});
|
||||
let mut devices = self.devices.borrow_mut();
|
||||
devices.remove(&DeviceId(info.deviceid as xinput::DeviceId));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user