1
0
Fork 0
forked from wry/wry

autocommit 2022-05-01 17:23:55 CEST

This commit is contained in:
Julian Orth 2022-05-01 17:23:55 +02:00
parent 4373ed05bf
commit e1d5bf0e5d
39 changed files with 1772 additions and 57 deletions

View file

@ -4,7 +4,7 @@ use {
backend::{Backend, Connector, ConnectorEvent, ConnectorId, ConnectorKernelId},
video::drm::ConnectorType,
},
std::{error::Error, rc::Rc},
std::{any::Any, error::Error, rc::Rc},
};
pub struct DummyBackend;
@ -13,6 +13,10 @@ impl Backend for DummyBackend {
fn run(self: Rc<Self>) -> SpawnedFuture<Result<(), Box<dyn Error>>> {
unreachable!();
}
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
self
}
}
pub struct DummyOutput {

View file

@ -7,7 +7,7 @@ use {
async_engine::{AsyncError, AsyncFd, SpawnedFuture},
backend::{
Backend, BackendEvent, InputDevice, InputDeviceAccelProfile, InputDeviceCapability,
InputDeviceId, InputEvent, KeyState,
InputDeviceId, InputEvent, KeyState, TransformMatrix,
},
backends::metal::video::{MetalDrmDevice, PendingDrmDevice},
dbus::{DbusError, SignalHandler},
@ -40,6 +40,7 @@ use {
},
},
std::{
any::Any,
cell::{Cell, RefCell},
error::Error,
ffi::{CStr, CString},
@ -148,6 +149,10 @@ impl Backend for MetalBackend {
})
}
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
self
}
fn switch_to(&self, vtnr: u32) {
self.session.switch_to(vtnr, move |res| {
if let Err(e) = res {
@ -188,7 +193,7 @@ impl Backend for MetalBackend {
true
}
fn is_freestanding(&self) -> bool {
fn import_environment(&self) -> bool {
true
}
@ -288,7 +293,7 @@ struct MetalInputDevice {
left_handed: Cell<Option<bool>>,
accel_profile: Cell<Option<AccelProfile>>,
accel_speed: Cell<Option<f64>>,
transform_matrix: Cell<Option<[[f64; 2]; 2]>>,
transform_matrix: Cell<Option<TransformMatrix>>,
}
impl Drop for MetalInputDevice {
@ -419,7 +424,7 @@ impl InputDevice for MetalInputDevice {
}
}
fn set_transform_matrix(&self, matrix: [[f64; 2]; 2]) {
fn set_transform_matrix(&self, matrix: TransformMatrix) {
self.transform_matrix.set(Some(matrix));
}

View file

@ -4,7 +4,7 @@ use {
backend::{
AxisSource, Backend, BackendEvent, Connector, ConnectorEvent, ConnectorId,
ConnectorKernelId, InputDevice, InputDeviceAccelProfile, InputDeviceCapability,
InputDeviceId, InputEvent, KeyState, Mode, MonitorInfo, ScrollAxis,
InputDeviceId, InputEvent, KeyState, Mode, MonitorInfo, ScrollAxis, TransformMatrix,
},
fixed::Fixed,
format::XRGB8888,
@ -48,6 +48,7 @@ use {
},
},
std::{
any::Any,
borrow::Cow,
cell::{Cell, RefCell},
collections::VecDeque,
@ -242,6 +243,10 @@ impl Backend for XBackend {
Ok(())
})
}
fn into_any(self: Rc<Self>) -> Rc<dyn Any> {
self
}
}
pub struct XBackend {
@ -1054,7 +1059,7 @@ impl InputDevice for XSeatKeyboard {
let _ = speed;
}
fn set_transform_matrix(&self, matrix: [[f64; 2]; 2]) {
fn set_transform_matrix(&self, matrix: TransformMatrix) {
let _ = matrix;
}
@ -1103,7 +1108,7 @@ impl InputDevice for XSeatMouse {
let _ = speed;
}
fn set_transform_matrix(&self, matrix: [[f64; 2]; 2]) {
fn set_transform_matrix(&self, matrix: TransformMatrix) {
let _ = matrix;
}