1
0
Fork 0
forked from wry/wry

workspace: use State::show_workspace2 to make workspaces visible

This commit is contained in:
Julian Orth 2025-07-18 21:00:52 +02:00
parent d12234b38b
commit e85accf805
4 changed files with 23 additions and 33 deletions

View file

@ -250,10 +250,10 @@ impl ExtWorkspaceManagerV1RequestHandler for ExtWorkspaceManagerV1 {
continue;
};
let output = ws.output.get();
output.show_workspace(&ws);
ws.flush_jay_workspaces();
output.schedule_update_render_data();
self.client.state.tree_changed();
let seat = self.client.state.seat_queue.last().as_deref().cloned();
self.client
.state
.show_workspace2(seat.as_ref(), &output, &ws);
}
WorkspaceChange::AssignWorkspace(w, o) => {
let Some(ws) = w.get() else {

View file

@ -853,8 +853,12 @@ impl State {
node.node_do_focus(&seat, Direction::Unspecified);
}
pub fn show_workspace2(&self, seat: Option<&Rc<WlSeatGlobal>>, ws: &Rc<WorkspaceNode>) {
let output = ws.output.get();
pub fn show_workspace2(
&self,
seat: Option<&Rc<WlSeatGlobal>>,
output: &Rc<OutputNode>,
ws: &Rc<WorkspaceNode>,
) {
let mut pinned_is_focused = false;
if let Some(seat) = seat {
for pinned in output.pinned.iter() {
@ -876,12 +880,10 @@ impl State {
return;
}
ws.flush_jay_workspaces();
output.schedule_update_render_data();
self.tree_changed();
// let seats = self.globals.seats.lock();
// for seat in seats.values() {
// seat.workspace_changed(&output);
// }
if !output.is_dummy {
output.schedule_update_render_data();
self.tree_changed();
}
}
pub fn show_workspace(&self, seat: &Rc<WlSeatGlobal>, name: &str) {
@ -896,7 +898,7 @@ impl State {
output.create_workspace(name)
}
};
self.show_workspace2(Some(seat), &ws);
self.show_workspace2(Some(seat), &ws.output.get(), &ws);
}
pub fn float_map_ws(&self) -> Rc<WorkspaceNode> {

View file

@ -1081,7 +1081,7 @@ impl OutputNode {
set_layer_visible!(self.layers[3], visible);
}
fn button(self: Rc<Self>, id: PointerType) {
fn button(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, id: PointerType) {
if !self.state.show_bar.get() {
return;
}
@ -1105,10 +1105,7 @@ impl OutputNode {
}
return;
};
self.show_workspace(&ws);
ws.flush_jay_workspaces();
self.schedule_update_render_data();
self.state.tree_changed();
self.state.show_workspace2(Some(seat), &self, &ws);
}
pub fn update_presentation_type(&self) {
@ -1628,7 +1625,7 @@ impl Node for OutputNode {
self.pointer_down.remove(&seat.id());
return;
}
self.button(PointerType::Seat(seat.id()));
self.button(seat, PointerType::Seat(seat.id()));
}
fn node_on_axis_event(self: Rc<Self>, seat: &Rc<WlSeatGlobal>, event: &PendingScroll) {
@ -1658,15 +1655,7 @@ impl Node for OutputNode {
None => break,
};
}
if !self.show_workspace(&ws) {
return;
}
ws.flush_jay_workspaces();
ws.deref()
.clone()
.node_do_focus(seat, Direction::Unspecified);
self.schedule_update_render_data();
self.state.tree_changed();
self.state.show_workspace2(Some(seat), &self, &ws);
}
fn node_on_leave(&self, seat: &WlSeatGlobal) {
@ -1730,7 +1719,7 @@ impl Node for OutputNode {
self.pointer_move(id, x, y);
if let Some(changes) = changes {
if changes.down == Some(true) {
self.button(id);
self.button(tool.seat(), id);
}
}
}

View file

@ -367,7 +367,7 @@ impl Node for WorkspaceNode {
if self.is_dummy {
return;
}
self.state.show_workspace2(None, &self);
self.state.show_workspace2(None, &self.output.get(), &self);
}
fn node_on_pointer_focus(&self, seat: &Rc<WlSeatGlobal>) {
@ -499,14 +499,13 @@ pub fn move_ws_to_output(
&& (config.make_visible_always
|| (config.make_visible_if_empty && target.workspace.is_none()));
if make_visible {
target.show_workspace(&ws);
ws.state.show_workspace2(None, target, &ws);
} else {
ws.set_visible(false);
}
ws.flush_jay_workspaces();
if let Some(ws) = new_source_ws {
source.show_workspace(&ws);
ws.flush_jay_workspaces();
ws.state.show_workspace2(None, &source, &ws);
}
if !target.is_dummy {
target.schedule_update_render_data();