autocommit 2022-03-30 22:27:19 CEST
This commit is contained in:
parent
a8136ed88c
commit
ab4ac883ee
19 changed files with 434 additions and 76 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use crate::_private::ipc::{ClientMessage, InitMessage, Response, ServerMessage};
|
||||
use crate::_private::{bincode_ops, logging, Config, ConfigEntry, ConfigEntryGen, VERSION};
|
||||
use crate::input::{AccelProfile, Capability, InputDevice};
|
||||
use crate::keyboard::keymap::Keymap;
|
||||
use crate::theme::Color;
|
||||
use crate::{Axis, Command, Direction, LogLevel, ModifiedKeySym, Seat};
|
||||
|
|
@ -11,7 +12,6 @@ use std::collections::HashMap;
|
|||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
use std::{ptr, slice};
|
||||
use crate::input::{Capability, InputDevice};
|
||||
|
||||
pub(crate) struct Client {
|
||||
configure: extern "C" fn(),
|
||||
|
|
@ -318,6 +318,25 @@ impl Client {
|
|||
self.send(&ClientMessage::SetSeat { device, seat })
|
||||
}
|
||||
|
||||
pub fn set_left_handed(&self, device: InputDevice, left_handed: bool) {
|
||||
self.send(&ClientMessage::SetLeftHanded {
|
||||
device,
|
||||
left_handed,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_accel_profile(&self, device: InputDevice, profile: AccelProfile) {
|
||||
self.send(&ClientMessage::SetAccelProfile { device, profile })
|
||||
}
|
||||
|
||||
pub fn set_accel_speed(&self, device: InputDevice, speed: f64) {
|
||||
self.send(&ClientMessage::SetAccelSpeed { device, speed })
|
||||
}
|
||||
|
||||
pub fn set_transform_matrix(&self, device: InputDevice, matrix: [[f64; 2]; 2]) {
|
||||
self.send(&ClientMessage::SetTransformMatrix { device, matrix })
|
||||
}
|
||||
|
||||
pub fn has_capability(&self, device: InputDevice, cap: Capability) -> bool {
|
||||
let res = self.with_response(|| self.send(&ClientMessage::HasCapability { device, cap }));
|
||||
match res {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use crate::input::{AccelProfile, Capability, InputDevice};
|
||||
use crate::keyboard::keymap::Keymap;
|
||||
use crate::keyboard::mods::Modifiers;
|
||||
use crate::keyboard::syms::KeySym;
|
||||
use crate::theme::Color;
|
||||
use crate::{Axis, Direction, LogLevel, Seat};
|
||||
use bincode::{BorrowDecode, Decode, Encode};
|
||||
use crate::input::{Capability, InputDevice};
|
||||
|
||||
#[derive(Encode, BorrowDecode, Debug)]
|
||||
pub enum ServerMessage {
|
||||
|
|
@ -141,6 +141,22 @@ pub enum ClientMessage<'a> {
|
|||
device: InputDevice,
|
||||
cap: Capability,
|
||||
},
|
||||
SetLeftHanded {
|
||||
device: InputDevice,
|
||||
left_handed: bool,
|
||||
},
|
||||
SetAccelProfile {
|
||||
device: InputDevice,
|
||||
profile: AccelProfile,
|
||||
},
|
||||
SetAccelSpeed {
|
||||
device: InputDevice,
|
||||
speed: f64,
|
||||
},
|
||||
SetTransformMatrix {
|
||||
device: InputDevice,
|
||||
matrix: [[f64; 2]; 2],
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Encode, Decode, Debug)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use bincode::{Decode, Encode};
|
||||
use crate::Seat;
|
||||
use bincode::{Decode, Encode};
|
||||
|
||||
#[derive(Encode, Decode, Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||
pub struct InputDevice(pub u64);
|
||||
|
|
@ -12,6 +12,22 @@ impl InputDevice {
|
|||
pub fn has_capability(self, cap: Capability) -> bool {
|
||||
get!(false).has_capability(self, cap)
|
||||
}
|
||||
|
||||
pub fn set_left_handed(self, left_handed: bool) {
|
||||
get!().set_left_handed(self, left_handed);
|
||||
}
|
||||
|
||||
pub fn set_accel_profile(self, profile: AccelProfile) {
|
||||
get!().set_accel_profile(self, profile);
|
||||
}
|
||||
|
||||
pub fn set_accel_speed(self, speed: f64) {
|
||||
get!().set_accel_speed(self, speed);
|
||||
}
|
||||
|
||||
pub fn set_transform_matrix(self, matrix: [[f64; 2]; 2]) {
|
||||
get!().set_transform_matrix(self, matrix);
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Encode, Decode, Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||
|
|
@ -24,3 +40,9 @@ pub const CAP_TABLET_TOOL: Capability = Capability(3);
|
|||
pub const CAP_TABLET_PAD: Capability = Capability(4);
|
||||
pub const CAP_GESTURE: Capability = Capability(5);
|
||||
pub const CAP_SWITCH: Capability = Capability(6);
|
||||
|
||||
#[derive(Encode, Decode, Copy, Clone, Debug, Hash, Eq, PartialEq)]
|
||||
pub struct AccelProfile(pub u32);
|
||||
|
||||
pub const ACCEL_PROFILE_FLAT: AccelProfile = AccelProfile(1 << 0);
|
||||
pub const ACCEL_PROFILE_ADAPTIVE: AccelProfile = AccelProfile(1 << 1);
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
use crate::input::InputDevice;
|
||||
use crate::keyboard::keymap::Keymap;
|
||||
use crate::keyboard::ModifiedKeySym;
|
||||
use bincode::{Decode, Encode};
|
||||
use std::collections::HashMap;
|
||||
use crate::input::InputDevice;
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
#[doc(hidden)]
|
||||
pub mod _private;
|
||||
pub mod embedded;
|
||||
pub mod input;
|
||||
pub mod keyboard;
|
||||
pub mod theme;
|
||||
pub mod input;
|
||||
|
||||
#[derive(Encode, Decode, Copy, Clone, Debug)]
|
||||
pub enum LogLevel {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue