style(backend): formatting

This commit is contained in:
ByteAtATime 2025-06-25 08:38:24 -07:00
parent 56813684e1
commit 6365d18cdb
No known key found for this signature in database
14 changed files with 36 additions and 35 deletions

View file

@ -48,21 +48,21 @@ impl InputManager for RdevInputManager {
thread::spawn(move || {
let cb = move |event: rdev::Event| match event.event_type {
rdev::EventType::KeyPress(key) => {
if key == Key::ShiftLeft || key == Key::ShiftRight {
*shift_clone_press.lock().unwrap() = true;
}
let is_shifted = *shift_clone_press.lock().unwrap();
if let Some(ch) = key_to_char(&key, is_shifted) {
callback_clone(InputEvent::KeyPress(ch));
}
rdev::EventType::KeyPress(key) => {
if key == Key::ShiftLeft || key == Key::ShiftRight {
*shift_clone_press.lock().unwrap() = true;
}
rdev::EventType::KeyRelease(key) => {
if key == Key::ShiftLeft || key == Key::ShiftRight {
*shift_clone_release.lock().unwrap() = false;
}
let is_shifted = *shift_clone_press.lock().unwrap();
if let Some(ch) = key_to_char(&key, is_shifted) {
callback_clone(InputEvent::KeyPress(ch));
}
_ => (),
}
rdev::EventType::KeyRelease(key) => {
if key == Key::ShiftLeft || key == Key::ShiftRight {
*shift_clone_release.lock().unwrap() = false;
}
}
_ => (),
};
if let Err(error) = rdev::listen(cb) {
eprintln!("rdev error: {:?}", error)
@ -492,4 +492,4 @@ pub fn key_to_char(key: &Key, is_shifted: bool) -> Option<char> {
_ => return None,
};
s.chars().nth(if is_shifted { 1 } else { 0 })
}
}