autocommit 2022-02-11 02:28:11 CET
This commit is contained in:
parent
83c3fb99f9
commit
9b8e1ac29f
63 changed files with 690 additions and 122 deletions
|
|
@ -47,7 +47,7 @@ pub trait Vtable: Sized {
|
|||
dd: &Rc<Self::Device>,
|
||||
data: OfferData<Self>,
|
||||
id: ObjectId,
|
||||
) -> Self::Offer;
|
||||
) -> Rc<Self::Offer>;
|
||||
fn send_selection(dd: &Self::Device, offer: Self::OfferId);
|
||||
fn send_cancelled(source: &Self::Source);
|
||||
fn get_offer_id(offer: &Self::Offer) -> Self::OfferId;
|
||||
|
|
@ -215,7 +215,7 @@ pub fn offer_source_to<T: Vtable>(src: &Rc<T::Source>, client: &Rc<Client>) {
|
|||
client: client.clone(),
|
||||
shared: shared.clone(),
|
||||
};
|
||||
let offer = Rc::new(T::create_offer(client, dd, offer_data, id));
|
||||
let offer = T::create_offer(client, dd, offer_data, id);
|
||||
data.offers.insert(id.into(), offer.clone());
|
||||
let mt = data.mime_types.borrow_mut();
|
||||
T::send_offer(dd, &offer);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ use crate::ifs::ipc::{
|
|||
break_device_loops, destroy_device, DeviceData, OfferData, Role, SourceData, Vtable,
|
||||
};
|
||||
use crate::ifs::wl_seat::{WlSeat, WlSeatError, WlSeatGlobal};
|
||||
use crate::ifs::wl_surface::{SurfaceRole, WlSurfaceError};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::{Object, ObjectId};
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -15,7 +17,6 @@ use crate::wire::{WlDataDeviceId, WlDataOfferId, WlSurfaceId};
|
|||
use std::rc::Rc;
|
||||
use thiserror::Error;
|
||||
use uapi::OwnedFd;
|
||||
use crate::ifs::wl_surface::{SurfaceRole, WlSurfaceError};
|
||||
|
||||
#[allow(dead_code)]
|
||||
const ROLE: u32 = 0;
|
||||
|
|
@ -25,6 +26,7 @@ pub struct WlDataDevice {
|
|||
pub manager: Rc<WlDataDeviceManager>,
|
||||
pub seat: Rc<WlSeat>,
|
||||
pub data: DeviceData<WlDataDevice>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlDataDevice {
|
||||
|
|
@ -34,6 +36,7 @@ impl WlDataDevice {
|
|||
manager: manager.clone(),
|
||||
seat: seat.clone(),
|
||||
data: Default::default(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -153,13 +156,16 @@ impl Vtable for WlDataDevice {
|
|||
device: &Rc<WlDataDevice>,
|
||||
offer_data: OfferData<Self>,
|
||||
id: ObjectId,
|
||||
) -> Self::Offer {
|
||||
WlDataOffer {
|
||||
) -> Rc<Self::Offer> {
|
||||
let rc = Rc::new(WlDataOffer {
|
||||
id: id.into(),
|
||||
client: client.clone(),
|
||||
device: device.clone(),
|
||||
data: offer_data,
|
||||
}
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, rc);
|
||||
rc
|
||||
}
|
||||
|
||||
fn send_selection(dd: &Self::Device, offer: Self::OfferId) {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use crate::client::{Client, ClientError};
|
|||
use crate::globals::{Global, GlobalName};
|
||||
use crate::ifs::ipc::wl_data_device::WlDataDevice;
|
||||
use crate::ifs::ipc::wl_data_source::WlDataSource;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -27,6 +28,7 @@ pub struct WlDataDeviceManager {
|
|||
pub id: WlDataDeviceManagerId,
|
||||
pub client: Rc<Client>,
|
||||
pub version: u32,
|
||||
tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlDataDeviceManagerGlobal {
|
||||
|
|
@ -44,7 +46,9 @@ impl WlDataDeviceManagerGlobal {
|
|||
id,
|
||||
client: client.clone(),
|
||||
version,
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -54,6 +58,7 @@ impl WlDataDeviceManager {
|
|||
fn create_data_source(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateDataSourceError> {
|
||||
let req: CreateDataSource = self.client.parse(self, parser)?;
|
||||
let res = Rc::new(WlDataSource::new(req.id, &self.client));
|
||||
track!(self.client, res);
|
||||
self.client.add_client_obj(&res)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -65,6 +70,7 @@ impl WlDataDeviceManager {
|
|||
let req: GetDataDevice = self.client.parse(&**self, parser)?;
|
||||
let seat = self.client.lookup(req.seat)?;
|
||||
let dev = Rc::new(WlDataDevice::new(req.id, self, &seat));
|
||||
track!(self.client, dev);
|
||||
seat.add_data_device(&dev);
|
||||
self.client.add_client_obj(&dev)?;
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use crate::ifs::ipc::{
|
|||
break_offer_loops, destroy_offer, receive, OfferData, Role, OFFER_STATE_ACCEPTED,
|
||||
OFFER_STATE_DROPPED, OFFER_STATE_FINISHED, SOURCE_STATE_FINISHED,
|
||||
};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::bitflags::BitflagsExt;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
|
|
@ -28,6 +29,7 @@ pub struct WlDataOffer {
|
|||
pub client: Rc<Client>,
|
||||
pub device: Rc<WlDataDevice>,
|
||||
pub data: OfferData<WlDataDevice>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlDataOffer {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use crate::ifs::ipc::{
|
|||
add_mime_type, break_source_loops, cancel_offers, destroy_source, SharedState, SourceData,
|
||||
OFFER_STATE_ACCEPTED, OFFER_STATE_DROPPED,
|
||||
};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::bitflags::BitflagsExt;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
|
|
@ -24,12 +25,14 @@ const INVALID_SOURCE: u32 = 1;
|
|||
pub struct WlDataSource {
|
||||
pub id: WlDataSourceId,
|
||||
pub data: SourceData<WlDataDevice>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlDataSource {
|
||||
pub fn new(id: WlDataSourceId, client: &Rc<Client>) -> Self {
|
||||
Self {
|
||||
id,
|
||||
tracker: Default::default(),
|
||||
data: SourceData::new(client),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use crate::client::{Client, ClientError};
|
|||
use crate::globals::{Global, GlobalName};
|
||||
use crate::ifs::ipc::zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1;
|
||||
use crate::ifs::ipc::zwp_primary_selection_source_v1::ZwpPrimarySelectionSourceV1;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -18,6 +19,7 @@ pub struct ZwpPrimarySelectionDeviceManagerV1 {
|
|||
pub id: ZwpPrimarySelectionDeviceManagerV1Id,
|
||||
pub client: Rc<Client>,
|
||||
pub version: u32,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl ZwpPrimarySelectionDeviceManagerV1Global {
|
||||
|
|
@ -35,7 +37,9 @@ impl ZwpPrimarySelectionDeviceManagerV1Global {
|
|||
id,
|
||||
client: client.clone(),
|
||||
version,
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -45,6 +49,7 @@ impl ZwpPrimarySelectionDeviceManagerV1 {
|
|||
fn create_source(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateSourceError> {
|
||||
let req: CreateSource = self.client.parse(self, parser)?;
|
||||
let res = Rc::new(ZwpPrimarySelectionSourceV1::new(req.id, &self.client));
|
||||
track!(self.client, res);
|
||||
self.client.add_client_obj(&res)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -53,6 +58,7 @@ impl ZwpPrimarySelectionDeviceManagerV1 {
|
|||
let req: GetDevice = self.client.parse(&**self, parser)?;
|
||||
let seat = self.client.lookup(req.seat)?;
|
||||
let dev = Rc::new(ZwpPrimarySelectionDeviceV1::new(req.id, self, &seat));
|
||||
track!(self.client, dev);
|
||||
seat.add_primary_selection_device(&dev);
|
||||
self.client.add_client_obj(&dev)?;
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use crate::ifs::ipc::{
|
|||
break_device_loops, destroy_device, DeviceData, OfferData, Role, SourceData, Vtable,
|
||||
};
|
||||
use crate::ifs::wl_seat::{WlSeat, WlSeatError, WlSeatGlobal};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::{Object, ObjectId};
|
||||
use crate::utils::buffd::{MsgParser, MsgParserError};
|
||||
use crate::wire::zwp_primary_selection_device_v1::*;
|
||||
|
|
@ -19,6 +20,7 @@ pub struct ZwpPrimarySelectionDeviceV1 {
|
|||
pub manager: Rc<ZwpPrimarySelectionDeviceManagerV1>,
|
||||
seat: Rc<WlSeat>,
|
||||
data: DeviceData<Self>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl ZwpPrimarySelectionDeviceV1 {
|
||||
|
|
@ -32,6 +34,7 @@ impl ZwpPrimarySelectionDeviceV1 {
|
|||
manager: manager.clone(),
|
||||
seat: seat.clone(),
|
||||
data: DeviceData::default(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -104,12 +107,15 @@ impl Vtable for ZwpPrimarySelectionDeviceV1 {
|
|||
_device: &Rc<ZwpPrimarySelectionDeviceV1>,
|
||||
offer_data: OfferData<Self>,
|
||||
id: ObjectId,
|
||||
) -> Self::Offer {
|
||||
ZwpPrimarySelectionOfferV1 {
|
||||
) -> Rc<Self::Offer> {
|
||||
let rc = Rc::new(ZwpPrimarySelectionOfferV1 {
|
||||
id: id.into(),
|
||||
client: client.clone(),
|
||||
offer_data,
|
||||
}
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, rc);
|
||||
rc
|
||||
}
|
||||
|
||||
fn send_selection(dd: &Self::Device, offer: Self::OfferId) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::client::{Client, ClientError};
|
||||
use crate::ifs::ipc::zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1;
|
||||
use crate::ifs::ipc::{break_offer_loops, destroy_offer, receive, OfferData};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::{MsgParser, MsgParserError};
|
||||
use crate::wire::zwp_primary_selection_offer_v1::*;
|
||||
|
|
@ -12,6 +13,7 @@ pub struct ZwpPrimarySelectionOfferV1 {
|
|||
pub id: ZwpPrimarySelectionOfferV1Id,
|
||||
pub client: Rc<Client>,
|
||||
pub offer_data: OfferData<ZwpPrimarySelectionDeviceV1>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl ZwpPrimarySelectionOfferV1 {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::client::{Client, ClientError};
|
||||
use crate::ifs::ipc::zwp_primary_selection_device_v1::ZwpPrimarySelectionDeviceV1;
|
||||
use crate::ifs::ipc::{add_mime_type, break_source_loops, destroy_source, SourceData};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::{MsgParser, MsgParserError};
|
||||
use crate::wire::zwp_primary_selection_source_v1::*;
|
||||
|
|
@ -12,6 +13,7 @@ use uapi::OwnedFd;
|
|||
pub struct ZwpPrimarySelectionSourceV1 {
|
||||
pub id: ZwpPrimarySelectionSourceV1Id,
|
||||
pub data: SourceData<ZwpPrimarySelectionDeviceV1>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl ZwpPrimarySelectionSourceV1 {
|
||||
|
|
@ -19,6 +21,7 @@ impl ZwpPrimarySelectionSourceV1 {
|
|||
Self {
|
||||
id,
|
||||
data: SourceData::new(client),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use crate::client::{Client, ClientError};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -18,6 +19,7 @@ pub struct OrgKdeKwinServerDecoration {
|
|||
id: OrgKdeKwinServerDecorationId,
|
||||
client: Rc<Client>,
|
||||
requested: Cell<bool>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl OrgKdeKwinServerDecoration {
|
||||
|
|
@ -26,6 +28,7 @@ impl OrgKdeKwinServerDecoration {
|
|||
id,
|
||||
client: client.clone(),
|
||||
requested: Cell::new(false),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::client::{Client, ClientError};
|
||||
use crate::globals::{Global, GlobalName};
|
||||
use crate::ifs::org_kde_kwin_server_decoration::OrgKdeKwinServerDecoration;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -33,7 +34,9 @@ impl OrgKdeKwinServerDecorationManagerGlobal {
|
|||
id,
|
||||
client: client.clone(),
|
||||
_version: version,
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
obj.send_default_mode(SERVER);
|
||||
Ok(())
|
||||
|
|
@ -62,6 +65,7 @@ pub struct OrgKdeKwinServerDecorationManager {
|
|||
id: OrgKdeKwinServerDecorationManagerId,
|
||||
client: Rc<Client>,
|
||||
_version: u32,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl OrgKdeKwinServerDecorationManager {
|
||||
|
|
@ -76,6 +80,7 @@ impl OrgKdeKwinServerDecorationManager {
|
|||
let req: Create = self.client.parse(self, parser)?;
|
||||
let _ = self.client.lookup(req.surface)?;
|
||||
let obj = Rc::new(OrgKdeKwinServerDecoration::new(req.id, &self.client));
|
||||
track!(self.client, obj);
|
||||
self.client.add_client_obj(&obj)?;
|
||||
obj.send_mode(SERVER);
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::client::{Client, ClientError};
|
||||
use crate::clientmem::{ClientMem, ClientMemOffset};
|
||||
use crate::format::Format;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::rect::Rect;
|
||||
use crate::render::{Image, Texture};
|
||||
|
|
@ -29,6 +30,7 @@ pub struct WlBuffer {
|
|||
pub texture: CloneCell<Option<Rc<Texture>>>,
|
||||
width: i32,
|
||||
height: i32,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlBuffer {
|
||||
|
|
@ -55,6 +57,7 @@ impl WlBuffer {
|
|||
height,
|
||||
texture: CloneCell::new(None),
|
||||
storage: WlBufferStorage::Dmabuf(img.clone()),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -89,6 +92,7 @@ impl WlBuffer {
|
|||
width,
|
||||
height,
|
||||
texture: CloneCell::new(None),
|
||||
tracker: Default::default(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use crate::client::Client;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::wire::wl_callback::*;
|
||||
use crate::wire::WlCallbackId;
|
||||
|
|
@ -8,6 +9,7 @@ use thiserror::Error;
|
|||
pub struct WlCallback {
|
||||
client: Rc<Client>,
|
||||
id: WlCallbackId,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlCallback {
|
||||
|
|
@ -15,6 +17,7 @@ impl WlCallback {
|
|||
Self {
|
||||
client: client.clone(),
|
||||
id,
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use crate::client::{Client, ClientError};
|
|||
use crate::globals::{Global, GlobalName};
|
||||
use crate::ifs::wl_region::WlRegion;
|
||||
use crate::ifs::wl_surface::WlSurface;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -18,6 +19,7 @@ pub struct WlCompositor {
|
|||
id: WlCompositorId,
|
||||
client: Rc<Client>,
|
||||
_version: u32,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlCompositorGlobal {
|
||||
|
|
@ -35,7 +37,9 @@ impl WlCompositorGlobal {
|
|||
id,
|
||||
client: client.clone(),
|
||||
_version: version,
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -45,6 +49,7 @@ impl WlCompositor {
|
|||
fn create_surface(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateSurfaceError> {
|
||||
let surface: CreateSurface = self.client.parse(self, parser)?;
|
||||
let surface = Rc::new(WlSurface::new(surface.id, &self.client));
|
||||
track!(self.client, surface);
|
||||
self.client.add_client_obj(&surface)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -52,6 +57,7 @@ impl WlCompositor {
|
|||
fn create_region(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateRegionError> {
|
||||
let region: CreateRegion = self.client.parse(self, parser)?;
|
||||
let region = Rc::new(WlRegion::new(region.id, &self.client));
|
||||
track!(self.client, region);
|
||||
self.client.add_client_obj(®ion)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use crate::client::{Client, ClientError};
|
|||
use crate::globals::GlobalsError;
|
||||
use crate::ifs::wl_callback::WlCallback;
|
||||
use crate::ifs::wl_registry::WlRegistry;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::{Object, ObjectId, WL_DISPLAY_ID};
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -17,8 +18,9 @@ const NO_MEMORY: u32 = 2;
|
|||
const IMPLEMENTATION: u32 = 3;
|
||||
|
||||
pub struct WlDisplay {
|
||||
id: WlDisplayId,
|
||||
client: Rc<Client>,
|
||||
pub id: WlDisplayId,
|
||||
pub client: Rc<Client>,
|
||||
pub tracker: Tracker<WlDisplay>,
|
||||
}
|
||||
|
||||
impl WlDisplay {
|
||||
|
|
@ -26,12 +28,14 @@ impl WlDisplay {
|
|||
Self {
|
||||
id: WL_DISPLAY_ID,
|
||||
client: client.clone(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
fn sync(&self, parser: MsgParser<'_, '_>) -> Result<(), SyncError> {
|
||||
let sync: Sync = self.client.parse(self, parser)?;
|
||||
let cb = Rc::new(WlCallback::new(sync.callback, &self.client));
|
||||
track!(self.client, cb);
|
||||
self.client.add_client_obj(&cb)?;
|
||||
cb.send_done();
|
||||
self.client.remove_obj(&*cb)?;
|
||||
|
|
@ -41,6 +45,7 @@ impl WlDisplay {
|
|||
fn get_registry(&self, parser: MsgParser<'_, '_>) -> Result<(), GetRegistryError> {
|
||||
let gr: GetRegistry = self.client.parse(self, parser)?;
|
||||
let registry = Rc::new(WlRegistry::new(gr.registry, &self.client));
|
||||
track!(self.client, registry);
|
||||
self.client.add_client_obj(®istry)?;
|
||||
self.client.state.globals.notify_all(®istry);
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use crate::client::{Client, ClientError};
|
||||
use crate::globals::{Global, GlobalName};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -31,7 +32,9 @@ impl WlDrmGlobal {
|
|||
id,
|
||||
client: client.clone(),
|
||||
_version: version,
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
if let Some(rc) = client.state.render_ctx.get() {
|
||||
obj.send_device(&rc.render_node());
|
||||
|
|
@ -59,6 +62,7 @@ pub struct WlDrm {
|
|||
id: WlDrmId,
|
||||
pub client: Rc<Client>,
|
||||
_version: u32,
|
||||
tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlDrm {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::backend::Output;
|
||||
use crate::client::{Client, ClientError, ClientId};
|
||||
use crate::globals::{Global, GlobalName};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -100,7 +101,9 @@ impl WlOutputGlobal {
|
|||
id,
|
||||
client: client.clone(),
|
||||
version,
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
self.bindings
|
||||
.borrow_mut()
|
||||
|
|
@ -142,6 +145,7 @@ pub struct WlOutput {
|
|||
pub id: WlOutputId,
|
||||
client: Rc<Client>,
|
||||
version: u32,
|
||||
tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
pub const SEND_DONE_SINCE: u32 = 2;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use crate::client::{Client, ClientError};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::pixman::Region;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
|
|
@ -13,6 +14,7 @@ pub struct WlRegion {
|
|||
id: WlRegionId,
|
||||
client: Rc<Client>,
|
||||
rect: RefCell<Region>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlRegion {
|
||||
|
|
@ -21,6 +23,7 @@ impl WlRegion {
|
|||
id,
|
||||
client: client.clone(),
|
||||
rect: RefCell::new(Region::new()),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use crate::client::Client;
|
||||
use crate::globals::{Global, GlobalName, GlobalsError};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::{Interface, Object};
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -11,6 +12,7 @@ use thiserror::Error;
|
|||
pub struct WlRegistry {
|
||||
id: WlRegistryId,
|
||||
client: Rc<Client>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlRegistry {
|
||||
|
|
@ -18,6 +20,7 @@ impl WlRegistry {
|
|||
Self {
|
||||
id,
|
||||
client: client.clone(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use crate::ifs::wl_seat::wl_pointer::WlPointer;
|
|||
use crate::ifs::wl_seat::wl_touch::WlTouch;
|
||||
use crate::ifs::wl_surface::xdg_surface::xdg_toplevel::XdgToplevel;
|
||||
use crate::ifs::wl_surface::WlSurface;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::{Object, ObjectId};
|
||||
use crate::tree::{FloatNode, FoundNode, Node};
|
||||
use crate::utils::asyncevent::AsyncEvent;
|
||||
|
|
@ -41,6 +42,8 @@ pub use event_handling::NodeSeatState;
|
|||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::io::Write;
|
||||
use std::mem;
|
||||
use std::ops::DerefMut;
|
||||
use std::rc::Rc;
|
||||
use thiserror::Error;
|
||||
use uapi::{c, OwnedFd};
|
||||
|
|
@ -266,6 +269,11 @@ impl WlSeatGlobal {
|
|||
self.cursor.get()
|
||||
}
|
||||
|
||||
pub fn clear(&self) {
|
||||
mem::take(self.pointer_stack.borrow_mut().deref_mut());
|
||||
mem::take(self.found_tree.borrow_mut().deref_mut());
|
||||
}
|
||||
|
||||
pub fn id(&self) -> SeatId {
|
||||
self.seat.id()
|
||||
}
|
||||
|
|
@ -283,7 +291,9 @@ impl WlSeatGlobal {
|
|||
pointers: Default::default(),
|
||||
keyboards: Default::default(),
|
||||
version,
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
obj.send_capabilities();
|
||||
if version >= SEAT_NAME_SINCE {
|
||||
|
|
@ -323,6 +333,7 @@ pub struct WlSeat {
|
|||
pointers: CopyHashMap<WlPointerId, Rc<WlPointer>>,
|
||||
keyboards: CopyHashMap<WlKeyboardId, Rc<WlKeyboard>>,
|
||||
version: u32,
|
||||
tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlSeat {
|
||||
|
|
@ -381,6 +392,7 @@ impl WlSeat {
|
|||
fn get_pointer(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), GetPointerError> {
|
||||
let req: GetPointer = self.client.parse(&**self, parser)?;
|
||||
let p = Rc::new(WlPointer::new(req.id, self));
|
||||
track!(self.client, p);
|
||||
self.client.add_client_obj(&p)?;
|
||||
self.pointers.set(req.id, p);
|
||||
Ok(())
|
||||
|
|
@ -389,6 +401,7 @@ impl WlSeat {
|
|||
fn get_keyboard(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), GetKeyboardError> {
|
||||
let req: GetKeyboard = self.client.parse(&**self, parser)?;
|
||||
let p = Rc::new(WlKeyboard::new(req.id, self));
|
||||
track!(self.client, p);
|
||||
self.client.add_client_obj(&p)?;
|
||||
self.keyboards.set(req.id, p.clone());
|
||||
p.send_keymap(wl_keyboard::XKB_V1, p.keymap_fd()?, self.global.layout_size);
|
||||
|
|
@ -401,6 +414,7 @@ impl WlSeat {
|
|||
fn get_touch(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), GetTouchError> {
|
||||
let req: GetTouch = self.client.parse(&**self, parser)?;
|
||||
let p = Rc::new(WlTouch::new(req.id, self));
|
||||
track!(self.client, p);
|
||||
self.client.add_client_obj(&p)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -409,8 +423,11 @@ impl WlSeat {
|
|||
let _req: Release = self.client.parse(self, parser)?;
|
||||
{
|
||||
let mut bindings = self.global.bindings.borrow_mut();
|
||||
if let Some(hm) = bindings.get_mut(&self.client.id) {
|
||||
hm.remove(&self.id);
|
||||
if let Entry::Occupied(mut hm) = bindings.entry(self.client.id) {
|
||||
hm.get_mut().remove(&self.id);
|
||||
if hm.get().is_empty() {
|
||||
hm.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
self.client.remove_obj(self)?;
|
||||
|
|
@ -439,8 +456,11 @@ impl Object for WlSeat {
|
|||
fn break_loops(&self) {
|
||||
{
|
||||
let mut bindings = self.global.bindings.borrow_mut();
|
||||
if let Some(hm) = bindings.get_mut(&self.client.id) {
|
||||
hm.remove(&self.id);
|
||||
if let Entry::Occupied(mut hm) = bindings.entry(self.client.id) {
|
||||
hm.get_mut().remove(&self.id);
|
||||
if hm.get().is_empty() {
|
||||
hm.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
self.pointers.clear();
|
||||
|
|
|
|||
|
|
@ -85,6 +85,8 @@ impl NodeSeatState {
|
|||
if last.id() == node_id {
|
||||
break;
|
||||
}
|
||||
last.seat_state().leave(&seat);
|
||||
last.leave(&seat);
|
||||
}
|
||||
seat.state.tree_changed();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use crate::ifs::ipc;
|
|||
use crate::ifs::ipc::wl_data_device::WlDataDevice;
|
||||
use crate::ifs::ipc::wl_data_source::WlDataSource;
|
||||
use crate::ifs::wl_seat::{Dnd, DroppedDnd, WlSeatError, WlSeatGlobal};
|
||||
use crate::ifs::wl_surface::{WlSurface};
|
||||
use crate::ifs::wl_surface::WlSurface;
|
||||
use crate::tree::{FoundNode, Node};
|
||||
use crate::utils::clonecell::CloneCell;
|
||||
use crate::utils::smallmap::SmallMap;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use crate::client::ClientError;
|
||||
use crate::ifs::wl_seat::WlSeat;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -21,6 +22,7 @@ pub(super) const PRESSED: u32 = 1;
|
|||
pub struct WlKeyboard {
|
||||
id: WlKeyboardId,
|
||||
seat: Rc<WlSeat>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlKeyboard {
|
||||
|
|
@ -28,6 +30,7 @@ impl WlKeyboard {
|
|||
Self {
|
||||
id,
|
||||
seat: seat.clone(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use crate::cursor::Cursor;
|
|||
use crate::fixed::Fixed;
|
||||
use crate::ifs::wl_seat::WlSeat;
|
||||
use crate::ifs::wl_surface::WlSurfaceError;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -34,6 +35,7 @@ pub const POINTER_FRAME_SINCE_VERSION: u32 = 5;
|
|||
pub struct WlPointer {
|
||||
id: WlPointerId,
|
||||
seat: Rc<WlSeat>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlPointer {
|
||||
|
|
@ -41,6 +43,7 @@ impl WlPointer {
|
|||
Self {
|
||||
id,
|
||||
seat: seat.clone(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use crate::client::ClientError;
|
||||
use crate::ifs::wl_seat::WlSeat;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -26,6 +27,7 @@ const ORIENTATION: u32 = 6;
|
|||
pub struct WlTouch {
|
||||
id: WlTouchId,
|
||||
seat: Rc<WlSeat>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlTouch {
|
||||
|
|
@ -33,6 +35,7 @@ impl WlTouch {
|
|||
Self {
|
||||
id,
|
||||
seat: seat.clone(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use crate::client::{Client, ClientError};
|
|||
use crate::format::FORMATS;
|
||||
use crate::globals::{Global, GlobalName};
|
||||
use crate::ifs::wl_shm_pool::{WlShmPool, WlShmPoolError};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -18,6 +19,7 @@ pub struct WlShm {
|
|||
_global: Rc<WlShmGlobal>,
|
||||
id: WlShmId,
|
||||
client: Rc<Client>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlShmGlobal {
|
||||
|
|
@ -35,7 +37,9 @@ impl WlShmGlobal {
|
|||
_global: self,
|
||||
id,
|
||||
client: client.clone(),
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
for format in FORMATS {
|
||||
client.event(Format {
|
||||
|
|
@ -59,6 +63,7 @@ impl WlShm {
|
|||
create.fd,
|
||||
create.size as usize,
|
||||
)?);
|
||||
track!(self.client, pool);
|
||||
self.client.add_client_obj(&pool)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use crate::client::{Client, ClientError};
|
|||
use crate::clientmem::ClientMem;
|
||||
use crate::format::{formats, map_wayland_format_id};
|
||||
use crate::ifs::wl_buffer::{WlBuffer, WlBufferError};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -18,6 +19,7 @@ pub struct WlShmPool {
|
|||
client: Rc<Client>,
|
||||
fd: Rc<OwnedFd>,
|
||||
mem: CloneCell<Rc<ClientMem>>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlShmPool {
|
||||
|
|
@ -32,6 +34,7 @@ impl WlShmPool {
|
|||
client: client.clone(),
|
||||
mem: CloneCell::new(Rc::new(ClientMem::new(fd.raw(), len)?)),
|
||||
fd,
|
||||
tracker: Default::default(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +58,7 @@ impl WlShmPool {
|
|||
format,
|
||||
&self.mem.get(),
|
||||
)?);
|
||||
track!(self.client, buffer);
|
||||
self.client.add_client_obj(&buffer)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::client::{Client, ClientError};
|
||||
use crate::globals::{Global, GlobalName};
|
||||
use crate::ifs::wl_surface::wl_subsurface::{WlSubsurface, WlSubsurfaceError};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -19,6 +20,7 @@ pub struct WlSubcompositorGlobal {
|
|||
pub struct WlSubcompositor {
|
||||
id: WlSubcompositorId,
|
||||
client: Rc<Client>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl WlSubcompositorGlobal {
|
||||
|
|
@ -35,7 +37,9 @@ impl WlSubcompositorGlobal {
|
|||
let obj = Rc::new(WlSubcompositor {
|
||||
id,
|
||||
client: client.clone(),
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -53,6 +57,7 @@ impl WlSubcompositor {
|
|||
let surface = self.client.lookup(req.surface)?;
|
||||
let parent = self.client.lookup(req.parent)?;
|
||||
let subsurface = Rc::new(WlSubsurface::new(req.id, &surface, &parent));
|
||||
track!(self.client, subsurface);
|
||||
self.client.add_client_obj(&subsurface)?;
|
||||
subsurface.install()?;
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use crate::ifs::wl_seat::{Dnd, NodeSeatState, WlSeatGlobal};
|
|||
use crate::ifs::wl_surface::cursor::CursorSurface;
|
||||
use crate::ifs::wl_surface::wl_subsurface::WlSubsurface;
|
||||
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceRole};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::pixman::Region;
|
||||
use crate::rect::Rect;
|
||||
|
|
@ -26,6 +27,7 @@ use crate::xkbcommon::ModifierState;
|
|||
use crate::NumCell;
|
||||
use ahash::AHashMap;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::rc::Rc;
|
||||
|
|
@ -80,6 +82,13 @@ pub struct WlSurface {
|
|||
xdg: CloneCell<Option<Rc<XdgSurface>>>,
|
||||
cursors: SmallMap<SeatId, Rc<CursorSurface>, 1>,
|
||||
pub dnd_icons: SmallMap<SeatId, Rc<WlSeatGlobal>, 1>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl Debug for WlSurface {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("WlSurface").finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||
|
|
@ -176,6 +185,7 @@ impl WlSurface {
|
|||
xdg: Default::default(),
|
||||
cursors: Default::default(),
|
||||
dnd_icons: Default::default(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -204,6 +214,7 @@ impl WlSurface {
|
|||
}
|
||||
self.set_role(SurfaceRole::Cursor)?;
|
||||
let cursor = Rc::new(CursorSurface::new(seat, self));
|
||||
track!(self.client, cursor);
|
||||
cursor.handle_buffer_change();
|
||||
self.cursors.insert(seat.id(), cursor.clone());
|
||||
Ok(cursor)
|
||||
|
|
@ -335,6 +346,9 @@ impl WlSurface {
|
|||
}
|
||||
*children = None;
|
||||
}
|
||||
self.buffer.set(None);
|
||||
self.frame_requests.borrow_mut().clear();
|
||||
self.xdg.set(None);
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -358,6 +372,7 @@ impl WlSurface {
|
|||
fn frame(&self, parser: MsgParser<'_, '_>) -> Result<(), FrameError> {
|
||||
let req: Frame = self.parse(parser)?;
|
||||
let cb = Rc::new(WlCallback::new(req.callback, &self.client));
|
||||
track!(self.client, cb);
|
||||
self.client.add_client_obj(&cb)?;
|
||||
self.pending.frame_request.borrow_mut().push(cb);
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::cursor::Cursor;
|
||||
use crate::ifs::wl_seat::WlSeatGlobal;
|
||||
use crate::ifs::wl_surface::WlSurface;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::rect::Rect;
|
||||
use crate::render::Renderer;
|
||||
use std::cell::Cell;
|
||||
|
|
@ -12,6 +13,7 @@ pub struct CursorSurface {
|
|||
hotspot: Cell<(i32, i32)>,
|
||||
pos: Cell<(i32, i32)>,
|
||||
extents: Cell<Rect>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl CursorSurface {
|
||||
|
|
@ -22,6 +24,7 @@ impl CursorSurface {
|
|||
hotspot: Cell::new((0, 0)),
|
||||
pos: Cell::new((0, 0)),
|
||||
extents: Cell::new(Default::default()),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use crate::ifs::wl_surface::{
|
|||
CommitAction, CommitContext, StackElement, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
|
||||
WlSurfaceId,
|
||||
};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::rect::Rect;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
|
|
@ -31,6 +32,7 @@ pub struct WlSubsurface {
|
|||
node: RefCell<Option<LinkedNode<StackElement>>>,
|
||||
depth: NumCell<u32>,
|
||||
pending: PendingSubsurfaceData,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
@ -85,6 +87,7 @@ impl WlSubsurface {
|
|||
node: RefCell::new(None),
|
||||
depth: NumCell::new(0),
|
||||
pending: Default::default(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use crate::ifs::wl_surface::{
|
|||
CommitAction, CommitContext, SurfaceExt, SurfaceRole, WlSurface, WlSurfaceError,
|
||||
};
|
||||
use crate::ifs::xdg_wm_base::XdgWmBase;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::rect::Rect;
|
||||
use crate::tree::{FindTreeResult, FoundNode, Node, WorkspaceNode};
|
||||
|
|
@ -22,6 +23,7 @@ use crate::wire::xdg_surface::*;
|
|||
use crate::wire::{WlSurfaceId, XdgPopupId, XdgSurfaceId};
|
||||
use crate::NumCell;
|
||||
use std::cell::Cell;
|
||||
use std::fmt::Debug;
|
||||
use std::rc::Rc;
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
@ -64,14 +66,15 @@ pub struct XdgSurface {
|
|||
pub(super) focus_surface: SmallMap<SeatId, Rc<WlSurface>, 1>,
|
||||
seat_state: NodeSeatState,
|
||||
pub workspace: CloneCell<Option<Rc<WorkspaceNode>>>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(Default, Debug)]
|
||||
struct PendingXdgSurfaceData {
|
||||
geometry: Cell<Option<Rect>>,
|
||||
}
|
||||
|
||||
trait XdgSurfaceExt {
|
||||
pub trait XdgSurfaceExt: Debug {
|
||||
fn initial_configure(self: Rc<Self>) -> Result<(), XdgSurfaceError> {
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -111,6 +114,7 @@ impl XdgSurface {
|
|||
focus_surface: Default::default(),
|
||||
seat_state: Default::default(),
|
||||
workspace: Default::default(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -214,6 +218,7 @@ impl XdgSurface {
|
|||
return Err(DestroyError::PopupsNotYetDestroyed);
|
||||
}
|
||||
}
|
||||
self.focus_surface.clear();
|
||||
self.surface.set_xdg_surface(None);
|
||||
self.surface.unset_ext();
|
||||
self.base.surfaces.remove(&self.id);
|
||||
|
|
@ -236,6 +241,7 @@ impl XdgSurface {
|
|||
return Err(GetToplevelError::AlreadyConstructed);
|
||||
}
|
||||
let toplevel = Rc::new(XdgToplevel::new(req.id, self));
|
||||
track!(self.surface.client, toplevel);
|
||||
self.surface.client.add_client_obj(&toplevel)?;
|
||||
self.ext.set(Some(toplevel));
|
||||
Ok(())
|
||||
|
|
@ -261,6 +267,7 @@ impl XdgSurface {
|
|||
return Err(GetPopupError::AlreadyConstructed);
|
||||
}
|
||||
let popup = Rc::new(XdgPopup::new(req.id, self, parent.as_ref(), &positioner)?);
|
||||
track!(self.surface.client, popup);
|
||||
self.surface.client.add_client_obj(&popup)?;
|
||||
if let Some(parent) = &parent {
|
||||
parent.popups.set(req.id, popup.clone());
|
||||
|
|
@ -341,6 +348,9 @@ impl Object for XdgSurface {
|
|||
|
||||
fn break_loops(&self) {
|
||||
self.focus_surface.take();
|
||||
self.ext.take();
|
||||
self.popups.clear();
|
||||
self.workspace.set(None);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use crate::fixed::Fixed;
|
|||
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
|
||||
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt};
|
||||
use crate::ifs::xdg_positioner::{XdgPositioned, XdgPositioner, CA};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::rect::Rect;
|
||||
use crate::render::Renderer;
|
||||
|
|
@ -15,6 +16,7 @@ use crate::utils::linkedlist::LinkedNode;
|
|||
use crate::wire::xdg_popup::*;
|
||||
use crate::wire::XdgPopupId;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::rc::Rc;
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
@ -32,6 +34,13 @@ pub struct XdgPopup {
|
|||
display_link: RefCell<Option<LinkedNode<Rc<dyn Node>>>>,
|
||||
workspace_link: RefCell<Option<LinkedNode<Rc<dyn Node>>>>,
|
||||
pos: RefCell<XdgPositioned>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl Debug for XdgPopup {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("XdgPopup").finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl XdgPopup {
|
||||
|
|
@ -54,6 +63,7 @@ impl XdgPopup {
|
|||
display_link: RefCell::new(None),
|
||||
workspace_link: RefCell::new(None),
|
||||
pos: RefCell::new(pos),
|
||||
tracker: Default::default(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use crate::cursor::KnownCursor;
|
|||
use crate::fixed::Fixed;
|
||||
use crate::ifs::wl_seat::{NodeSeatState, WlSeatGlobal};
|
||||
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError, XdgSurfaceExt};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::rect::Rect;
|
||||
use crate::render::Renderer;
|
||||
|
|
@ -21,7 +22,9 @@ use crate::{bugs, NumCell};
|
|||
use ahash::{AHashMap, AHashSet};
|
||||
use num_derive::FromPrimitive;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use std::mem;
|
||||
use std::ops::Deref;
|
||||
use std::rc::Rc;
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
@ -78,6 +81,13 @@ pub struct XdgToplevel {
|
|||
min_height: Cell<Option<i32>>,
|
||||
max_width: Cell<Option<i32>>,
|
||||
max_height: Cell<Option<i32>>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl Debug for XdgToplevel {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("XdgToplevel").finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl XdgToplevel {
|
||||
|
|
@ -103,6 +113,7 @@ impl XdgToplevel {
|
|||
min_height: Cell::new(None),
|
||||
max_width: Cell::new(None),
|
||||
max_height: Cell::new(None),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -158,19 +169,30 @@ impl XdgToplevel {
|
|||
})
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
let _req: Destroy = self.xdg.surface.client.parse(self, parser)?;
|
||||
fn destroy(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
let _req: Destroy = self.xdg.surface.client.parse(self.deref(), parser)?;
|
||||
self.destroy_node(true);
|
||||
self.xdg.ext.set(None);
|
||||
if let Some(parent) = self.parent_node.take() {
|
||||
parent.remove_child(self);
|
||||
}
|
||||
{
|
||||
let mut children = self.children.borrow_mut();
|
||||
let parent = self.parent.get();
|
||||
let mut parent_children = match &parent {
|
||||
Some(p) => Some(p.children.borrow_mut()),
|
||||
_ => None,
|
||||
};
|
||||
for (_, child) in children.drain() {
|
||||
child.parent.set(self.parent.get());
|
||||
child.parent.set(parent.clone());
|
||||
if let Some(parent_children) = &mut parent_children {
|
||||
parent_children.insert(child.id, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
if let Some(parent) = self.parent.take() {
|
||||
parent.children.borrow_mut().remove(&self.id);
|
||||
}
|
||||
}
|
||||
self.xdg.surface.client.remove_obj(self.deref())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
@ -388,9 +410,6 @@ impl Object for XdgToplevel {
|
|||
|
||||
fn break_loops(&self) {
|
||||
self.destroy_node(true);
|
||||
if let Some(parent) = self.parent_node.take() {
|
||||
parent.remove_child(self);
|
||||
}
|
||||
self.parent.set(None);
|
||||
let _children = mem::take(&mut *self.children.borrow_mut());
|
||||
}
|
||||
|
|
@ -411,6 +430,7 @@ impl Node for XdgToplevel {
|
|||
if let Some(parent) = self.parent_node.take() {
|
||||
if detach {
|
||||
parent.remove_child(self);
|
||||
self.xdg.surface.client.state.tree_changed();
|
||||
}
|
||||
}
|
||||
self.toplevel_history.take();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use crate::client::{Client, ClientError};
|
||||
use crate::ifs::xdg_wm_base::XdgWmBase;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::rect::Rect;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
|
|
@ -69,6 +70,7 @@ pub struct XdgPositioner {
|
|||
base: Rc<XdgWmBase>,
|
||||
client: Rc<Client>,
|
||||
position: RefCell<XdgPositioned>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default)]
|
||||
|
|
@ -146,6 +148,7 @@ impl XdgPositioner {
|
|||
client: client.clone(),
|
||||
base: base.clone(),
|
||||
position: RefCell::new(Default::default()),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use crate::client::{Client, ClientError};
|
|||
use crate::globals::{Global, GlobalName};
|
||||
use crate::ifs::wl_surface::xdg_surface::{XdgSurface, XdgSurfaceError};
|
||||
use crate::ifs::xdg_positioner::XdgPositioner;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -32,6 +33,7 @@ pub struct XdgWmBase {
|
|||
client: Rc<Client>,
|
||||
pub version: u32,
|
||||
pub(super) surfaces: CopyHashMap<XdgSurfaceId, Rc<XdgSurface>>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl XdgWmBaseGlobal {
|
||||
|
|
@ -50,7 +52,9 @@ impl XdgWmBaseGlobal {
|
|||
client: client.clone(),
|
||||
version,
|
||||
surfaces: Default::default(),
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -80,6 +84,7 @@ impl XdgWmBase {
|
|||
) -> Result<(), CreatePositionerError> {
|
||||
let req: CreatePositioner = self.client.parse(&**self, parser)?;
|
||||
let pos = Rc::new(XdgPositioner::new(self, req.id, &self.client));
|
||||
track!(self.client, pos);
|
||||
self.client.add_client_obj(&pos)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -91,6 +96,7 @@ impl XdgWmBase {
|
|||
let req: GetXdgSurface = self.client.parse(&**self, parser)?;
|
||||
let surface = self.client.lookup(req.surface)?;
|
||||
let xdg_surface = Rc::new(XdgSurface::new(self, req.id, &surface));
|
||||
track!(self.client, xdg_surface);
|
||||
self.client.add_client_obj(&xdg_surface)?;
|
||||
xdg_surface.install()?;
|
||||
self.surfaces.set(req.id, xdg_surface);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ use crate::drm::dma::{DmaBuf, DmaBufPlane};
|
|||
use crate::drm::INVALID_MODIFIER;
|
||||
use crate::ifs::wl_buffer::WlBuffer;
|
||||
use crate::ifs::zwp_linux_dmabuf_v1::ZwpLinuxDmabufV1;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -28,6 +29,7 @@ pub struct ZwpLinuxBufferParamsV1 {
|
|||
pub parent: Rc<ZwpLinuxDmabufV1>,
|
||||
planes: RefCell<AHashMap<u32, Add>>,
|
||||
used: Cell<bool>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl ZwpLinuxBufferParamsV1 {
|
||||
|
|
@ -37,6 +39,7 @@ impl ZwpLinuxBufferParamsV1 {
|
|||
parent: parent.clone(),
|
||||
planes: RefCell::new(Default::default()),
|
||||
used: Cell::new(false),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -120,6 +123,7 @@ impl ZwpLinuxBufferParamsV1 {
|
|||
format,
|
||||
&img,
|
||||
));
|
||||
track!(self.parent.client, buffer);
|
||||
if is_client_id {
|
||||
self.parent.client.add_client_obj(&buffer)?;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use crate::client::{Client, ClientError};
|
|||
use crate::drm::INVALID_MODIFIER;
|
||||
use crate::globals::{Global, GlobalName};
|
||||
use crate::ifs::zwp_linux_buffer_params_v1::ZwpLinuxBufferParamsV1;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use crate::utils::buffd::MsgParserError;
|
||||
|
|
@ -29,7 +30,9 @@ impl ZwpLinuxDmabufV1Global {
|
|||
id,
|
||||
client: client.clone(),
|
||||
_version: version,
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
if let Some(ctx) = client.state.render_ctx.get() {
|
||||
let formats = ctx.formats();
|
||||
|
|
@ -68,6 +71,7 @@ pub struct ZwpLinuxDmabufV1 {
|
|||
id: ZwpLinuxDmabufV1Id,
|
||||
pub client: Rc<Client>,
|
||||
_version: u32,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl ZwpLinuxDmabufV1 {
|
||||
|
|
@ -96,6 +100,7 @@ impl ZwpLinuxDmabufV1 {
|
|||
fn create_params(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), CreateParamsError> {
|
||||
let req: CreateParams = self.client.parse(&**self, parser)?;
|
||||
let params = Rc::new(ZwpLinuxBufferParamsV1::new(req.params_id, self));
|
||||
track!(self.client, params);
|
||||
self.client.add_client_obj(¶ms)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use crate::client::{Client, ClientError};
|
||||
use crate::globals::{Global, GlobalName};
|
||||
use crate::ifs::zxdg_toplevel_decoration_v1::ZxdgToplevelDecorationV1;
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::{MsgParser, MsgParserError};
|
||||
use crate::wire::zxdg_decoration_manager_v1::*;
|
||||
|
|
@ -26,7 +27,9 @@ impl ZxdgDecorationManagerV1Global {
|
|||
id,
|
||||
client: client.clone(),
|
||||
_version: version,
|
||||
tracker: Default::default(),
|
||||
});
|
||||
track!(client, obj);
|
||||
client.add_client_obj(&obj)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -54,6 +57,7 @@ pub struct ZxdgDecorationManagerV1 {
|
|||
id: ZxdgDecorationManagerV1Id,
|
||||
client: Rc<Client>,
|
||||
_version: u32,
|
||||
tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl ZxdgDecorationManagerV1 {
|
||||
|
|
@ -70,6 +74,7 @@ impl ZxdgDecorationManagerV1 {
|
|||
let req: GetToplevelDecoration = self.client.parse(self, parser)?;
|
||||
let tl = self.client.lookup(req.toplevel)?;
|
||||
let obj = Rc::new(ZxdgToplevelDecorationV1::new(req.id, &self.client, &tl));
|
||||
track!(self.client, obj);
|
||||
self.client.add_client_obj(&obj)?;
|
||||
obj.do_send_configure();
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use crate::client::{Client, ClientError};
|
||||
use crate::ifs::wl_surface::xdg_surface::xdg_toplevel::{Decoration, XdgToplevel};
|
||||
use crate::leaks::Tracker;
|
||||
use crate::object::Object;
|
||||
use crate::utils::buffd::{MsgParser, MsgParserError};
|
||||
use crate::wire::zxdg_toplevel_decoration_v1::*;
|
||||
|
|
@ -14,6 +15,7 @@ pub struct ZxdgToplevelDecorationV1 {
|
|||
pub id: ZxdgToplevelDecorationV1Id,
|
||||
pub client: Rc<Client>,
|
||||
pub toplevel: Rc<XdgToplevel>,
|
||||
pub tracker: Tracker<Self>,
|
||||
}
|
||||
|
||||
impl ZxdgToplevelDecorationV1 {
|
||||
|
|
@ -26,6 +28,7 @@ impl ZxdgToplevelDecorationV1 {
|
|||
id,
|
||||
client: client.clone(),
|
||||
toplevel: toplevel.clone(),
|
||||
tracker: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue