diff options
author | tcmal <me@aria.rip> | 2024-06-05 20:54:29 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-06-05 20:54:29 +0100 |
commit | c6a963cd43cadff083bfdf4454cdef2d8ddd2070 (patch) | |
tree | ed81f4af5eaaf3fd1286f5963104cea7fd8c55da /src/keys.rs | |
parent | 8b3f379c3b3216485d11787bcd63a56acd51ee58 (diff) |
some cleanup and lints
Diffstat (limited to 'src/keys.rs')
-rw-r--r-- | src/keys.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/keys.rs b/src/keys.rs index 7e3296f..7e94944 100644 --- a/src/keys.rs +++ b/src/keys.rs @@ -36,7 +36,7 @@ impl WM<'_> { /// Grab all keys specified by [`self::KEYBINDS`], ensuring we get events for them. pub(crate) fn grab_keys(&mut self) -> Result<()> { // Refresh keyboard state - self.keyboard_state = KeyboardState::new_with(&self.conn)?; + self.keyboard_state = KeyboardInfo::new_with(self.conn)?; // Ungrab all keys self.conn.send_request(&UngrabKey { @@ -77,14 +77,14 @@ impl WM<'_> { } /// Cached information about our keyboard layout. -pub struct KeyboardState { +pub struct KeyboardInfo { min_keycode: RawKeyCode, max_keycode: RawKeyCode, numlock_mask: ModMask, mapping: GetKeyboardMappingReply, } -impl KeyboardState { +impl KeyboardInfo { /// Query information about the keyboard layout from the given connection. pub fn new_with(conn: &Connection) -> Result<Self> { let min_keycode = conn.get_setup().min_keycode(); @@ -107,8 +107,7 @@ impl KeyboardState { let keypermod = mod_map.keycodes().len() / 8; for i in 0..8 { for j in 0..keypermod { - if mod_map.keycodes()[(i * keypermod + j) as usize] as u32 == numlock_keycode.raw() - { + if mod_map.keycodes()[i * keypermod + j] as u32 == numlock_keycode.raw() { this.numlock_mask = ModMask::from_bits(1 << i).expect("x11 has unrecognised modifier"); } @@ -152,7 +151,7 @@ impl KeyboardState { } } - return Ok(KeyCode::new(0)); + Ok(KeyCode::new(0)) } /// Lookup the keysym in the given column for the given keycode |