1
0
Fork 0
forked from wry/wry

screencapture: implement ext_foreign_toplevel_image_capture_source_manager_v1

This commit is contained in:
Julian Orth 2024-10-08 22:36:47 +02:00
parent 40bce507a6
commit e91993fb18
8 changed files with 185 additions and 51 deletions

View file

@ -2,6 +2,7 @@ use {
crate::{
client::{Client, ClientError},
ifs::{
ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1,
ext_image_capture_source_v1::ExtImageCaptureSourceV1,
ipc::{
wl_data_source::WlDataSource, zwlr_data_control_source_v1::ZwlrDataControlSourceV1,
@ -32,11 +33,12 @@ use {
copyhashmap::{CopyHashMap, Locked},
},
wire::{
ExtImageCaptureSourceV1Id, JayOutputId, JayScreencastId, JayToplevelId, JayWorkspaceId,
WlBufferId, WlDataSourceId, WlOutputId, WlPointerId, WlRegionId, WlRegistryId,
WlSeatId, WlSurfaceId, WpDrmLeaseConnectorV1Id, WpLinuxDrmSyncobjTimelineV1Id,
XdgPopupId, XdgPositionerId, XdgSurfaceId, XdgToplevelId, XdgWmBaseId,
ZwlrDataControlSourceV1Id, ZwpPrimarySelectionSourceV1Id, ZwpTabletToolV2Id,
ExtForeignToplevelHandleV1Id, ExtImageCaptureSourceV1Id, JayOutputId, JayScreencastId,
JayToplevelId, JayWorkspaceId, WlBufferId, WlDataSourceId, WlOutputId, WlPointerId,
WlRegionId, WlRegistryId, WlSeatId, WlSurfaceId, WpDrmLeaseConnectorV1Id,
WpLinuxDrmSyncobjTimelineV1Id, XdgPopupId, XdgPositionerId, XdgSurfaceId,
XdgToplevelId, XdgWmBaseId, ZwlrDataControlSourceV1Id, ZwpPrimarySelectionSourceV1Id,
ZwpTabletToolV2Id,
},
},
std::{cell::RefCell, mem, rc::Rc},
@ -69,6 +71,8 @@ pub struct Objects {
pub tablet_tools: CopyHashMap<ZwpTabletToolV2Id, Rc<ZwpTabletToolV2>>,
pub xdg_popups: CopyHashMap<XdgPopupId, Rc<XdgPopup>>,
pub image_capture_sources: CopyHashMap<ExtImageCaptureSourceV1Id, Rc<ExtImageCaptureSourceV1>>,
pub foreign_toplevel_handles:
CopyHashMap<ExtForeignToplevelHandleV1Id, Rc<ExtForeignToplevelHandleV1>>,
ids: RefCell<Vec<usize>>,
}
@ -103,6 +107,7 @@ impl Objects {
tablet_tools: Default::default(),
xdg_popups: Default::default(),
image_capture_sources: Default::default(),
foreign_toplevel_handles: Default::default(),
ids: RefCell::new(vec![]),
}
}
@ -141,6 +146,7 @@ impl Objects {
self.tablet_tools.clear();
self.xdg_popups.clear();
self.image_capture_sources.clear();
self.foreign_toplevel_handles.clear();
}
pub fn id<T>(&self, client_data: &Client) -> Result<T, ClientError>