1
0
Fork 0
forked from wry/wry

ext-workspace: implement v1

This commit is contained in:
Julian Orth 2025-01-24 16:32:59 +01:00
parent 2b76083d6e
commit a4e197d92a
22 changed files with 948 additions and 4 deletions

View file

@ -23,6 +23,10 @@ use {
zwlr_layer_surface_v1::{ExclusiveSize, ZwlrLayerSurfaceV1},
SurfaceSendPreferredScaleVisitor, SurfaceSendPreferredTransformVisitor,
},
workspace_manager::{
ext_workspace_group_handle_v1::ExtWorkspaceGroupHandleV1,
ext_workspace_manager_v1::WorkspaceManagerId,
},
wp_content_type_v1::ContentType,
zwlr_layer_shell_v1::{BACKGROUND, BOTTOM, OVERLAY, TOP},
zwlr_screencopy_frame_v1::ZwlrScreencopyFrameV1,
@ -97,6 +101,7 @@ pub struct OutputNode {
pub before_latch_event: EventSource<dyn BeforeLatchListener>,
pub tray_start_rel: Cell<i32>,
pub tray_items: LinkedList<Rc<dyn DynTrayItem>>,
pub ext_workspace_groups: CopyHashMap<WorkspaceManagerId, Rc<ExtWorkspaceGroupHandleV1>>,
}
#[derive(Copy, Clone, Debug, PartialEq)]
@ -414,6 +419,7 @@ impl OutputNode {
self.screencasts.clear();
self.screencopies.clear();
self.ext_copy_sessions.clear();
self.ext_workspace_groups.clear();
}
pub fn on_spaces_changed(self: &Rc<Self>) {
@ -635,6 +641,9 @@ impl OutputNode {
jw.send_destroyed();
jw.workspace.set(None);
}
for wh in old.ext_workspaces.lock().values() {
wh.handle_destroyed();
}
old.clear();
self.state.workspaces.remove(&old.name);
} else {
@ -678,7 +687,10 @@ impl OutputNode {
title_texture: Default::default(),
attention_requests: Default::default(),
render_highlight: Default::default(),
ext_workspaces: Default::default(),
opt: Default::default(),
});
ws.opt.set(Some(ws.clone()));
ws.update_has_captures();
*ws.output_link.borrow_mut() = Some(self.workspaces.add_last(ws.clone()));
self.state.workspaces.set(name.to_string(), ws.clone());
@ -694,6 +706,7 @@ impl OutputNode {
for (client, e) in clients_to_kill.values() {
client.error(e);
}
self.state.workspace_managers.announce_workspace(self, &ws);
self.schedule_update_render_data();
ws
}

View file

@ -10,6 +10,10 @@ use {
wl_surface::{
x_surface::xwindow::Xwindow, xdg_surface::xdg_toplevel::XdgToplevel, WlSurface,
},
workspace_manager::{
ext_workspace_handle_v1::ExtWorkspaceHandleV1,
ext_workspace_manager_v1::WorkspaceManagerId,
},
},
rect::Rect,
renderer::Renderer,
@ -25,6 +29,7 @@ use {
copyhashmap::CopyHashMap,
linkedlist::{LinkedList, LinkedNode, NodeRef},
numcell::NumCell,
opt::Opt,
threshold_counter::ThresholdCounter,
},
wire::JayWorkspaceId,
@ -60,6 +65,8 @@ pub struct WorkspaceNode {
pub title_texture: RefCell<Option<TextTexture>>,
pub attention_requests: ThresholdCounter,
pub render_highlight: NumCell<u32>,
pub ext_workspaces: CopyHashMap<WorkspaceManagerId, Rc<ExtWorkspaceHandleV1>>,
pub opt: Rc<Opt<WorkspaceNode>>,
}
impl WorkspaceNode {
@ -68,6 +75,8 @@ impl WorkspaceNode {
*self.output_link.borrow_mut() = None;
self.fullscreen.set(None);
self.jay_workspaces.clear();
self.ext_workspaces.clear();
self.opt.set(None);
}
pub fn update_has_captures(&self) {
@ -95,6 +104,9 @@ impl WorkspaceNode {
pub fn set_output(&self, output: &Rc<OutputNode>) {
self.output.set(output.clone());
for wh in self.ext_workspaces.lock().values() {
wh.handle_new_output(output);
}
for jw in self.jay_workspaces.lock().values() {
jw.send_output(output);
}
@ -171,6 +183,9 @@ impl WorkspaceNode {
for jw in self.jay_workspaces.lock().values() {
jw.send_visible(visible);
}
for wh in self.ext_workspaces.lock().values() {
wh.handle_visibility_changed();
}
for stacked in self.stacked.iter() {
stacked.stacked_prepare_set_visible();
}
@ -236,6 +251,9 @@ impl WorkspaceNode {
fn mod_attention_requested(&self, set: bool) {
let crossed_threshold = self.attention_requests.adj(set);
if crossed_threshold {
for wh in self.ext_workspaces.lock().values() {
wh.handle_urgent_changed();
}
self.output.get().schedule_update_render_data();
}
}