1
0
Fork 0
forked from wry/wry

tree: fix per-workspace capture tracking

This commit is contained in:
Julian Orth 2024-04-20 13:30:34 +02:00
parent 670588fe4d
commit c6864a6d85
10 changed files with 191 additions and 145 deletions

View file

@ -49,7 +49,8 @@ pub struct WorkspaceNode {
pub visible_on_desired_output: Cell<bool>,
pub desired_output: CloneCell<Rc<OutputId>>,
pub jay_workspaces: CopyHashMap<(ClientId, JayWorkspaceId), Rc<JayWorkspace>>,
pub capture: Cell<bool>,
pub may_capture: Cell<bool>,
pub has_capture: Cell<bool>,
pub title_texture: Cell<Option<TextTexture>>,
pub attention_requests: ThresholdCounter,
}
@ -62,11 +63,34 @@ impl WorkspaceNode {
self.jay_workspaces.clear();
}
pub fn update_has_captures(&self) {
let mut has_capture = false;
let output = self.output.get();
'update: {
if !self.may_capture.get() {
break 'update;
}
for sc in output.screencasts.lock().values() {
if sc.shows_ws(self) {
has_capture = true;
break 'update;
}
}
if output.screencopies.is_not_empty() {
has_capture = true;
}
}
if self.has_capture.replace(has_capture) != has_capture {
output.schedule_update_render_data();
}
}
pub fn set_output(&self, output: &Rc<OutputNode>) {
self.output.set(output.clone());
for jw in self.jay_workspaces.lock().values() {
jw.send_output(output);
}
self.update_has_captures();
struct OutputSetter<'a>(&'a Rc<OutputNode>);
impl NodeVisitorBase for OutputSetter<'_> {
fn visit_surface(&mut self, node: &Rc<WlSurface>) {