input: decouple tablet contracts from wayland seat
This commit is contained in:
parent
e996d9528a
commit
59e4e6dfb7
6 changed files with 201 additions and 155 deletions
|
|
@ -10,16 +10,7 @@ use {
|
|||
fixed::Fixed,
|
||||
format::Format,
|
||||
gfx_api::{FdSync, GfxApi, GfxFramebuffer},
|
||||
ifs::{
|
||||
wl_output::OutputId,
|
||||
wl_seat::{
|
||||
tablet::{
|
||||
PadButtonState, TabletInit, TabletPadId, TabletPadInit, TabletRingEventSource,
|
||||
TabletStripEventSource, TabletToolChanges, TabletToolId, TabletToolInit,
|
||||
ToolButtonState,
|
||||
},
|
||||
},
|
||||
},
|
||||
ifs::wl_output::OutputId,
|
||||
libinput::consts::DeviceCapability,
|
||||
utils::static_text::StaticText,
|
||||
video::drm::{
|
||||
|
|
@ -43,8 +34,12 @@ use {
|
|||
pub mod transaction;
|
||||
|
||||
pub use jay_input_types::{
|
||||
AXIS_120, AxisSource, ButtonState, InputDeviceAccelProfile, InputDeviceClickMethod, KeyState,
|
||||
Leds, ScrollAxis,
|
||||
AXIS_120, AxisSource, ButtonState, InputDeviceAccelProfile, InputDeviceClickMethod,
|
||||
InputDeviceGroupId, InputDeviceGroupIds, KeyState, Leds, PadButtonState, ScrollAxis, TabletId,
|
||||
TabletIds, TabletInit, TabletPadGroupInit, TabletPadId, TabletPadIds, TabletPadInit,
|
||||
TabletRingEventSource, TabletStripEventSource, TabletTool2dChange, TabletToolCapability,
|
||||
TabletToolChanges, TabletToolId, TabletToolIds, TabletToolInit, TabletToolPositionChange,
|
||||
TabletToolType, TabletToolWheelChange, ToolButtonState,
|
||||
};
|
||||
|
||||
linear_ids!(ConnectorIds, ConnectorId);
|
||||
|
|
@ -209,8 +204,6 @@ pub trait HardwareCursor: Debug {
|
|||
|
||||
pub type TransformMatrix = [[f64; 2]; 2];
|
||||
|
||||
linear_ids!(InputDeviceGroupIds, InputDeviceGroupId, usize);
|
||||
|
||||
pub trait InputDevice {
|
||||
fn id(&self) -> InputDeviceId;
|
||||
fn removed(&self) -> bool;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ use {
|
|||
backend::{
|
||||
Backend, ButtonState, InputDevice, InputDeviceAccelProfile, InputDeviceCapability,
|
||||
InputDeviceClickMethod, InputDeviceGroupId, InputDeviceId, InputEvent, KeyState, Leds,
|
||||
TransformMatrix, transaction::BackendConnectorTransactionError,
|
||||
TabletId, TabletInit, TabletPadGroupInit, TabletPadId, TabletPadInit, TransformMatrix,
|
||||
transaction::BackendConnectorTransactionError,
|
||||
},
|
||||
backends::metal::{
|
||||
allocator::{RenderBufferError, ScanoutBufferError, ScanoutBufferErrors},
|
||||
|
|
@ -23,12 +24,7 @@ use {
|
|||
dbus::{DbusError, SignalHandler},
|
||||
drm_feedback::DrmFeedback,
|
||||
gfx_api::{GfxError, SyncFile},
|
||||
ifs::{
|
||||
wl_output::OutputId,
|
||||
wl_seat::tablet::{
|
||||
TabletId, TabletInit, TabletPadGroupInit, TabletPadId, TabletPadInit,
|
||||
},
|
||||
},
|
||||
ifs::wl_output::OutputId,
|
||||
libinput::{
|
||||
LibInput, LibInputAdapter, LibInputError,
|
||||
consts::{
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
use {
|
||||
crate::{
|
||||
backend::{AxisSource, ButtonState, InputEvent, KeyState, ScrollAxis},
|
||||
backends::metal::MetalBackend,
|
||||
fixed::Fixed,
|
||||
ifs::wl_seat::tablet::{
|
||||
PadButtonState, TabletRingEventSource, TabletStripEventSource, TabletTool2dChange,
|
||||
backend::{
|
||||
AxisSource, ButtonState, InputEvent, KeyState, PadButtonState, ScrollAxis,
|
||||
TabletRingEventSource, TabletStripEventSource, TabletTool2dChange,
|
||||
TabletToolCapability, TabletToolChanges, TabletToolId, TabletToolInit,
|
||||
TabletToolPositionChange, TabletToolType, TabletToolWheelChange, ToolButtonState,
|
||||
},
|
||||
backends::metal::MetalBackend,
|
||||
fixed::Fixed,
|
||||
libinput::{
|
||||
consts::{
|
||||
LIBINPUT_BUTTON_STATE_PRESSED, LIBINPUT_BUTTON_STATE_RELEASED,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
backend::{InputDeviceGroupId, InputDeviceId},
|
||||
backend::InputDeviceId,
|
||||
cursor_user::CursorUser,
|
||||
ifs::{
|
||||
wl_seat::{
|
||||
|
|
@ -30,6 +30,15 @@ use {
|
|||
},
|
||||
};
|
||||
|
||||
#[allow(unused_imports)]
|
||||
pub use jay_input_types::{
|
||||
InputDeviceGroupId, PadButtonState, TabletId, TabletIds, TabletInit, TabletPadGroupInit,
|
||||
TabletPadId, TabletPadIds, TabletPadInit, TabletRingEventSource, TabletStripEventSource,
|
||||
TabletTool2dChange, TabletToolCapability, TabletToolChanges, TabletToolId, TabletToolIds,
|
||||
TabletToolInit, TabletToolPositionChange, TabletToolType, TabletToolWheelChange,
|
||||
ToolButtonState,
|
||||
};
|
||||
|
||||
mod pad;
|
||||
mod pad_owner;
|
||||
mod tablet_bindings;
|
||||
|
|
@ -53,63 +62,6 @@ pub struct TabletSeatData {
|
|||
pads: CopyHashMap<TabletPadId, Rc<TabletPad>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TabletInit {
|
||||
pub id: TabletId,
|
||||
pub group: InputDeviceGroupId,
|
||||
pub name: String,
|
||||
pub pid: u32,
|
||||
pub vid: u32,
|
||||
pub bustype: Option<u32>,
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TabletToolInit {
|
||||
pub tablet_id: TabletId,
|
||||
pub id: TabletToolId,
|
||||
pub type_: TabletToolType,
|
||||
pub hardware_serial: u64,
|
||||
pub hardware_id_wacom: u64,
|
||||
pub capabilities: Vec<TabletToolCapability>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TabletPadInit {
|
||||
pub id: TabletPadId,
|
||||
pub group: InputDeviceGroupId,
|
||||
pub path: String,
|
||||
pub buttons: u32,
|
||||
pub strips: u32,
|
||||
pub rings: u32,
|
||||
pub dials: u32,
|
||||
pub groups: Vec<TabletPadGroupInit>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct TabletPadGroupInit {
|
||||
pub buttons: Vec<u32>,
|
||||
pub rings: Vec<u32>,
|
||||
pub strips: Vec<u32>,
|
||||
pub dials: Vec<u32>,
|
||||
pub modes: u32,
|
||||
pub mode: u32,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub enum PadButtonState {
|
||||
Released,
|
||||
Pressed,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub enum ToolButtonState {
|
||||
Released,
|
||||
Pressed,
|
||||
}
|
||||
|
||||
linear_ids!(TabletIds, TabletId);
|
||||
|
||||
pub struct Tablet {
|
||||
_id: TabletId,
|
||||
dev: InputDeviceId,
|
||||
|
|
@ -126,31 +78,6 @@ pub struct Tablet {
|
|||
seat: Rc<WlSeatGlobal>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub enum TabletToolType {
|
||||
Pen,
|
||||
Eraser,
|
||||
Brush,
|
||||
Pencil,
|
||||
Airbrush,
|
||||
#[expect(dead_code)]
|
||||
Finger,
|
||||
Mouse,
|
||||
Lens,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub enum TabletToolCapability {
|
||||
Tilt,
|
||||
Pressure,
|
||||
Distance,
|
||||
Rotation,
|
||||
Slider,
|
||||
Wheel,
|
||||
}
|
||||
|
||||
linear_ids!(TabletToolIds, TabletToolId, usize);
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct TabletToolOpt {
|
||||
tool: CloneCell<Option<Rc<TabletTool>>>,
|
||||
|
|
@ -178,8 +105,6 @@ pub struct TabletTool {
|
|||
slider: Cell<f64>,
|
||||
}
|
||||
|
||||
linear_ids!(TabletPadIds, TabletPadId);
|
||||
|
||||
pub struct TabletPad {
|
||||
pub id: TabletPadId,
|
||||
dev: InputDeviceId,
|
||||
|
|
@ -219,46 +144,6 @@ pub struct TabletPadDial {
|
|||
bindings: TabletBindings<ZwpTabletPadDialV2>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum TabletRingEventSource {
|
||||
Finger,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum TabletStripEventSource {
|
||||
Finger,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct TabletToolChanges {
|
||||
pub down: Option<bool>,
|
||||
pub pos: Option<TabletTool2dChange<TabletToolPositionChange>>,
|
||||
pub pressure: Option<f64>,
|
||||
pub distance: Option<f64>,
|
||||
pub tilt: Option<TabletTool2dChange<f64>>,
|
||||
pub rotation: Option<f64>,
|
||||
pub slider: Option<f64>,
|
||||
pub wheel: Option<TabletToolWheelChange>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct TabletTool2dChange<T> {
|
||||
pub x: T,
|
||||
pub y: T,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct TabletToolPositionChange {
|
||||
pub x: f64,
|
||||
pub dx: f64,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct TabletToolWheelChange {
|
||||
pub degrees: f64,
|
||||
pub clicks: i32,
|
||||
}
|
||||
|
||||
impl WlSeatGlobal {
|
||||
fn tablet_add_seat(&self, seat: &Rc<ZwpTabletSeatV2>) {
|
||||
self.tablet.seats.add(&seat.client, seat);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use {
|
|||
Backend, BackendConnectorState, BackendConnectorStateSerials, BackendDrmDevice,
|
||||
BackendEvent, Connector, ConnectorId, ConnectorIds, DrmDeviceId, DrmDeviceIds,
|
||||
HardwareCursorUpdate, InputDevice, InputDeviceGroupIds, InputDeviceId, InputDeviceIds,
|
||||
MonitorInfo,
|
||||
MonitorInfo, TabletIds, TabletInit, TabletPadIds, TabletPadInit, TabletToolIds,
|
||||
transaction::{BackendConnectorTransactionError, ConnectorTransaction},
|
||||
},
|
||||
backends::dummy::DummyBackend,
|
||||
|
|
@ -76,7 +76,6 @@ use {
|
|||
wl_seat::{
|
||||
PhysicalKeyboardId, PhysicalKeyboardIds, PositionHintRequest, SeatIds,
|
||||
WlSeatGlobal,
|
||||
tablet::{TabletIds, TabletInit, TabletPadIds, TabletPadInit, TabletToolIds},
|
||||
},
|
||||
wl_surface::{
|
||||
NoneSurfaceExt,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue