jay-compositor 1.15.0

The Jay compositor
use crate::backend::ConnectorId as BackendConnectorId;
use crate::client::Client;
use crate::ifs::wp_drm_lease_device_v1::WpDrmLeaseDeviceV1;
use crate::leaks::Tracker;
use crate::object::BreakLoops;
use crate::object::Version;
use crate::utils::bindings::Bindings;
use crate::wire::WpDrmLeaseConnectorV1Id;
use crate::wire::wp_drm_lease_connector_v1::*;
use jay_proc::Object;
use std::convert::Infallible;
use std::rc::Rc;

#[derive(Object)]
#[break_loops]
pub struct WpDrmLeaseConnectorV1 {
    pub id: WpDrmLeaseConnectorV1Id,
    pub client: Rc<Client>,
    pub tracker: Tracker<Self>,
    pub version: Version,
    pub device: Rc<WpDrmLeaseDeviceV1>,
    pub connector_id: BackendConnectorId,
    pub bindings: Rc<Bindings<Self>>,
}

impl WpDrmLeaseConnectorV1 {
    fn detach(&self) {
        self.bindings.remove(&self.client, self);
    }

    pub fn send_name(&self, name: &str) {
        self.client.event(Name {
            self_id: self.id,
            name,
        });
    }

    #[expect(unused)]
    pub fn send_description(&self, description: &str) {
        self.client.event(Description {
            self_id: self.id,
            description,
        });
    }

    pub fn send_connector_id(&self, connector_id: u32) {
        self.client.event(ConnectorId {
            self_id: self.id,
            connector_id,
        });
    }

    pub fn send_done(&self) {
        self.client.event(Done { self_id: self.id });
    }

    pub fn send_withdrawn(&self) {
        self.client.event(Withdrawn { self_id: self.id });
    }
}

impl WpDrmLeaseConnectorV1RequestHandler for WpDrmLeaseConnectorV1 {
    type Error = Infallible;

    fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
        self.detach();
        self.client.remove_obj(self);
        Ok(())
    }
}

impl BreakLoops for WpDrmLeaseConnectorV1 {
    fn break_loops(self: Rc<Self>) {
        self.detach();
    }
}