diff options
author | Ragnar Groot Koerkamp <ragnar.grootkoerkamp@gmail.com> | 2021-06-18 17:05:23 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-06-22 19:00:31 +0200 |
commit | c0c4e260c45a07b98fc90276a9ca7b6cf06b3d0b (patch) | |
tree | 3035de0f58cbaf2a0bffcbd42ab6ec94db060086 /sway/tree/workspace.c | |
parent | Don't apply hide_edge_borders to any floating container (diff) | |
download | sway-c0c4e260c45a07b98fc90276a9ca7b6cf06b3d0b.tar.gz sway-c0c4e260c45a07b98fc90276a9ca7b6cf06b3d0b.tar.zst sway-c0c4e260c45a07b98fc90276a9ca7b6cf06b3d0b.zip |
Revert "Add workspace {prev,next}_on_output --create"
This reverts commit 487c83f0de9ca2a7650ad636eed6fd694ddcb82e.
The --create flag is undocumented, not in i3, and at least partially
broken (#5913), so this removes the feature.
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r-- | sway/tree/workspace.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 7e98dc92..8dd7789d 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -222,10 +222,8 @@ static void workspace_name_from_binding(const struct sway_binding * binding, | |||
222 | // not a command about workspaces | 222 | // not a command about workspaces |
223 | if (strcmp(_target, "next") == 0 || | 223 | if (strcmp(_target, "next") == 0 || |
224 | strcmp(_target, "prev") == 0 || | 224 | strcmp(_target, "prev") == 0 || |
225 | strncmp(_target, "next_on_output", | 225 | strcmp(_target, "next_on_output") == 0 || |
226 | strlen("next_on_output")) == 0 || | 226 | strcmp(_target, "prev_on_output") == 0 || |
227 | strncmp(_target, "prev_on_output", | ||
228 | strlen("next_on_output")) == 0 || | ||
229 | strcmp(_target, "number") == 0 || | 227 | strcmp(_target, "number") == 0 || |
230 | strcmp(_target, "back_and_forth") == 0 || | 228 | strcmp(_target, "back_and_forth") == 0 || |
231 | strcmp(_target, "current") == 0) { | 229 | strcmp(_target, "current") == 0) { |
@@ -363,11 +361,11 @@ struct sway_workspace *workspace_by_name(const char *name) { | |||
363 | if (current && strcmp(name, "prev") == 0) { | 361 | if (current && strcmp(name, "prev") == 0) { |
364 | return workspace_prev(current); | 362 | return workspace_prev(current); |
365 | } else if (current && strcmp(name, "prev_on_output") == 0) { | 363 | } else if (current && strcmp(name, "prev_on_output") == 0) { |
366 | return workspace_output_prev(current, false); | 364 | return workspace_output_prev(current); |
367 | } else if (current && strcmp(name, "next") == 0) { | 365 | } else if (current && strcmp(name, "next") == 0) { |
368 | return workspace_next(current); | 366 | return workspace_next(current); |
369 | } else if (current && strcmp(name, "next_on_output") == 0) { | 367 | } else if (current && strcmp(name, "next_on_output") == 0) { |
370 | return workspace_output_next(current, false); | 368 | return workspace_output_next(current); |
371 | } else if (strcmp(name, "current") == 0) { | 369 | } else if (strcmp(name, "current") == 0) { |
372 | return current; | 370 | return current; |
373 | } else if (strcasecmp(name, "back_and_forth") == 0) { | 371 | } else if (strcasecmp(name, "back_and_forth") == 0) { |
@@ -530,7 +528,7 @@ struct sway_workspace *workspace_next(struct sway_workspace *workspace) { | |||
530 | * otherwise the next one is returned. | 528 | * otherwise the next one is returned. |
531 | */ | 529 | */ |
532 | static struct sway_workspace *workspace_output_prev_next_impl( | 530 | static struct sway_workspace *workspace_output_prev_next_impl( |
533 | struct sway_output *output, int dir, bool create) { | 531 | struct sway_output *output, int dir) { |
534 | struct sway_seat *seat = input_manager_current_seat(); | 532 | struct sway_seat *seat = input_manager_current_seat(); |
535 | struct sway_workspace *workspace = seat_get_focused_workspace(seat); | 533 | struct sway_workspace *workspace = seat_get_focused_workspace(seat); |
536 | if (!workspace) { | 534 | if (!workspace) { |
@@ -540,25 +538,17 @@ static struct sway_workspace *workspace_output_prev_next_impl( | |||
540 | } | 538 | } |
541 | 539 | ||
542 | int index = list_find(output->workspaces, workspace); | 540 | int index = list_find(output->workspaces, workspace); |
543 | if (!workspace_is_empty(workspace) && create && | ||
544 | (index + dir < 0 || index + dir == output->workspaces->length)) { | ||
545 | struct sway_output *output = workspace->output; | ||
546 | char *next = workspace_next_name(output->wlr_output->name); | ||
547 | workspace_create(output, next); | ||
548 | free(next); | ||
549 | } | ||
550 | size_t new_index = wrap(index + dir, output->workspaces->length); | 541 | size_t new_index = wrap(index + dir, output->workspaces->length); |
551 | return output->workspaces->items[new_index]; | 542 | return output->workspaces->items[new_index]; |
552 | } | 543 | } |
553 | 544 | ||
554 | struct sway_workspace *workspace_output_next( | 545 | |
555 | struct sway_workspace *current, bool create) { | 546 | struct sway_workspace *workspace_output_next(struct sway_workspace *current) { |
556 | return workspace_output_prev_next_impl(current->output, 1, create); | 547 | return workspace_output_prev_next_impl(current->output, 1); |
557 | } | 548 | } |
558 | 549 | ||
559 | struct sway_workspace *workspace_output_prev( | 550 | struct sway_workspace *workspace_output_prev(struct sway_workspace *current) { |
560 | struct sway_workspace *current, bool create) { | 551 | return workspace_output_prev_next_impl(current->output, -1); |
561 | return workspace_output_prev_next_impl(current->output, -1, create); | ||
562 | } | 552 | } |
563 | 553 | ||
564 | struct sway_workspace *workspace_auto_back_and_forth( | 554 | struct sway_workspace *workspace_auto_back_and_forth( |