mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 15:13:13 -04:00
Implement ModifiersChanged on Windows, and fix bugs discovered in implementation process (#1344)
* Move DeviceEvent handling to the message target window. Previously, device events seem to have only been sent to one particular window, and when that window was closed Winit would stop receiving device events. This also allows users to create windowless event loops that process device events - an intriguing idea, to say the least. * Emit LWin and RWin VirtualKeyCodes on Windows * Implement ModifiersChanged on Windows * Make ModifiersChanged a tuple variant instead of a struct variant * Add changelog entries * Format * Update changelog entry * Fix AltGr handling * Reformat * Publicly expose ModifiersChanged and deprecate misc. modifiers fields
This commit is contained in:
@@ -105,7 +105,7 @@ pub fn init_keyboard(
|
||||
my_sink
|
||||
.send(Event::DeviceEvent {
|
||||
device_id: device_id(),
|
||||
event: DeviceEvent::ModifiersChanged { modifiers },
|
||||
event: DeviceEvent::ModifiersChanged(modifiers),
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||
let device_id = mkdid(util::VIRTUAL_CORE_KEYBOARD);
|
||||
callback(Event::DeviceEvent {
|
||||
device_id,
|
||||
event: DeviceEvent::ModifiersChanged { modifiers },
|
||||
event: DeviceEvent::ModifiersChanged(modifiers),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1114,9 +1114,7 @@ impl<T: 'static> EventProcessor<T> {
|
||||
if modifiers != new_modifiers {
|
||||
callback(Event::DeviceEvent {
|
||||
device_id,
|
||||
event: DeviceEvent::ModifiersChanged {
|
||||
modifiers: new_modifiers,
|
||||
},
|
||||
event: DeviceEvent::ModifiersChanged(new_modifiers),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user