diff --git a/src/backend.rs b/src/backend.rs index 20a82669..678b7346 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -268,7 +268,7 @@ pub trait InputDevice { } } -#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq)] +#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Linearize)] pub enum InputDeviceCapability { Keyboard, Pointer, @@ -308,7 +308,7 @@ impl InputDeviceCapability { } } -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, PartialEq, Linearize)] pub enum InputDeviceAccelProfile { Flat, Adaptive, @@ -323,7 +323,7 @@ impl StaticText for InputDeviceAccelProfile { } } -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Copy, Clone, PartialEq, Linearize)] pub enum InputDeviceClickMethod { None, ButtonAreas, diff --git a/src/ifs/jay_input.rs b/src/ifs/jay_input.rs index ec64cfdf..9fdbac8a 100644 --- a/src/ifs/jay_input.rs +++ b/src/ifs/jay_input.rs @@ -1,6 +1,8 @@ use { crate::{ - backend::{self, InputDeviceAccelProfile, InputDeviceClickMethod, InputDeviceId}, + backend::{ + InputDeviceAccelProfile, InputDeviceCapability, InputDeviceClickMethod, InputDeviceId, + }, client::{Client, ClientError}, clientmem::{ClientMem, ClientMemError}, ifs::wl_seat::WlSeatGlobal, @@ -16,6 +18,8 @@ use { utils::errorfmt::ErrorFmt, wire::{JayInputId, jay_input::*}, }, + arrayvec::ArrayVec, + linearize::{Linearize, LinearizeExt}, std::rc::Rc, thiserror::Error, uapi::OwnedFd, @@ -84,11 +88,8 @@ impl JayInput { } fn send_input_device(&self, data: &InputDeviceData) { - use backend::InputDeviceCapability::*; - let mut caps = vec![]; - for cap in [ - Keyboard, Pointer, Touch, TabletTool, TabletPad, Gesture, Switch, - ] { + let mut caps = ArrayVec::<_, { InputDeviceCapability::LENGTH }>::new(); + for cap in InputDeviceCapability::variants() { if data.data.device.has_capability(cap) { caps.push(cap.to_libinput().raw()); } diff --git a/src/theme.rs b/src/theme.rs index ad54c0de..303ed28a 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -499,7 +499,7 @@ macro_rules! sizes { )* } - #[derive(Copy, Clone, Debug)] + #[derive(Copy, Clone, Debug, Linearize)] #[expect(non_camel_case_types)] pub enum ThemeSized { $(