screencapture: implement ext_foreign_toplevel_image_capture_source_manager_v1
This commit is contained in:
parent
40bce507a6
commit
e91993fb18
8 changed files with 185 additions and 51 deletions
|
|
@ -138,51 +138,52 @@ Jay uses frame scheduling to achieve input latency as low as 1.5 ms.
|
||||||
|
|
||||||
Jay supports the following wayland protocols:
|
Jay supports the following wayland protocols:
|
||||||
|
|
||||||
| Global | Version | Privileged |
|
| Global | Version | Privileged |
|
||||||
|--------------------------------------------|:----------------|---------------|
|
|------------------------------------------------------|:----------------|---------------|
|
||||||
| ext_foreign_toplevel_list_v1 | 1 | Yes |
|
| ext_foreign_toplevel_image_capture_source_manager_v1 | 1 | |
|
||||||
| ext_idle_notifier_v1 | 1 | Yes |
|
| ext_foreign_toplevel_list_v1 | 1 | Yes |
|
||||||
| ext_output_image_capture_source_manager_v1 | 1 | |
|
| ext_idle_notifier_v1 | 1 | Yes |
|
||||||
| ext_session_lock_manager_v1 | 1 | Yes |
|
| ext_output_image_capture_source_manager_v1 | 1 | |
|
||||||
| ext_transient_seat_manager_v1 | 1[^ts_rejected] | Yes |
|
| ext_session_lock_manager_v1 | 1 | Yes |
|
||||||
| org_kde_kwin_server_decoration_manager | 1 | |
|
| ext_transient_seat_manager_v1 | 1[^ts_rejected] | Yes |
|
||||||
| wl_compositor | 6 | |
|
| org_kde_kwin_server_decoration_manager | 1 | |
|
||||||
| wl_data_device_manager | 3 | |
|
| wl_compositor | 6 | |
|
||||||
| wl_drm | 2 | |
|
| wl_data_device_manager | 3 | |
|
||||||
| wl_output | 4 | |
|
| wl_drm | 2 | |
|
||||||
| wl_seat | 9 | |
|
| wl_output | 4 | |
|
||||||
| wl_shm | 2 | |
|
| wl_seat | 9 | |
|
||||||
| wl_subcompositor | 1 | |
|
| wl_shm | 2 | |
|
||||||
| wp_alpha_modifier_v1 | 1 | |
|
| wl_subcompositor | 1 | |
|
||||||
| wp_content_type_manager_v1 | 1 | |
|
| wp_alpha_modifier_v1 | 1 | |
|
||||||
| wp_cursor_shape_manager_v1 | 1 | |
|
| wp_content_type_manager_v1 | 1 | |
|
||||||
| wp_drm_lease_device_v1 | 1 | |
|
| wp_cursor_shape_manager_v1 | 1 | |
|
||||||
| wp_fractional_scale_manager_v1 | 1 | |
|
| wp_drm_lease_device_v1 | 1 | |
|
||||||
| wp_linux_drm_syncobj_manager_v1 | 1 | |
|
| wp_fractional_scale_manager_v1 | 1 | |
|
||||||
| wp_presentation | 1 | |
|
| wp_linux_drm_syncobj_manager_v1 | 1 | |
|
||||||
| wp_security_context_manager_v1 | 1 | |
|
| wp_presentation | 1 | |
|
||||||
| wp_single_pixel_buffer_manager_v1 | 1 | |
|
| wp_security_context_manager_v1 | 1 | |
|
||||||
| wp_tearing_control_manager_v1 | 1 | |
|
| wp_single_pixel_buffer_manager_v1 | 1 | |
|
||||||
| wp_viewporter | 1 | |
|
| wp_tearing_control_manager_v1 | 1 | |
|
||||||
| xdg_activation_v1 | 1 | |
|
| wp_viewporter | 1 | |
|
||||||
| xdg_toplevel_drag_manager_v1 | 1 | |
|
| xdg_activation_v1 | 1 | |
|
||||||
| xdg_wm_base | 6 | |
|
| xdg_toplevel_drag_manager_v1 | 1 | |
|
||||||
| xdg_wm_dialog_v1 | 1 | |
|
| xdg_wm_base | 6 | |
|
||||||
| zwlr_data_control_manager_v1 | 2 | Yes |
|
| xdg_wm_dialog_v1 | 1 | |
|
||||||
| zwlr_layer_shell_v1 | 5 | No[^lsaccess] |
|
| zwlr_data_control_manager_v1 | 2 | Yes |
|
||||||
| zwlr_screencopy_manager_v1 | 3 | Yes |
|
| zwlr_layer_shell_v1 | 5 | No[^lsaccess] |
|
||||||
| zwp_idle_inhibit_manager_v1 | 1 | |
|
| zwlr_screencopy_manager_v1 | 3 | Yes |
|
||||||
| zwp_input_method_manager_v2 | 1 | Yes |
|
| zwp_idle_inhibit_manager_v1 | 1 | |
|
||||||
| zwp_linux_dmabuf_v1 | 5 | |
|
| zwp_input_method_manager_v2 | 1 | Yes |
|
||||||
| zwp_pointer_constraints_v1 | 1 | |
|
| zwp_linux_dmabuf_v1 | 5 | |
|
||||||
| zwp_pointer_gestures_v1 | 3 | |
|
| zwp_pointer_constraints_v1 | 1 | |
|
||||||
| zwp_primary_selection_device_manager_v1 | 1 | |
|
| zwp_pointer_gestures_v1 | 3 | |
|
||||||
| zwp_relative_pointer_manager_v1 | 1 | |
|
| zwp_primary_selection_device_manager_v1 | 1 | |
|
||||||
| zwp_tablet_manager_v2 | 1 | |
|
| zwp_relative_pointer_manager_v1 | 1 | |
|
||||||
| zwp_text_input_manager_v3 | 1 | |
|
| zwp_tablet_manager_v2 | 1 | |
|
||||||
| zwp_virtual_keyboard_manager_v1 | 1 | Yes |
|
| zwp_text_input_manager_v3 | 1 | |
|
||||||
| zxdg_decoration_manager_v1 | 1 | |
|
| zwp_virtual_keyboard_manager_v1 | 1 | Yes |
|
||||||
| zxdg_output_manager_v1 | 3 | |
|
| zxdg_decoration_manager_v1 | 1 | |
|
||||||
|
| zxdg_output_manager_v1 | 3 | |
|
||||||
|
|
||||||
[^lsaccess]: Sandboxes can restrict access to this protocol.
|
[^lsaccess]: Sandboxes can restrict access to this protocol.
|
||||||
[^ts_rejected]: Seat creation is always rejected.
|
[^ts_rejected]: Seat creation is always rejected.
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ use {
|
||||||
crate::{
|
crate::{
|
||||||
client::{Client, ClientError},
|
client::{Client, ClientError},
|
||||||
ifs::{
|
ifs::{
|
||||||
|
ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1,
|
||||||
ext_image_capture_source_v1::ExtImageCaptureSourceV1,
|
ext_image_capture_source_v1::ExtImageCaptureSourceV1,
|
||||||
ipc::{
|
ipc::{
|
||||||
wl_data_source::WlDataSource, zwlr_data_control_source_v1::ZwlrDataControlSourceV1,
|
wl_data_source::WlDataSource, zwlr_data_control_source_v1::ZwlrDataControlSourceV1,
|
||||||
|
|
@ -32,11 +33,12 @@ use {
|
||||||
copyhashmap::{CopyHashMap, Locked},
|
copyhashmap::{CopyHashMap, Locked},
|
||||||
},
|
},
|
||||||
wire::{
|
wire::{
|
||||||
ExtImageCaptureSourceV1Id, JayOutputId, JayScreencastId, JayToplevelId, JayWorkspaceId,
|
ExtForeignToplevelHandleV1Id, ExtImageCaptureSourceV1Id, JayOutputId, JayScreencastId,
|
||||||
WlBufferId, WlDataSourceId, WlOutputId, WlPointerId, WlRegionId, WlRegistryId,
|
JayToplevelId, JayWorkspaceId, WlBufferId, WlDataSourceId, WlOutputId, WlPointerId,
|
||||||
WlSeatId, WlSurfaceId, WpDrmLeaseConnectorV1Id, WpLinuxDrmSyncobjTimelineV1Id,
|
WlRegionId, WlRegistryId, WlSeatId, WlSurfaceId, WpDrmLeaseConnectorV1Id,
|
||||||
XdgPopupId, XdgPositionerId, XdgSurfaceId, XdgToplevelId, XdgWmBaseId,
|
WpLinuxDrmSyncobjTimelineV1Id, XdgPopupId, XdgPositionerId, XdgSurfaceId,
|
||||||
ZwlrDataControlSourceV1Id, ZwpPrimarySelectionSourceV1Id, ZwpTabletToolV2Id,
|
XdgToplevelId, XdgWmBaseId, ZwlrDataControlSourceV1Id, ZwpPrimarySelectionSourceV1Id,
|
||||||
|
ZwpTabletToolV2Id,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
std::{cell::RefCell, mem, rc::Rc},
|
std::{cell::RefCell, mem, rc::Rc},
|
||||||
|
|
@ -69,6 +71,8 @@ pub struct Objects {
|
||||||
pub tablet_tools: CopyHashMap<ZwpTabletToolV2Id, Rc<ZwpTabletToolV2>>,
|
pub tablet_tools: CopyHashMap<ZwpTabletToolV2Id, Rc<ZwpTabletToolV2>>,
|
||||||
pub xdg_popups: CopyHashMap<XdgPopupId, Rc<XdgPopup>>,
|
pub xdg_popups: CopyHashMap<XdgPopupId, Rc<XdgPopup>>,
|
||||||
pub image_capture_sources: CopyHashMap<ExtImageCaptureSourceV1Id, Rc<ExtImageCaptureSourceV1>>,
|
pub image_capture_sources: CopyHashMap<ExtImageCaptureSourceV1Id, Rc<ExtImageCaptureSourceV1>>,
|
||||||
|
pub foreign_toplevel_handles:
|
||||||
|
CopyHashMap<ExtForeignToplevelHandleV1Id, Rc<ExtForeignToplevelHandleV1>>,
|
||||||
ids: RefCell<Vec<usize>>,
|
ids: RefCell<Vec<usize>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,6 +107,7 @@ impl Objects {
|
||||||
tablet_tools: Default::default(),
|
tablet_tools: Default::default(),
|
||||||
xdg_popups: Default::default(),
|
xdg_popups: Default::default(),
|
||||||
image_capture_sources: Default::default(),
|
image_capture_sources: Default::default(),
|
||||||
|
foreign_toplevel_handles: Default::default(),
|
||||||
ids: RefCell::new(vec![]),
|
ids: RefCell::new(vec![]),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -141,6 +146,7 @@ impl Objects {
|
||||||
self.tablet_tools.clear();
|
self.tablet_tools.clear();
|
||||||
self.xdg_popups.clear();
|
self.xdg_popups.clear();
|
||||||
self.image_capture_sources.clear();
|
self.image_capture_sources.clear();
|
||||||
|
self.foreign_toplevel_handles.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn id<T>(&self, client_data: &Client) -> Result<T, ClientError>
|
pub fn id<T>(&self, client_data: &Client) -> Result<T, ClientError>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ use {
|
||||||
backend::Backend,
|
backend::Backend,
|
||||||
client::{Client, ClientCaps},
|
client::{Client, ClientCaps},
|
||||||
ifs::{
|
ifs::{
|
||||||
|
ext_foreign_toplevel_image_capture_source_manager_v1::ExtForeignToplevelImageCaptureSourceManagerV1Global,
|
||||||
ext_foreign_toplevel_list_v1::ExtForeignToplevelListV1Global,
|
ext_foreign_toplevel_list_v1::ExtForeignToplevelListV1Global,
|
||||||
ext_idle_notifier_v1::ExtIdleNotifierV1Global,
|
ext_idle_notifier_v1::ExtIdleNotifierV1Global,
|
||||||
ext_output_image_capture_source_manager_v1::ExtOutputImageCaptureSourceManagerV1Global,
|
ext_output_image_capture_source_manager_v1::ExtOutputImageCaptureSourceManagerV1Global,
|
||||||
|
|
@ -199,6 +200,7 @@ impl Globals {
|
||||||
add_singleton!(ZwpTabletManagerV2Global);
|
add_singleton!(ZwpTabletManagerV2Global);
|
||||||
add_singleton!(JayDamageTrackingGlobal);
|
add_singleton!(JayDamageTrackingGlobal);
|
||||||
add_singleton!(ExtOutputImageCaptureSourceManagerV1Global);
|
add_singleton!(ExtOutputImageCaptureSourceManagerV1Global);
|
||||||
|
add_singleton!(ExtForeignToplevelImageCaptureSourceManagerV1Global);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_backend_singletons(&self, backend: &Rc<dyn Backend>) {
|
pub fn add_backend_singletons(&self, backend: &Rc<dyn Backend>) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
pub mod ext_foreign_toplevel_handle_v1;
|
pub mod ext_foreign_toplevel_handle_v1;
|
||||||
|
pub mod ext_foreign_toplevel_image_capture_source_manager_v1;
|
||||||
pub mod ext_foreign_toplevel_list_v1;
|
pub mod ext_foreign_toplevel_list_v1;
|
||||||
pub mod ext_idle_notification_v1;
|
pub mod ext_idle_notification_v1;
|
||||||
pub mod ext_idle_notifier_v1;
|
pub mod ext_idle_notifier_v1;
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,11 @@ impl Object for ExtForeignToplevelHandleV1 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
simple_add_obj!(ExtForeignToplevelHandleV1);
|
dedicated_add_obj!(
|
||||||
|
ExtForeignToplevelHandleV1,
|
||||||
|
ExtForeignToplevelHandleV1Id,
|
||||||
|
foreign_toplevel_handles
|
||||||
|
);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum ExtForeignToplevelHandleV1Error {
|
pub enum ExtForeignToplevelHandleV1Error {
|
||||||
|
|
|
||||||
110
src/ifs/ext_foreign_toplevel_image_capture_source_manager_v1.rs
Normal file
110
src/ifs/ext_foreign_toplevel_image_capture_source_manager_v1.rs
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
use {
|
||||||
|
crate::{
|
||||||
|
client::{Client, ClientError},
|
||||||
|
globals::{Global, GlobalName},
|
||||||
|
ifs::ext_image_capture_source_v1::{ExtImageCaptureSourceV1, ImageCaptureSource},
|
||||||
|
leaks::Tracker,
|
||||||
|
object::{Object, Version},
|
||||||
|
wire::{
|
||||||
|
ext_foreign_toplevel_image_capture_source_manager_v1::*,
|
||||||
|
ExtForeignToplevelImageCaptureSourceManagerV1Id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
std::rc::Rc,
|
||||||
|
thiserror::Error,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct ExtForeignToplevelImageCaptureSourceManagerV1Global {
|
||||||
|
pub name: GlobalName,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ExtForeignToplevelImageCaptureSourceManagerV1Global {
|
||||||
|
pub fn new(name: GlobalName) -> Self {
|
||||||
|
Self { name }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bind_(
|
||||||
|
self: Rc<Self>,
|
||||||
|
id: ExtForeignToplevelImageCaptureSourceManagerV1Id,
|
||||||
|
client: &Rc<Client>,
|
||||||
|
version: Version,
|
||||||
|
) -> Result<(), ExtForeignToplevelImageCaptureSourceManagerV1Error> {
|
||||||
|
let obj = Rc::new(ExtForeignToplevelImageCaptureSourceManagerV1 {
|
||||||
|
id,
|
||||||
|
client: client.clone(),
|
||||||
|
tracker: Default::default(),
|
||||||
|
version,
|
||||||
|
});
|
||||||
|
track!(client, obj);
|
||||||
|
client.add_client_obj(&obj)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ExtForeignToplevelImageCaptureSourceManagerV1 {
|
||||||
|
pub id: ExtForeignToplevelImageCaptureSourceManagerV1Id,
|
||||||
|
pub client: Rc<Client>,
|
||||||
|
pub tracker: Tracker<Self>,
|
||||||
|
pub version: Version,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ExtForeignToplevelImageCaptureSourceManagerV1RequestHandler
|
||||||
|
for ExtForeignToplevelImageCaptureSourceManagerV1
|
||||||
|
{
|
||||||
|
type Error = ExtForeignToplevelImageCaptureSourceManagerV1Error;
|
||||||
|
|
||||||
|
fn create_source(&self, req: CreateSource, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||||
|
let handle = self.client.lookup(req.toplevel_handle)?;
|
||||||
|
let obj = Rc::new(ExtImageCaptureSourceV1 {
|
||||||
|
id: req.source,
|
||||||
|
client: self.client.clone(),
|
||||||
|
tracker: Default::default(),
|
||||||
|
ty: ImageCaptureSource::Toplevel(handle.toplevel.clone()),
|
||||||
|
});
|
||||||
|
track!(self.client, obj);
|
||||||
|
self.client.add_client_obj(&obj)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
|
||||||
|
self.client.remove_obj(self)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
global_base!(
|
||||||
|
ExtForeignToplevelImageCaptureSourceManagerV1Global,
|
||||||
|
ExtForeignToplevelImageCaptureSourceManagerV1,
|
||||||
|
ExtForeignToplevelImageCaptureSourceManagerV1Error
|
||||||
|
);
|
||||||
|
|
||||||
|
impl Global for ExtForeignToplevelImageCaptureSourceManagerV1Global {
|
||||||
|
fn singleton(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
fn version(&self) -> u32 {
|
||||||
|
1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
simple_add_global!(ExtForeignToplevelImageCaptureSourceManagerV1Global);
|
||||||
|
|
||||||
|
object_base! {
|
||||||
|
self = ExtForeignToplevelImageCaptureSourceManagerV1;
|
||||||
|
version = self.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Object for ExtForeignToplevelImageCaptureSourceManagerV1 {}
|
||||||
|
|
||||||
|
simple_add_obj!(ExtForeignToplevelImageCaptureSourceManagerV1);
|
||||||
|
|
||||||
|
#[derive(Debug, Error)]
|
||||||
|
pub enum ExtForeignToplevelImageCaptureSourceManagerV1Error {
|
||||||
|
#[error(transparent)]
|
||||||
|
ClientError(Box<ClientError>),
|
||||||
|
}
|
||||||
|
efrom!(
|
||||||
|
ExtForeignToplevelImageCaptureSourceManagerV1Error,
|
||||||
|
ClientError
|
||||||
|
);
|
||||||
|
|
@ -4,6 +4,7 @@ use {
|
||||||
ifs::wl_output::OutputGlobalOpt,
|
ifs::wl_output::OutputGlobalOpt,
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::{Object, Version},
|
object::{Object, Version},
|
||||||
|
tree::ToplevelOpt,
|
||||||
wire::{ext_image_capture_source_v1::*, ExtImageCaptureSourceV1Id},
|
wire::{ext_image_capture_source_v1::*, ExtImageCaptureSourceV1Id},
|
||||||
},
|
},
|
||||||
std::rc::Rc,
|
std::rc::Rc,
|
||||||
|
|
@ -14,6 +15,7 @@ use {
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub enum ImageCaptureSource {
|
pub enum ImageCaptureSource {
|
||||||
Output(Rc<OutputGlobalOpt>),
|
Output(Rc<OutputGlobalOpt>),
|
||||||
|
Toplevel(ToplevelOpt),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ExtImageCaptureSourceV1 {
|
pub struct ExtImageCaptureSourceV1 {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
request create_source {
|
||||||
|
source: id(ext_image_capture_source_v1),
|
||||||
|
toplevel_handle: id(ext_foreign_toplevel_handle_v1),
|
||||||
|
}
|
||||||
|
|
||||||
|
request destroy {
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue