X11: Fix incorrect modifiers when events are missed (#1279)
* X11: Fix incorrect modifiers when events are missed * Syncs modifier state with state data in X key/button/motion events. * Fixes modifier state in XWayland, as xinput2 raw input events will not be received when a window does not have focus. * Removes `impl From<_> for ModifiersState` on X11/Wayland API types, replacing them with `pub(crate)` methods. * Cleanup modifier state update using a macro * Remove keys from modifier state when updating
This commit is contained in:
parent
a70ac1531e
commit
a95ebc5ee6
4 changed files with 105 additions and 37 deletions
|
|
@ -97,7 +97,7 @@ pub fn init_keyboard(
|
|||
KbEvent::Modifiers {
|
||||
modifiers: event_modifiers,
|
||||
} => {
|
||||
let modifiers = event_modifiers.into();
|
||||
let modifiers = ModifiersState::from_wayland(event_modifiers);
|
||||
|
||||
*modifiers_tracker.lock().unwrap() = modifiers;
|
||||
|
||||
|
|
@ -399,8 +399,8 @@ fn keysym_to_vkey(keysym: u32) -> Option<VirtualKeyCode> {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<keyboard::ModifiersState> for ModifiersState {
|
||||
fn from(mods: keyboard::ModifiersState) -> ModifiersState {
|
||||
impl ModifiersState {
|
||||
pub(crate) fn from_wayland(mods: keyboard::ModifiersState) -> ModifiersState {
|
||||
ModifiersState {
|
||||
shift: mods.shift,
|
||||
ctrl: mods.ctrl,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue