aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2025-05-06 11:46:35 +0200
committerSimon Ser <contact@emersion.fr>2025-05-22 17:12:51 +0200
commit534491d3aa0c60d5c941f2f46b5d7f8978901f84 (patch)
treea68ecfcdcc863412450037bf395da6dba62dfa10
parent005924f2609029612d4468c3436a816a48991246 (diff)
tree/workspace: Remove exclude arg from get_highest_available
workspace_output_get_highest_available took an output to exclude as argument, meant to avoid accidentally reselecting an output we are evacuating workspaces from. Outputs are now removed from the list before we evacuate, making exclusion unnecessary. Remove the argument.
-rw-r--r--include/sway/tree/workspace.h2
-rw-r--r--sway/tree/output.c4
-rw-r--r--sway/tree/workspace.c6
3 files changed, 4 insertions, 8 deletions
diff --git a/include/sway/tree/workspace.h b/include/sway/tree/workspace.h
index 58bde20c..27ed649f 100644
--- a/include/sway/tree/workspace.h
+++ b/include/sway/tree/workspace.h
@@ -96,7 +96,7 @@ void workspace_output_add_priority(struct sway_workspace *workspace,
struct sway_output *output);
struct sway_output *workspace_output_get_highest_available(
- struct sway_workspace *ws, struct sway_output *exclude);
+ struct sway_workspace *ws);
void workspace_detect_urgent(struct sway_workspace *workspace);
diff --git a/sway/tree/output.c b/sway/tree/output.c
index bc380629..b02c1a2c 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -37,7 +37,7 @@ static void restore_workspaces(struct sway_output *output) {
for (int j = 0; j < other->workspaces->length; j++) {
struct sway_workspace *ws = other->workspaces->items[j];
struct sway_output *highest =
- workspace_output_get_highest_available(ws, NULL);
+ workspace_output_get_highest_available(ws);
if (highest == output) {
workspace_detach(ws);
output_add_workspace(output, ws);
@@ -215,7 +215,7 @@ static void output_evacuate(struct sway_output *output) {
workspace_detach(workspace);
struct sway_output *new_output =
- workspace_output_get_highest_available(workspace, output);
+ workspace_output_get_highest_available(workspace);
if (!new_output) {
new_output = fallback_output;
}
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index a09dc3a4..f2be4cd1 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -659,13 +659,9 @@ void workspace_output_add_priority(struct sway_workspace *workspace,
}
struct sway_output *workspace_output_get_highest_available(
- struct sway_workspace *ws, struct sway_output *exclude) {
+ struct sway_workspace *ws) {
for (int i = 0; i < ws->output_priority->length; i++) {
const char *name = ws->output_priority->items[i];
- if (exclude && output_match_name_or_id(exclude, name)) {
- continue;
- }
-
struct sway_output *output = output_by_name_or_id(name);
if (output) {
return output;