metal: sort InputDevice functions
This commit is contained in:
parent
68ade6c50e
commit
0524e01a3c
1 changed files with 54 additions and 54 deletions
|
|
@ -559,6 +559,10 @@ impl InputDevice for MetalInputDevice {
|
|||
}
|
||||
}
|
||||
|
||||
fn left_handed(&self) -> Option<bool> {
|
||||
self.effective.left_handed.get()
|
||||
}
|
||||
|
||||
fn set_left_handed(&self, left_handed: bool) {
|
||||
self.desired.left_handed.set(Some(left_handed));
|
||||
if let Some(dev) = self.inputdev.get() {
|
||||
|
|
@ -571,6 +575,16 @@ impl InputDevice for MetalInputDevice {
|
|||
}
|
||||
}
|
||||
|
||||
fn accel_profile(&self) -> Option<InputDeviceAccelProfile> {
|
||||
let p = self.effective.accel_profile.get()?;
|
||||
let p = match p {
|
||||
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT => InputDeviceAccelProfile::Flat,
|
||||
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE => InputDeviceAccelProfile::Adaptive,
|
||||
_ => return None,
|
||||
};
|
||||
Some(p)
|
||||
}
|
||||
|
||||
fn set_accel_profile(&self, profile: InputDeviceAccelProfile) {
|
||||
let profile = match profile {
|
||||
InputDeviceAccelProfile::Flat => LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT,
|
||||
|
|
@ -579,6 +593,10 @@ impl InputDevice for MetalInputDevice {
|
|||
self.set_accel_profile_(profile);
|
||||
}
|
||||
|
||||
fn accel_speed(&self) -> Option<f64> {
|
||||
self.effective.accel_speed.get()
|
||||
}
|
||||
|
||||
fn set_accel_speed(&self, speed: f64) {
|
||||
self.desired.accel_speed.set(Some(speed));
|
||||
if let Some(dev) = self.inputdev.get() {
|
||||
|
|
@ -591,10 +609,30 @@ impl InputDevice for MetalInputDevice {
|
|||
}
|
||||
}
|
||||
|
||||
fn transform_matrix(&self) -> Option<TransformMatrix> {
|
||||
self.transform_matrix.get()
|
||||
}
|
||||
|
||||
fn set_transform_matrix(&self, matrix: TransformMatrix) {
|
||||
self.transform_matrix.set(Some(matrix));
|
||||
}
|
||||
|
||||
fn calibration_matrix(&self) -> Option<[[f32; 3]; 2]> {
|
||||
self.effective.calibration_matrix.get()
|
||||
}
|
||||
|
||||
fn set_calibration_matrix(&self, m: [[f32; 3]; 2]) {
|
||||
self.desired.calibration_matrix.set(Some(m));
|
||||
if let Some(dev) = self.inputdev.get() {
|
||||
if dev.device().has_calibration_matrix() {
|
||||
dev.device().set_calibration_matrix(m);
|
||||
self.effective
|
||||
.calibration_matrix
|
||||
.set(Some(dev.device().get_calibration_matrix()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn name(&self) -> Rc<String> {
|
||||
self.name.get()
|
||||
}
|
||||
|
|
@ -603,6 +641,10 @@ impl InputDevice for MetalInputDevice {
|
|||
Some(self.devnum)
|
||||
}
|
||||
|
||||
fn tap_enabled(&self) -> Option<bool> {
|
||||
self.effective.tap_enabled.get()
|
||||
}
|
||||
|
||||
fn set_tap_enabled(&self, enabled: bool) {
|
||||
self.desired.tap_enabled.set(Some(enabled));
|
||||
if let Some(dev) = self.inputdev.get() {
|
||||
|
|
@ -615,6 +657,10 @@ impl InputDevice for MetalInputDevice {
|
|||
}
|
||||
}
|
||||
|
||||
fn drag_enabled(&self) -> Option<bool> {
|
||||
self.effective.drag_enabled.get()
|
||||
}
|
||||
|
||||
fn set_drag_enabled(&self, enabled: bool) {
|
||||
self.desired.drag_enabled.set(Some(enabled));
|
||||
if let Some(dev) = self.inputdev.get() {
|
||||
|
|
@ -627,6 +673,10 @@ impl InputDevice for MetalInputDevice {
|
|||
}
|
||||
}
|
||||
|
||||
fn drag_lock_enabled(&self) -> Option<bool> {
|
||||
self.effective.drag_lock_enabled.get()
|
||||
}
|
||||
|
||||
fn set_drag_lock_enabled(&self, enabled: bool) {
|
||||
self.desired.drag_lock_enabled.set(Some(enabled));
|
||||
if let Some(dev) = self.inputdev.get() {
|
||||
|
|
@ -639,6 +689,10 @@ impl InputDevice for MetalInputDevice {
|
|||
}
|
||||
}
|
||||
|
||||
fn natural_scrolling_enabled(&self) -> Option<bool> {
|
||||
self.effective.natural_scrolling_enabled.get()
|
||||
}
|
||||
|
||||
fn set_natural_scrolling_enabled(&self, enabled: bool) {
|
||||
self.desired.natural_scrolling_enabled.set(Some(enabled));
|
||||
if let Some(dev) = self.inputdev.get() {
|
||||
|
|
@ -651,44 +705,6 @@ impl InputDevice for MetalInputDevice {
|
|||
}
|
||||
}
|
||||
|
||||
fn left_handed(&self) -> Option<bool> {
|
||||
self.effective.left_handed.get()
|
||||
}
|
||||
|
||||
fn accel_profile(&self) -> Option<InputDeviceAccelProfile> {
|
||||
let p = self.effective.accel_profile.get()?;
|
||||
let p = match p {
|
||||
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT => InputDeviceAccelProfile::Flat,
|
||||
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE => InputDeviceAccelProfile::Adaptive,
|
||||
_ => return None,
|
||||
};
|
||||
Some(p)
|
||||
}
|
||||
|
||||
fn accel_speed(&self) -> Option<f64> {
|
||||
self.effective.accel_speed.get()
|
||||
}
|
||||
|
||||
fn transform_matrix(&self) -> Option<TransformMatrix> {
|
||||
self.transform_matrix.get()
|
||||
}
|
||||
|
||||
fn tap_enabled(&self) -> Option<bool> {
|
||||
self.effective.tap_enabled.get()
|
||||
}
|
||||
|
||||
fn drag_enabled(&self) -> Option<bool> {
|
||||
self.effective.drag_enabled.get()
|
||||
}
|
||||
|
||||
fn drag_lock_enabled(&self) -> Option<bool> {
|
||||
self.effective.drag_lock_enabled.get()
|
||||
}
|
||||
|
||||
fn natural_scrolling_enabled(&self) -> Option<bool> {
|
||||
self.effective.natural_scrolling_enabled.get()
|
||||
}
|
||||
|
||||
fn tablet_info(&self) -> Option<Box<TabletInit>> {
|
||||
let dev = self.inputdev.get()?;
|
||||
let dev = dev.device();
|
||||
|
|
@ -757,22 +773,6 @@ impl InputDevice for MetalInputDevice {
|
|||
groups,
|
||||
}))
|
||||
}
|
||||
|
||||
fn calibration_matrix(&self) -> Option<[[f32; 3]; 2]> {
|
||||
self.effective.calibration_matrix.get()
|
||||
}
|
||||
|
||||
fn set_calibration_matrix(&self, m: [[f32; 3]; 2]) {
|
||||
self.desired.calibration_matrix.set(Some(m));
|
||||
if let Some(dev) = self.inputdev.get() {
|
||||
if dev.device().has_calibration_matrix() {
|
||||
dev.device().set_calibration_matrix(m);
|
||||
self.effective
|
||||
.calibration_matrix
|
||||
.set(Some(dev.device().get_calibration_matrix()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl MetalInputDevice {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue