screencapture: implement ext_image_copy_capture_manager_v1
This commit is contained in:
parent
e91993fb18
commit
f0562961e6
28 changed files with 1194 additions and 25 deletions
|
|
@ -6,6 +6,7 @@ use {
|
|||
fixed::Fixed,
|
||||
gfx_api::{AcquireSync, BufferResv, GfxTexture, ReleaseSync},
|
||||
ifs::{
|
||||
ext_image_copy::ext_image_copy_capture_session_v1::ExtImageCopyCaptureSessionV1,
|
||||
jay_output::JayOutput,
|
||||
jay_screencast::JayScreencast,
|
||||
wl_buffer::WlBufferStorage,
|
||||
|
|
@ -42,7 +43,9 @@ use {
|
|||
linkedlist::LinkedList, on_drop_event::OnDropEvent, scroller::Scroller,
|
||||
transform_ext::TransformExt,
|
||||
},
|
||||
wire::{JayOutputId, JayScreencastId, ZwlrScreencopyFrameV1Id},
|
||||
wire::{
|
||||
ExtImageCopyCaptureSessionV1Id, JayOutputId, JayScreencastId, ZwlrScreencopyFrameV1Id,
|
||||
},
|
||||
},
|
||||
ahash::AHashMap,
|
||||
jay_config::video::{TearingMode as ConfigTearingMode, Transform, VrrMode as ConfigVrrMode},
|
||||
|
|
@ -87,10 +90,12 @@ pub struct OutputNode {
|
|||
pub vblank_event: EventSource<dyn VblankListener>,
|
||||
pub presentation_event: EventSource<dyn PresentationListener>,
|
||||
pub flip_margin_ns: Cell<Option<u64>>,
|
||||
pub ext_copy_sessions:
|
||||
CopyHashMap<(ClientId, ExtImageCopyCaptureSessionV1Id), Rc<ExtImageCopyCaptureSessionV1>>,
|
||||
}
|
||||
|
||||
pub trait LatchListener {
|
||||
fn after_latch(self: Rc<Self>);
|
||||
fn after_latch(self: Rc<Self>, on: &OutputNode);
|
||||
}
|
||||
|
||||
pub trait VblankListener {
|
||||
|
|
@ -133,7 +138,7 @@ impl OutputNode {
|
|||
pub fn latched(&self) {
|
||||
self.schedule.latched();
|
||||
for listener in self.latch_event.iter() {
|
||||
listener.after_latch();
|
||||
listener.after_latch(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -237,6 +242,19 @@ impl OutputNode {
|
|||
size,
|
||||
);
|
||||
}
|
||||
for sc in self.ext_copy_sessions.lock().values() {
|
||||
sc.copy_texture(
|
||||
self,
|
||||
tex,
|
||||
resv,
|
||||
acquire_sync,
|
||||
release_sync,
|
||||
render_hardware_cursor,
|
||||
x_off,
|
||||
y_off,
|
||||
size,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn perform_wlr_screencopies(
|
||||
|
|
@ -353,6 +371,7 @@ impl OutputNode {
|
|||
self.jay_outputs.clear();
|
||||
self.screencasts.clear();
|
||||
self.screencopies.clear();
|
||||
self.ext_copy_sessions.clear();
|
||||
}
|
||||
|
||||
pub fn on_spaces_changed(self: &Rc<Self>) {
|
||||
|
|
@ -692,6 +711,9 @@ impl OutputNode {
|
|||
for sc in self.screencasts.lock().values() {
|
||||
sc.schedule_realloc_or_reconfigure();
|
||||
}
|
||||
for sc in self.ext_copy_sessions.lock().values() {
|
||||
sc.buffer_size_changed();
|
||||
}
|
||||
}
|
||||
|
||||
if transform != old_transform {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ use {
|
|||
ifs::{
|
||||
ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1,
|
||||
ext_foreign_toplevel_list_v1::ExtForeignToplevelListV1,
|
||||
ext_image_copy::ext_image_copy_capture_session_v1::ExtImageCopyCaptureSessionV1,
|
||||
jay_screencast::JayScreencast,
|
||||
jay_toplevel::JayToplevel,
|
||||
wl_seat::{collect_kb_foci, collect_kb_foci2, NodeSeatState, SeatId},
|
||||
|
|
@ -24,7 +25,10 @@ use {
|
|||
threshold_counter::ThresholdCounter,
|
||||
toplevel_identifier::{toplevel_identifier, ToplevelIdentifier},
|
||||
},
|
||||
wire::{ExtForeignToplevelHandleV1Id, JayScreencastId, JayToplevelId},
|
||||
wire::{
|
||||
ExtForeignToplevelHandleV1Id, ExtImageCopyCaptureSessionV1Id, JayScreencastId,
|
||||
JayToplevelId,
|
||||
},
|
||||
},
|
||||
std::{
|
||||
cell::{Cell, RefCell},
|
||||
|
|
@ -130,6 +134,9 @@ impl<T: ToplevelNodeBase> ToplevelNode for T {
|
|||
for sc in data.jay_screencasts.lock().values() {
|
||||
sc.update_latch_listener();
|
||||
}
|
||||
for sc in data.ext_copy_sessions.lock().values() {
|
||||
sc.update_latch_listener();
|
||||
}
|
||||
}
|
||||
|
||||
fn tl_change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
|
|
@ -139,6 +146,9 @@ impl<T: ToplevelNodeBase> ToplevelNode for T {
|
|||
for sc in data.jay_screencasts.lock().values() {
|
||||
sc.schedule_realloc_or_reconfigure();
|
||||
}
|
||||
for sc in data.ext_copy_sessions.lock().values() {
|
||||
sc.buffer_size_changed();
|
||||
}
|
||||
}
|
||||
if data.is_floating.get() {
|
||||
data.float_width.set(rect.width());
|
||||
|
|
@ -270,6 +280,8 @@ pub struct ToplevelData {
|
|||
pub render_highlight: NumCell<u32>,
|
||||
pub jay_toplevels: CopyHashMap<(ClientId, JayToplevelId), Rc<JayToplevel>>,
|
||||
pub jay_screencasts: CopyHashMap<(ClientId, JayScreencastId), Rc<JayScreencast>>,
|
||||
pub ext_copy_sessions:
|
||||
CopyHashMap<(ClientId, ExtImageCopyCaptureSessionV1Id), Rc<ExtImageCopyCaptureSessionV1>>,
|
||||
}
|
||||
|
||||
impl ToplevelData {
|
||||
|
|
@ -300,6 +312,7 @@ impl ToplevelData {
|
|||
render_highlight: Default::default(),
|
||||
jay_toplevels: Default::default(),
|
||||
jay_screencasts: Default::default(),
|
||||
ext_copy_sessions: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -343,6 +356,9 @@ impl ToplevelData {
|
|||
for screencast in self.jay_screencasts.lock().drain_values() {
|
||||
screencast.do_destroy();
|
||||
}
|
||||
for screencast in self.ext_copy_sessions.lock().drain_values() {
|
||||
screencast.stop();
|
||||
}
|
||||
self.identifier.set(toplevel_identifier());
|
||||
{
|
||||
let mut handles = self.handles.lock();
|
||||
|
|
@ -538,6 +554,9 @@ impl ToplevelData {
|
|||
for sc in self.jay_screencasts.lock().values() {
|
||||
sc.update_latch_listener();
|
||||
}
|
||||
for sc in self.ext_copy_sessions.lock().values() {
|
||||
sc.update_latch_listener();
|
||||
}
|
||||
if !visible {
|
||||
return;
|
||||
}
|
||||
|
|
@ -569,6 +588,15 @@ impl ToplevelData {
|
|||
Some(ws) => ws.output.get(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn desired_pixel_size(&self) -> (i32, i32) {
|
||||
let (dw, dh) = self.desired_extents.get().size();
|
||||
if let Some(ws) = self.workspace.get() {
|
||||
let scale = ws.output.get().global.persistent.scale.get();
|
||||
return scale.pixel_size(dw, dh);
|
||||
};
|
||||
(0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct TileDragDestination {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue