ei: add support for libei
This commit is contained in:
parent
084fe50259
commit
40e87f8f91
69 changed files with 4340 additions and 72 deletions
44
src/ei/ei_ifs.rs
Normal file
44
src/ei/ei_ifs.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
macro_rules! ei_device_interface {
|
||||
($camel:ident, $snake:ident, $field:ident) => {
|
||||
impl EiDeviceInterface for $camel {
|
||||
fn new(device: &Rc<EiDevice>, version: EiVersion) -> Rc<Self> {
|
||||
let v = Rc::new(Self {
|
||||
id: device.client.new_id(),
|
||||
client: device.client.clone(),
|
||||
tracker: Default::default(),
|
||||
version,
|
||||
device: device.clone(),
|
||||
});
|
||||
track!(v.client, v);
|
||||
v
|
||||
}
|
||||
|
||||
fn destroy(&self) -> Result<(), EiClientError> {
|
||||
self.send_destroyed(self.client.serial());
|
||||
self.client.remove_obj(self)?;
|
||||
self.device.seat.$field.take();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn send_destroyed(&self, serial: u32) {
|
||||
self.client.event(crate::wire_ei::$snake::Destroyed {
|
||||
self_id: self.id,
|
||||
serial,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub mod ei_button;
|
||||
pub mod ei_callback;
|
||||
pub mod ei_connection;
|
||||
pub mod ei_device;
|
||||
pub mod ei_handshake;
|
||||
pub mod ei_keyboard;
|
||||
pub mod ei_pingpong;
|
||||
pub mod ei_pointer;
|
||||
pub mod ei_pointer_absolute;
|
||||
pub mod ei_scroll;
|
||||
pub mod ei_seat;
|
||||
pub mod ei_touchscreen;
|
||||
Loading…
Add table
Add a link
Reference in a new issue