shell: One workspace per output

This commit is contained in:
Victoria Brekenfeld 2023-10-25 19:40:26 +02:00
parent 42aaafe586
commit 72df9d07e6
21 changed files with 1561 additions and 1987 deletions

View file

@ -254,7 +254,7 @@ impl CompositorHandler for State {
let changed = layer_map_for_output(&output).arrange();
if changed {
for workspace in self.common.shell.workspaces.spaces_mut() {
workspace.recalculate(&output);
workspace.recalculate();
}
}
}

View file

@ -41,8 +41,7 @@ impl WlrLayerShellHandler for State {
}
fn new_popup(&mut self, _parent: WlrLayerSurface, popup: PopupSurface) {
let positioner = popup.with_pending_state(|state| state.positioner);
self.common.shell.unconstrain_popup(&popup, &positioner);
self.common.shell.unconstrain_popup(&popup);
if popup.send_configure().is_ok() {
self.common
@ -76,7 +75,7 @@ impl WlrLayerShellHandler for State {
}
for workspace in self.common.shell.workspaces.spaces_mut() {
workspace.recalculate(&output);
workspace.recalculate();
}
// collect screencopy sessions needing an update

View file

@ -1296,7 +1296,7 @@ pub fn schedule_offscreen_workspace_session(
if !session.alive() {
return;
}
if !state.common.shell.outputs.contains(&output) {
if !state.common.shell.outputs().any(|o| o == &output) {
return;
}
match render_workspace_to_buffer(

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-3.0-only
use crate::{
shell::WorkspaceMode,
state::ClientState,
utils::prelude::*,
wayland::protocols::workspace::{
@ -30,19 +29,12 @@ impl WorkspaceHandler for State {
for request in requests.into_iter() {
match request {
Request::Activate(handle) => {
let maybe = match &self.common.shell.workspaces {
WorkspaceMode::Global(set) => set
.workspaces
let maybe = self.common.shell.workspaces.iter().find_map(|(o, set)| {
set.workspaces
.iter()
.position(|w| w.handle == handle)
.map(|i| (self.common.last_active_seat().active_output(), i)),
WorkspaceMode::OutputBound(sets, _) => sets.iter().find_map(|(o, set)| {
set.workspaces
.iter()
.position(|w| w.handle == handle)
.map(|i| (o.clone(), i))
}),
};
.map(|i| (o.clone(), i))
});
if let Some((output, idx)) = maybe {
let _ = self.common.shell.activate(&output, idx); // TODO: move cursor?

View file

@ -50,7 +50,7 @@ impl XdgShellHandler for State {
if surface.get_parent_surface().is_some() {
// let other shells deal with their popups
self.common.shell.unconstrain_popup(&surface, &positioner);
self.common.shell.unconstrain_popup(&surface);
if surface.send_configure().is_ok() {
self.common
@ -123,7 +123,7 @@ impl XdgShellHandler for State {
state.positioner = positioner;
});
self.common.shell.unconstrain_popup(&surface, &positioner);
self.common.shell.unconstrain_popup(&surface);
surface.send_repositioned(token);
if let Err(err) = surface.send_configure() {
warn!(
@ -150,9 +150,6 @@ impl XdgShellHandler for State {
}
fn maximize_request(&mut self, surface: ToplevelSurface) {
let seat = self.common.last_active_seat();
let output = seat.active_output();
if let Some(mapped) = self
.common
.shell
@ -164,7 +161,7 @@ impl XdgShellHandler for State {
.windows()
.find(|(w, _)| w.wl_surface().as_ref() == Some(surface.wl_surface()))
.unwrap();
workspace.maximize_request(&window, &output, self.common.event_loop_handle.clone())
workspace.maximize_request(&window)
}
}
}
@ -194,6 +191,7 @@ impl XdgShellHandler for State {
let seat = self.common.last_active_seat();
seat.active_output()
});
// TODO: If this is not the output? Do we move it?
if let Some(mapped) = self
.common
@ -206,11 +204,7 @@ impl XdgShellHandler for State {
.windows()
.find(|(w, _)| w.wl_surface().as_ref() == Some(surface.wl_surface()))
.unwrap();
workspace.fullscreen_request(
&window,
&output,
self.common.event_loop_handle.clone(),
)
workspace.fullscreen_request(&window)
}
}
}