shell: Allow active workspace to be None

This commit is contained in:
Victoria Brekenfeld 2025-01-06 19:23:06 +01:00 committed by Victoria Brekenfeld
parent 23570ea9f4
commit db13eea91c
13 changed files with 230 additions and 167 deletions

View file

@ -148,9 +148,10 @@ impl ToplevelManagementHandler for State {
let mut shell = self.common.shell.write().unwrap();
let seat = shell.seats.last_active().clone();
if let Some(mapped) = shell.element_for_surface(window).cloned() {
if let Some(output) = output {
if let Some((output, workspace)) =
output.and_then(|output| shell.workspaces.active_mut(&output).map(|w| (output, w)))
{
let from = minimize_rectangle(&output, window);
let workspace = shell.workspaces.active_mut(&output);
workspace.fullscreen_request(window, None, from, &seat);
} else if let Some((output, handle)) = shell
.space_for(&mapped)

View file

@ -42,7 +42,7 @@ impl XdgActivationHandler for State {
if let Some(seat) = data.serial.and_then(|(_, seat)| Seat::from_resource(&seat)) {
let output = seat.active_output();
let mut shell = self.common.shell.write().unwrap();
let workspace = shell.active_space_mut(&output);
let workspace = shell.active_space_mut(&output).unwrap();
workspace.pending_tokens.insert(token.clone());
let handle = workspace.handle;
data.user_data
@ -86,7 +86,7 @@ impl XdgActivationHandler for State {
if valid {
let output = seat.active_output();
let mut shell = self.common.shell.write().unwrap();
let workspace = shell.active_space_mut(&output);
let workspace = shell.active_space_mut(&output).unwrap();
workspace.pending_tokens.insert(token.clone());
let handle = workspace.handle;
data.user_data
@ -125,7 +125,7 @@ impl XdgActivationHandler for State {
}
let element_workspace = shell.space_for(&element).map(|w| w.handle.clone());
let current_workspace = shell.active_space_mut(&current_output);
let current_workspace = shell.active_space_mut(&current_output).unwrap();
let in_current_workspace = element_workspace
.as_ref()

View file

@ -270,13 +270,13 @@ impl XdgShellHandler for State {
mapped
};
let workspace_handle = shell.active_space(&output).handle.clone();
let workspace_handle = shell.active_space(&output).unwrap().handle.clone();
for (window, _) in mapped.windows() {
toplevel_enter_output(&window, &output);
toplevel_enter_workspace(&window, &workspace_handle);
}
let workspace = shell.active_space_mut(&output);
let workspace = shell.active_space_mut(&output).unwrap();
workspace.floating_layer.map(mapped.clone(), None);
workspace.fullscreen_request(
@ -316,13 +316,13 @@ impl XdgShellHandler for State {
};
let handle = workspace.handle.clone();
let workspace_handle = shell.active_space(&output).handle.clone();
let workspace_handle = shell.active_space(&output).unwrap().handle.clone();
for (window, _) in mapped.windows() {
toplevel_enter_output(&window, &output);
toplevel_enter_workspace(&window, &workspace_handle);
}
let workspace = shell.active_space_mut(&output);
let workspace = shell.active_space_mut(&output).unwrap();
workspace.floating_layer.map(mapped.clone(), None);
workspace.fullscreen_request(