fix(detect): fix warnings on Wayland

This commit is contained in:
Federico Terzi 2021-10-06 19:06:43 +02:00
parent cb372f9b9d
commit bab9c1dc92
3 changed files with 14 additions and 14 deletions

View File

@ -140,7 +140,7 @@ impl Device {
let is_down = value == KEY_STATE_PRESS; let is_down = value == KEY_STATE_PRESS;
// Check if the current event originated from a mouse // Check if the current event originated from a mouse
if code >= 0x110 && code <= 0x117 { if (0x110..=0x117).contains(&code) {
// Mouse event // Mouse event
return Some(RawInputEvent::Mouse(RawMouseEvent { code, is_down })); return Some(RawInputEvent::Mouse(RawMouseEvent { code, is_down }));
} }

View File

@ -108,6 +108,7 @@ impl HotKeyFilter {
// Remove duplicates and revert // Remove duplicates and revert
if !to_be_removed.is_empty() { if !to_be_removed.is_empty() {
#[allow(clippy::stable_sort_primitive)]
to_be_removed.sort(); to_be_removed.sort();
to_be_removed.dedup(); to_be_removed.dedup();
to_be_removed.reverse(); to_be_removed.reverse();

View File

@ -44,13 +44,13 @@ pub fn get_modifiers_state() -> Result<Option<super::ModifiersState>> {
.create_window::<FallbackFrame, _>(surface, None, dimensions, move |evt, mut dispatch_data| { .create_window::<FallbackFrame, _>(surface, None, dimensions, move |evt, mut dispatch_data| {
let next_action = dispatch_data.get::<Option<WEvent>>().unwrap(); let next_action = dispatch_data.get::<Option<WEvent>>().unwrap();
// Keep last event in priority order : Close > Configure > Refresh // Keep last event in priority order : Close > Configure > Refresh
let replace = match (&evt, &*next_action) { let replace = matches!(
(&evt, &*next_action),
(_, &None) (_, &None)
| (_, &Some(WEvent::Refresh)) | (_, &Some(WEvent::Refresh))
| (&WEvent::Configure { .. }, &Some(WEvent::Configure { .. })) | (&WEvent::Configure { .. }, &Some(WEvent::Configure { .. }))
| (&WEvent::Close, _) => true, | (&WEvent::Close, _)
_ => false, );
};
if replace { if replace {
*next_action = Some(evt); *next_action = Some(evt);
} }
@ -138,13 +138,11 @@ pub fn get_modifiers_state() -> Result<Option<super::ModifiersState>> {
} }
} }
} }
} else { } else if let Some((kbd, source)) = opt_kbd.take() {
if let Some((kbd, source)) = opt_kbd.take() {
// the keyboard has been removed, cleanup // the keyboard has been removed, cleanup
kbd.release(); kbd.release();
loop_handle.remove(source); loop_handle.remove(source);
} }
}
}); });
if !env.get_shell().unwrap().needs_configure() { if !env.get_shell().unwrap().needs_configure() {
@ -182,7 +180,7 @@ pub fn get_modifiers_state() -> Result<Option<super::ModifiersState>> {
let result_ref = result_clone.borrow(); let result_ref = result_clone.borrow();
if let Some(result) = &*result_ref { if let Some(result) = &*result_ref {
return Ok(Some(result.clone())); return Ok(Some(*result));
} }
} }
} }
@ -215,6 +213,7 @@ fn keyboard_event_handler(
} }
} }
#[allow(clippy::many_single_char_names)]
fn redraw( fn redraw(
pool: &mut AutoMemPool, pool: &mut AutoMemPool,
surface: &wl_surface::WlSurface, surface: &wl_surface::WlSurface,