shell: Make activate/end_workspace_swipe return Err if no set

It doesn't seem like there's really a need to have `Err(_)` and `Ok(None)`.

`Err(_)` means the set exists for the output, but doesn't have the
appropriate workspace index. It's a bit odd that the set not even
existing becomes `Ok(None)`.

Instead, just return `Err(InvalidWorkspaceIndex)` in either case.
This commit is contained in:
Ian Douglas Scott 2025-07-09 13:04:35 -07:00 committed by Victoria Brekenfeld
parent 6f5a14e95c
commit 8aa501c0e0
3 changed files with 17 additions and 22 deletions

View file

@ -539,7 +539,7 @@ impl State {
res
};
if let Ok(Some(new_pos)) = res {
if let Ok(new_pos) = res {
let workspace = shell.workspaces.active(&next_output).unwrap().1;
let new_target = workspace
.focus_stack
@ -1080,7 +1080,7 @@ fn to_next_workspace(
seat: &Seat<State>,
gesture: bool,
workspace_state: &mut WorkspaceUpdateGuard<'_, State>,
) -> Result<Option<Point<i32, Global>>, InvalidWorkspaceIndex> {
) -> Result<Point<i32, Global>, InvalidWorkspaceIndex> {
let current_output = seat.active_output();
let workspace = shell
.workspaces
@ -1106,7 +1106,7 @@ fn to_previous_workspace(
seat: &Seat<State>,
gesture: bool,
workspace_state: &mut WorkspaceUpdateGuard<'_, State>,
) -> Result<Option<Point<i32, Global>>, InvalidWorkspaceIndex> {
) -> Result<Point<i32, Global>, InvalidWorkspaceIndex> {
let current_output = seat.active_output();
let workspace = shell
.workspaces