screencast: schedule toplevel screencasts with other screencasts
This commit is contained in:
parent
dbb9bd2299
commit
b28ea64509
8 changed files with 90 additions and 15 deletions
|
|
@ -37,8 +37,8 @@ use {
|
|||
},
|
||||
utils::{
|
||||
clonecell::CloneCell, copyhashmap::CopyHashMap, errorfmt::ErrorFmt,
|
||||
hash_map_ext::HashMapExt, linkedlist::LinkedList, scroller::Scroller,
|
||||
transform_ext::TransformExt,
|
||||
event_listener::EventSource, hash_map_ext::HashMapExt, linkedlist::LinkedList,
|
||||
scroller::Scroller, transform_ext::TransformExt,
|
||||
},
|
||||
wire::{JayOutputId, JayScreencastId, ZwlrScreencopyFrameV1Id},
|
||||
},
|
||||
|
|
@ -80,6 +80,11 @@ pub struct OutputNode {
|
|||
pub screencopies: CopyHashMap<(ClientId, ZwlrScreencopyFrameV1Id), Rc<ZwlrScreencopyFrameV1>>,
|
||||
pub title_visible: Cell<bool>,
|
||||
pub schedule: Rc<OutputSchedule>,
|
||||
pub latch_event: EventSource<dyn LatchListener>,
|
||||
}
|
||||
|
||||
pub trait LatchListener {
|
||||
fn after_latch(self: Rc<Self>);
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
||||
|
|
@ -148,6 +153,9 @@ impl OutputNode {
|
|||
y_off: i32,
|
||||
size: Option<(i32, i32)>,
|
||||
) {
|
||||
for listener in self.latch_event.iter() {
|
||||
listener.after_latch();
|
||||
}
|
||||
if let Some(workspace) = self.workspace.get() {
|
||||
if !workspace.may_capture.get() {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ pub trait ToplevelNode: ToplevelNodeBase {
|
|||
fn tl_set_parent(&self, parent: Rc<dyn ContainingNode>);
|
||||
fn tl_extents_changed(&self);
|
||||
fn tl_set_workspace(&self, ws: &Rc<WorkspaceNode>);
|
||||
fn tl_workspace_output_changed(&self);
|
||||
fn tl_change_extents(self: Rc<Self>, rect: &Rect);
|
||||
fn tl_set_visible(&self, visible: bool);
|
||||
fn tl_destroy(&self);
|
||||
|
|
@ -112,8 +113,20 @@ impl<T: ToplevelNodeBase> ToplevelNode for T {
|
|||
|
||||
fn tl_set_workspace(&self, ws: &Rc<WorkspaceNode>) {
|
||||
let data = self.tl_data();
|
||||
data.workspace.set(Some(ws.clone()));
|
||||
let prev = data.workspace.set(Some(ws.clone()));
|
||||
self.tl_set_workspace_ext(ws);
|
||||
let prev_id = prev.map(|p| p.output.get().id);
|
||||
let new_id = Some(ws.output.get().id);
|
||||
if prev_id != new_id {
|
||||
self.tl_workspace_output_changed();
|
||||
}
|
||||
}
|
||||
|
||||
fn tl_workspace_output_changed(&self) {
|
||||
let data = self.tl_data();
|
||||
for sc in data.jay_screencasts.lock().values() {
|
||||
sc.update_latch_listener();
|
||||
}
|
||||
}
|
||||
|
||||
fn tl_change_extents(self: Rc<Self>, rect: &Rect) {
|
||||
|
|
@ -484,6 +497,9 @@ impl ToplevelData {
|
|||
pub fn set_visible(&self, node: &dyn Node, visible: bool) {
|
||||
self.visible.set(visible);
|
||||
self.seat_state.set_visible(node, visible);
|
||||
for sc in self.jay_screencasts.lock().values() {
|
||||
sc.update_latch_listener();
|
||||
}
|
||||
if !visible {
|
||||
return;
|
||||
}
|
||||
|
|
@ -508,4 +524,11 @@ impl ToplevelData {
|
|||
parent.cnode_child_attention_request_changed(node, true);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn output(&self) -> Rc<OutputNode> {
|
||||
match self.workspace.get() {
|
||||
None => self.state.dummy_output.get().unwrap(),
|
||||
Some(ws) => ws.output.get(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@ use {
|
|||
jay_workspace::JayWorkspace,
|
||||
wl_output::OutputId,
|
||||
wl_seat::{tablet::TabletTool, NodeSeatState, WlSeatGlobal},
|
||||
wl_surface::WlSurface,
|
||||
wl_surface::{
|
||||
x_surface::xwindow::Xwindow, xdg_surface::xdg_toplevel::XdgToplevel, WlSurface,
|
||||
},
|
||||
},
|
||||
rect::Rect,
|
||||
renderer::Renderer,
|
||||
|
|
@ -16,7 +18,7 @@ use {
|
|||
tree::{
|
||||
container::ContainerNode, walker::NodeVisitor, ContainingNode, Direction,
|
||||
FindTreeResult, FindTreeUsecase, FoundNode, Node, NodeId, NodeVisitorBase, OutputNode,
|
||||
StackedNode, ToplevelNode,
|
||||
PlaceholderNode, StackedNode, ToplevelNode,
|
||||
},
|
||||
utils::{
|
||||
clonecell::CloneCell,
|
||||
|
|
@ -102,6 +104,26 @@ impl WorkspaceNode {
|
|||
fn visit_surface(&mut self, node: &Rc<WlSurface>) {
|
||||
node.set_output(self.0);
|
||||
}
|
||||
|
||||
fn visit_container(&mut self, node: &Rc<ContainerNode>) {
|
||||
node.tl_workspace_output_changed();
|
||||
node.node_visit_children(self);
|
||||
}
|
||||
|
||||
fn visit_toplevel(&mut self, node: &Rc<XdgToplevel>) {
|
||||
node.tl_workspace_output_changed();
|
||||
node.node_visit_children(self);
|
||||
}
|
||||
|
||||
fn visit_xwindow(&mut self, node: &Rc<Xwindow>) {
|
||||
node.tl_workspace_output_changed();
|
||||
node.node_visit_children(self);
|
||||
}
|
||||
|
||||
fn visit_placeholder(&mut self, node: &Rc<PlaceholderNode>) {
|
||||
node.tl_workspace_output_changed();
|
||||
node.node_visit_children(self);
|
||||
}
|
||||
}
|
||||
let mut visitor = OutputSetter(output);
|
||||
self.node_visit_children(&mut visitor);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue