Implement WindowEvent ModifiersChanged for X11 and Wayland (#1132)

* Implement WindowEvent ModifiersChanged for X11 and Wayland

* Fix modifier key state desync on X11

* Run cargo fmt
This commit is contained in:
Murarth 2019-09-08 11:43:28 -07:00 committed by Hal Gentz
parent bfcd85ab15
commit 206c3c246c
6 changed files with 258 additions and 19 deletions

View file

@ -83,7 +83,17 @@ pub fn init_keyboard(
KbEvent::RepeatInfo { .. } => { /* Handled by smithay client toolkit */ }
KbEvent::Modifiers {
modifiers: event_modifiers,
} => *modifiers_tracker.lock().unwrap() = event_modifiers.into(),
} => {
let modifiers = event_modifiers.into();
*modifiers_tracker.lock().unwrap() = modifiers;
if let Some(wid) = *target.lock().unwrap() {
my_sink
.send((WindowEvent::ModifiersChanged { modifiers }, wid))
.unwrap();
}
}
}
},
move |repeat_event: KeyRepeatEvent, _| {