Format Rust code using rustfmt
This commit is contained in:
parent
a89a1be619
commit
e1caa580f3
3 changed files with 273 additions and 271 deletions
|
@ -265,10 +265,15 @@ impl EventReader {
|
||||||
let switcher: Key = self.settings.layout_switcher;
|
let switcher: Key = self.settings.layout_switcher;
|
||||||
let mut stream = self.stream.lock().await;
|
let mut stream = self.stream.lock().await;
|
||||||
let mut pen_events: Vec<InputEvent> = Vec::new();
|
let mut pen_events: Vec<InputEvent> = Vec::new();
|
||||||
let is_tablet: bool =
|
let is_tablet: bool = stream
|
||||||
stream.device().properties().contains(evdev::PropType::POINTER)
|
.device()
|
||||||
&& stream.device().supported_keys()
|
.properties()
|
||||||
.unwrap_or(&evdev::AttributeSet::new()).contains(evdev::Key::BTN_TOOL_PEN);
|
.contains(evdev::PropType::POINTER)
|
||||||
|
&& stream
|
||||||
|
.device()
|
||||||
|
.supported_keys()
|
||||||
|
.unwrap_or(&evdev::AttributeSet::new())
|
||||||
|
.contains(evdev::Key::BTN_TOOL_PEN);
|
||||||
let mut max_abs_wheel = 0;
|
let mut max_abs_wheel = 0;
|
||||||
if let Ok(abs_state) = stream.device().get_abs_state() {
|
if let Ok(abs_state) = stream.device().get_abs_state() {
|
||||||
for state in abs_state {
|
for state in abs_state {
|
||||||
|
@ -293,7 +298,10 @@ impl EventReader {
|
||||||
| Key::BTN_TOOL_AIRBRUSH
|
| Key::BTN_TOOL_AIRBRUSH
|
||||||
| Key::BTN_TOOL_MOUSE
|
| Key::BTN_TOOL_MOUSE
|
||||||
| Key::BTN_TOOL_LENS
|
| Key::BTN_TOOL_LENS
|
||||||
if is_tablet => pen_events.push(event),
|
if is_tablet =>
|
||||||
|
{
|
||||||
|
pen_events.push(event)
|
||||||
|
}
|
||||||
key if key == switcher && event.value() == 1 => {
|
key if key == switcher && event.value() == 1 => {
|
||||||
self.change_active_layout().await
|
self.change_active_layout().await
|
||||||
}
|
}
|
||||||
|
@ -348,9 +356,7 @@ impl EventReader {
|
||||||
abs_wheel_position = 0
|
abs_wheel_position = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(EventType::ABSOLUTE, _, _, true) => {
|
(EventType::ABSOLUTE, _, _, true) => pen_events.push(event),
|
||||||
pen_events.push(event)
|
|
||||||
}
|
|
||||||
(_, _, AbsoluteAxisType::ABS_HAT0X, _) => {
|
(_, _, AbsoluteAxisType::ABS_HAT0X, _) => {
|
||||||
match event.value() {
|
match event.value() {
|
||||||
-1 => {
|
-1 => {
|
||||||
|
@ -433,270 +439,266 @@ impl EventReader {
|
||||||
EventType::ABSOLUTE,
|
EventType::ABSOLUTE,
|
||||||
_,
|
_,
|
||||||
AbsoluteAxisType::ABS_X | AbsoluteAxisType::ABS_Y,
|
AbsoluteAxisType::ABS_X | AbsoluteAxisType::ABS_Y,
|
||||||
false
|
false,
|
||||||
) => {
|
) => match self.settings.lstick.function.as_str() {
|
||||||
match self.settings.lstick.function.as_str() {
|
"cursor" | "scroll" => {
|
||||||
"cursor" | "scroll" => {
|
let axis_value = self
|
||||||
let axis_value = self
|
.get_axis_value(&event, &self.settings.lstick.deadzone)
|
||||||
.get_axis_value(&event, &self.settings.lstick.deadzone)
|
.await;
|
||||||
.await;
|
let mut lstick_position = self.lstick_position.lock().await;
|
||||||
let mut lstick_position = self.lstick_position.lock().await;
|
lstick_position[event.code() as usize] = axis_value;
|
||||||
lstick_position[event.code() as usize] = axis_value;
|
|
||||||
}
|
|
||||||
"bind" => {
|
|
||||||
let axis_value = self
|
|
||||||
.get_axis_value(&event, &self.settings.lstick.deadzone)
|
|
||||||
.await;
|
|
||||||
let clamped_value = if axis_value < 0 {
|
|
||||||
-1
|
|
||||||
} else if axis_value > 0 {
|
|
||||||
1
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
};
|
|
||||||
match AbsoluteAxisType(event.code()) {
|
|
||||||
AbsoluteAxisType::ABS_Y => match clamped_value {
|
|
||||||
-1 if lstick_values.1 != -1 => {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::LSTICK_UP),
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
lstick_values.1 = -1
|
|
||||||
}
|
|
||||||
1 if lstick_values.1 != 1 => {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::LSTICK_DOWN),
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
lstick_values.1 = 1
|
|
||||||
}
|
|
||||||
0 => {
|
|
||||||
if lstick_values.1 != 0 {
|
|
||||||
match lstick_values.1 {
|
|
||||||
-1 => {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::LSTICK_UP),
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
1 => {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::LSTICK_DOWN),
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
lstick_values.1 = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
},
|
|
||||||
AbsoluteAxisType::ABS_X => match clamped_value {
|
|
||||||
-1 if lstick_values.0 != -1 => {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::LSTICK_LEFT),
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
lstick_values.0 = -1
|
|
||||||
}
|
|
||||||
1 => {
|
|
||||||
if lstick_values.0 != 1 {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::LSTICK_RIGHT),
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
lstick_values.0 = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
0 => {
|
|
||||||
if lstick_values.0 != 0 {
|
|
||||||
match lstick_values.0 {
|
|
||||||
-1 => {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::LSTICK_LEFT),
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
1 => {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::LSTICK_RIGHT),
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
lstick_values.0 = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
},
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
"bind" => {
|
||||||
|
let axis_value = self
|
||||||
|
.get_axis_value(&event, &self.settings.lstick.deadzone)
|
||||||
|
.await;
|
||||||
|
let clamped_value = if axis_value < 0 {
|
||||||
|
-1
|
||||||
|
} else if axis_value > 0 {
|
||||||
|
1
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
};
|
||||||
|
match AbsoluteAxisType(event.code()) {
|
||||||
|
AbsoluteAxisType::ABS_Y => match clamped_value {
|
||||||
|
-1 if lstick_values.1 != -1 => {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::LSTICK_UP),
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
lstick_values.1 = -1
|
||||||
|
}
|
||||||
|
1 if lstick_values.1 != 1 => {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::LSTICK_DOWN),
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
lstick_values.1 = 1
|
||||||
|
}
|
||||||
|
0 => {
|
||||||
|
if lstick_values.1 != 0 {
|
||||||
|
match lstick_values.1 {
|
||||||
|
-1 => {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::LSTICK_UP),
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
1 => {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::LSTICK_DOWN),
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
lstick_values.1 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
},
|
||||||
|
AbsoluteAxisType::ABS_X => match clamped_value {
|
||||||
|
-1 if lstick_values.0 != -1 => {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::LSTICK_LEFT),
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
lstick_values.0 = -1
|
||||||
|
}
|
||||||
|
1 => {
|
||||||
|
if lstick_values.0 != 1 {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::LSTICK_RIGHT),
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
lstick_values.0 = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
0 => {
|
||||||
|
if lstick_values.0 != 0 {
|
||||||
|
match lstick_values.0 {
|
||||||
|
-1 => {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::LSTICK_LEFT),
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
1 => {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::LSTICK_RIGHT),
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
lstick_values.0 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
},
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
},
|
||||||
(
|
(
|
||||||
EventType::ABSOLUTE,
|
EventType::ABSOLUTE,
|
||||||
_,
|
_,
|
||||||
AbsoluteAxisType::ABS_RX | AbsoluteAxisType::ABS_RY,
|
AbsoluteAxisType::ABS_RX | AbsoluteAxisType::ABS_RY,
|
||||||
false
|
false,
|
||||||
) => {
|
) => match self.settings.rstick.function.as_str() {
|
||||||
match self.settings.rstick.function.as_str() {
|
"cursor" | "scroll" => {
|
||||||
"cursor" | "scroll" => {
|
let axis_value = self
|
||||||
let axis_value = self
|
.get_axis_value(&event, &self.settings.rstick.deadzone)
|
||||||
.get_axis_value(&event, &self.settings.rstick.deadzone)
|
.await;
|
||||||
.await;
|
let mut rstick_position = self.rstick_position.lock().await;
|
||||||
let mut rstick_position = self.rstick_position.lock().await;
|
rstick_position[event.code() as usize - 3] = axis_value;
|
||||||
rstick_position[event.code() as usize - 3] = axis_value;
|
}
|
||||||
}
|
"bind" => {
|
||||||
"bind" => {
|
let axis_value = self
|
||||||
let axis_value = self
|
.get_axis_value(&event, &self.settings.rstick.deadzone)
|
||||||
.get_axis_value(&event, &self.settings.rstick.deadzone)
|
.await;
|
||||||
.await;
|
let clamped_value = if axis_value < 0 {
|
||||||
let clamped_value = if axis_value < 0 {
|
-1
|
||||||
-1
|
} else if axis_value > 0 {
|
||||||
} else if axis_value > 0 {
|
1
|
||||||
1
|
} else {
|
||||||
} else {
|
0
|
||||||
0
|
};
|
||||||
};
|
match AbsoluteAxisType(event.code()) {
|
||||||
match AbsoluteAxisType(event.code()) {
|
AbsoluteAxisType::ABS_RY => match clamped_value {
|
||||||
AbsoluteAxisType::ABS_RY => match clamped_value {
|
-1 => {
|
||||||
-1 => {
|
if rstick_values.1 != -1 {
|
||||||
if rstick_values.1 != -1 {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::RSTICK_UP),
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
rstick_values.1 = -1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
1 => {
|
|
||||||
if rstick_values.1 != 1 {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::RSTICK_DOWN),
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
rstick_values.1 = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
0 => {
|
|
||||||
if rstick_values.1 != 0 {
|
|
||||||
match rstick_values.1 {
|
|
||||||
-1 => {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::RSTICK_UP),
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
1 => {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::RSTICK_DOWN),
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
rstick_values.1 = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
},
|
|
||||||
AbsoluteAxisType::ABS_RX => match clamped_value {
|
|
||||||
-1 if rstick_values.0 != -1 => {
|
|
||||||
self.convert_event(
|
self.convert_event(
|
||||||
event,
|
event,
|
||||||
Event::Axis(Axis::RSTICK_LEFT),
|
Event::Axis(Axis::RSTICK_UP),
|
||||||
1,
|
1,
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
rstick_values.0 = -1
|
rstick_values.1 = -1
|
||||||
}
|
}
|
||||||
1 => {
|
}
|
||||||
if rstick_values.0 != 1 {
|
1 => {
|
||||||
self.convert_event(
|
if rstick_values.1 != 1 {
|
||||||
event,
|
self.convert_event(
|
||||||
Event::Axis(Axis::RSTICK_RIGHT),
|
event,
|
||||||
1,
|
Event::Axis(Axis::RSTICK_DOWN),
|
||||||
false,
|
1,
|
||||||
)
|
false,
|
||||||
.await;
|
)
|
||||||
rstick_values.0 = 1
|
.await;
|
||||||
}
|
rstick_values.1 = 1
|
||||||
}
|
}
|
||||||
0 => {
|
}
|
||||||
if rstick_values.0 != 0 {
|
0 => {
|
||||||
match rstick_values.0 {
|
if rstick_values.1 != 0 {
|
||||||
-1 => {
|
match rstick_values.1 {
|
||||||
self.convert_event(
|
-1 => {
|
||||||
event,
|
self.convert_event(
|
||||||
Event::Axis(Axis::RSTICK_LEFT),
|
event,
|
||||||
0,
|
Event::Axis(Axis::RSTICK_UP),
|
||||||
false,
|
0,
|
||||||
)
|
false,
|
||||||
.await
|
)
|
||||||
}
|
.await
|
||||||
1 => {
|
|
||||||
self.convert_event(
|
|
||||||
event,
|
|
||||||
Event::Axis(Axis::RSTICK_RIGHT),
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
rstick_values.0 = 0;
|
1 => {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::RSTICK_DOWN),
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
|
rstick_values.1 = 0;
|
||||||
}
|
}
|
||||||
_ => {}
|
}
|
||||||
},
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
},
|
||||||
|
AbsoluteAxisType::ABS_RX => match clamped_value {
|
||||||
|
-1 if rstick_values.0 != -1 => {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::RSTICK_LEFT),
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
rstick_values.0 = -1
|
||||||
|
}
|
||||||
|
1 => {
|
||||||
|
if rstick_values.0 != 1 {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::RSTICK_RIGHT),
|
||||||
|
1,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
rstick_values.0 = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
0 => {
|
||||||
|
if rstick_values.0 != 0 {
|
||||||
|
match rstick_values.0 {
|
||||||
|
-1 => {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::RSTICK_LEFT),
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
1 => {
|
||||||
|
self.convert_event(
|
||||||
|
event,
|
||||||
|
Event::Axis(Axis::RSTICK_RIGHT),
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
rstick_values.0 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
},
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
_ => {}
|
||||||
|
},
|
||||||
(EventType::ABSOLUTE, _, AbsoluteAxisType::ABS_Z, false) => {
|
(EventType::ABSOLUTE, _, AbsoluteAxisType::ABS_Z, false) => {
|
||||||
match (event.value(), triggers_values.0) {
|
match (event.value(), triggers_values.0) {
|
||||||
(0, 1) => {
|
(0, 1) => {
|
||||||
|
@ -728,7 +730,11 @@ impl EventReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(EventType::MISC, _, _, true) => {
|
(EventType::MISC, _, _, true) => {
|
||||||
if !stream.device().properties().contains(evdev::PropType::POINTER) {
|
if !stream
|
||||||
|
.device()
|
||||||
|
.properties()
|
||||||
|
.contains(evdev::PropType::POINTER)
|
||||||
|
{
|
||||||
self.emit_default_event(event).await;
|
self.emit_default_event(event).await;
|
||||||
} else if evdev::MiscType(event.code()) == evdev::MiscType::MSC_SERIAL {
|
} else if evdev::MiscType(event.code()) == evdev::MiscType::MSC_SERIAL {
|
||||||
pen_events.push(event);
|
pen_events.push(event);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::config::{Associations, Event};
|
use crate::config::{Associations, Event};
|
||||||
use crate::event_reader::EventReader;
|
use crate::event_reader::EventReader;
|
||||||
use crate::Config;
|
|
||||||
use crate::virtual_devices::VirtualDevices;
|
use crate::virtual_devices::VirtualDevices;
|
||||||
|
use crate::Config;
|
||||||
use evdev::{Device, EventStream};
|
use evdev::{Device, EventStream};
|
||||||
use std::{env, path::Path, process::Command, sync::Arc};
|
use std::{env, path::Path, process::Command, sync::Arc};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
@ -165,9 +165,7 @@ pub async fn start_reader(reader: EventReader) {
|
||||||
|
|
||||||
fn set_environment() -> Environment {
|
fn set_environment() -> Environment {
|
||||||
match env::var("DBUS_SESSION_BUS_ADDRESS") {
|
match env::var("DBUS_SESSION_BUS_ADDRESS") {
|
||||||
Ok(_) => {
|
Ok(_) => copy_variables(),
|
||||||
copy_variables()
|
|
||||||
}
|
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
let uid = Command::new("sh").arg("-c").arg("id -u").output().unwrap();
|
let uid = Command::new("sh").arg("-c").arg("id -u").output().unwrap();
|
||||||
let uid_number = std::str::from_utf8(uid.stdout.as_slice()).unwrap().trim();
|
let uid_number = std::str::from_utf8(uid.stdout.as_slice()).unwrap().trim();
|
||||||
|
|
|
@ -24,19 +24,17 @@ impl VirtualDevices {
|
||||||
for (axis_type, info) in absinfo.iter().enumerate() {
|
for (axis_type, info) in absinfo.iter().enumerate() {
|
||||||
if [0, 1, 2, 5, 6, 8, 24, 25, 26, 27].contains(&axis_type) {
|
if [0, 1, 2, 5, 6, 8, 24, 25, 26, 27].contains(&axis_type) {
|
||||||
let new_absinfo = evdev::AbsInfo::new(
|
let new_absinfo = evdev::AbsInfo::new(
|
||||||
info.value,
|
info.value,
|
||||||
info.minimum,
|
info.minimum,
|
||||||
info.maximum,
|
info.maximum,
|
||||||
info.fuzz,
|
info.fuzz,
|
||||||
info.flat,
|
info.flat,
|
||||||
info.resolution
|
info.resolution,
|
||||||
);
|
);
|
||||||
tablet_abs_capabilities.push(
|
tablet_abs_capabilities.push(evdev::UinputAbsSetup::new(
|
||||||
evdev::UinputAbsSetup::new(
|
evdev::AbsoluteAxisType(axis_type.try_into().unwrap()),
|
||||||
evdev::AbsoluteAxisType(axis_type.try_into().unwrap()),
|
new_absinfo,
|
||||||
new_absinfo
|
))
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +75,7 @@ impl VirtualDevices {
|
||||||
.input_id(device.input_id());
|
.input_id(device.input_id());
|
||||||
for abs_setup in tablet_abs_capabilities {
|
for abs_setup in tablet_abs_capabilities {
|
||||||
abs_builder = abs_builder.with_absolute_axis(&abs_setup).unwrap();
|
abs_builder = abs_builder.with_absolute_axis(&abs_setup).unwrap();
|
||||||
};
|
}
|
||||||
let virtual_device_keys = keys_builder.build().unwrap();
|
let virtual_device_keys = keys_builder.build().unwrap();
|
||||||
let virtual_device_axis = axis_builder.build().unwrap();
|
let virtual_device_axis = axis_builder.build().unwrap();
|
||||||
let virtual_device_abs = abs_builder.build().unwrap();
|
let virtual_device_abs = abs_builder.build().unwrap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue