Change ModifiersState to a bitflags struct (#1306)
* Change ModifiersState to a bitflags struct * Make examples work * Add modifier state methods * all things considered, only erroring out in one file throughout all of these changes is kinda impressive * Make expansion plans more clear * Move changelog entry * Try to fix macos build * Revert modifiers println in cursor_grab * Make serde serialization less bug-prone
This commit is contained in:
parent
027c52171d
commit
20e81695ca
15 changed files with 190 additions and 93 deletions
|
|
@ -17,12 +17,12 @@ impl ModifiersState {
|
|||
}
|
||||
|
||||
pub(crate) fn from_x11_mask(mask: c_uint) -> Self {
|
||||
ModifiersState {
|
||||
alt: mask & ffi::Mod1Mask != 0,
|
||||
shift: mask & ffi::ShiftMask != 0,
|
||||
ctrl: mask & ffi::ControlMask != 0,
|
||||
logo: mask & ffi::Mod4Mask != 0,
|
||||
}
|
||||
let mut m = ModifiersState::empty();
|
||||
m.set(ModifiersState::SHIFT, mask & ffi::Mod1Mask != 0);
|
||||
m.set(ModifiersState::CTRL, mask & ffi::ShiftMask != 0);
|
||||
m.set(ModifiersState::ALT, mask & ffi::ControlMask != 0);
|
||||
m.set(ModifiersState::LOGO, mask & ffi::Mod4Mask != 0);
|
||||
m
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue