diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-03-29 23:34:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-29 23:34:14 -0400 |
commit | 472e81f35d689d67cda241acafda91c688d61046 (patch) | |
tree | b8b52173a9791e3b13a0316ab9d316a80a6adc20 /sway/commands | |
parent | 6b7841b11ff4cd35f54d69dc92029855893e5ce0 (diff) | |
parent | d0c7f66e950689b70196a890b62b82ff3c66e103 (diff) |
Merge pull request #1653 from swaywm/revert-1647-refactor-tree
Revert "Refactor tree"
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/exec_always.c | 4 | ||||
-rw-r--r-- | sway/commands/focus.c | 9 | ||||
-rw-r--r-- | sway/commands/kill.c | 4 | ||||
-rw-r--r-- | sway/commands/layout.c | 20 | ||||
-rw-r--r-- | sway/commands/output.c | 2 | ||||
-rw-r--r-- | sway/commands/reload.c | 2 | ||||
-rw-r--r-- | sway/commands/workspace.c | 14 |
7 files changed, 27 insertions, 28 deletions
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c index 954950e7..61870c51 100644 --- a/sway/commands/exec_always.c +++ b/sway/commands/exec_always.c @@ -6,8 +6,8 @@ #include <unistd.h> #include "sway/commands.h" #include "sway/config.h" -#include "sway/tree/container.h" -#include "sway/tree/workspace.h" +#include "sway/container.h" +#include "sway/workspace.h" #include "log.h" #include "stringop.h" diff --git a/sway/commands/focus.c b/sway/commands/focus.c index 64f079f4..f1a8078f 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c @@ -3,11 +3,10 @@ #include "log.h" #include "sway/input/input-manager.h" #include "sway/input/seat.h" -#include "sway/tree/view.h" +#include "sway/view.h" #include "sway/commands.h" -static bool parse_movement_direction(const char *name, - enum movement_direction *out) { +static bool parse_movement_direction(const char *name, enum movement_direction *out) { if (strcasecmp(name, "left") == 0) { *out = MOVE_LEFT; } else if (strcasecmp(name, "right") == 0) { @@ -32,7 +31,7 @@ static bool parse_movement_direction(const char *name, } struct cmd_results *cmd_focus(int argc, char **argv) { - struct sway_container *con = config->handler_context.current_container; + swayc_t *con = config->handler_context.current_container; struct sway_seat *seat = config->handler_context.seat; if (con->type < C_WORKSPACE) { return cmd_results_new(CMD_FAILURE, "focus", @@ -51,7 +50,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) { "Expected 'focus <direction|parent|child|mode_toggle>' or 'focus output <direction|name>'"); } - struct sway_container *next_focus = container_get_in_direction(con, seat, direction); + swayc_t *next_focus = get_swayc_in_direction(con, seat, direction); if (next_focus) { sway_seat_set_focus(seat, next_focus); } diff --git a/sway/commands/kill.c b/sway/commands/kill.c index f6774767..f408ce2a 100644 --- a/sway/commands/kill.c +++ b/sway/commands/kill.c @@ -2,11 +2,11 @@ #include "log.h" #include "sway/input/input-manager.h" #include "sway/input/seat.h" -#include "sway/tree/view.h" +#include "sway/view.h" #include "sway/commands.h" struct cmd_results *cmd_kill(int argc, char **argv) { - enum sway_container_type type = config->handler_context.current_container->type; + enum swayc_types type = config->handler_context.current_container->type; if (type != C_VIEW && type != C_CONTAINER) { return cmd_results_new(CMD_INVALID, NULL, "Can only kill views and containers with this command"); diff --git a/sway/commands/layout.c b/sway/commands/layout.c index ebab2a48..b0fc5d66 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c @@ -1,8 +1,8 @@ #include <string.h> #include <strings.h> #include "sway/commands.h" -#include "sway/tree/container.h" -#include "sway/tree/layout.h" +#include "sway/container.h" +#include "sway/layout.h" #include "log.h" struct cmd_results *cmd_layout(int argc, char **argv) { @@ -10,7 +10,7 @@ struct cmd_results *cmd_layout(int argc, char **argv) { if ((error = checkarg(argc, "layout", EXPECTED_MORE_THAN, 0))) { return error; } - struct sway_container *parent = config->handler_context.current_container; + swayc_t *parent = config->handler_context.current_container; // TODO: floating /* @@ -26,10 +26,10 @@ struct cmd_results *cmd_layout(int argc, char **argv) { // TODO: stacks and tabs if (strcasecmp(argv[0], "default") == 0) { - container_set_layout(parent, parent->prev_layout); + swayc_change_layout(parent, parent->prev_layout); if (parent->layout == L_NONE) { - struct sway_container *output = container_parent(parent, C_OUTPUT); - container_set_layout(parent, container_get_default_layout(output)); + swayc_t *output = swayc_parent_by_type(parent, C_OUTPUT); + swayc_change_layout(parent, default_layout(output)); } } else { if (parent->layout != L_TABBED && parent->layout != L_STACKED) { @@ -37,15 +37,15 @@ struct cmd_results *cmd_layout(int argc, char **argv) { } if (strcasecmp(argv[0], "splith") == 0) { - container_set_layout(parent, L_HORIZ); + swayc_change_layout(parent, L_HORIZ); } else if (strcasecmp(argv[0], "splitv") == 0) { - container_set_layout(parent, L_VERT); + swayc_change_layout(parent, L_VERT); } else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) { if (parent->layout == L_HORIZ && (parent->workspace_layout == L_NONE || parent->workspace_layout == L_HORIZ)) { - container_set_layout(parent, L_VERT); + swayc_change_layout(parent, L_VERT); } else { - container_set_layout(parent, L_HORIZ); + swayc_change_layout(parent, L_HORIZ); } } } diff --git a/sway/commands/output.c b/sway/commands/output.c index f7e3372c..35bc8099 100644 --- a/sway/commands/output.c +++ b/sway/commands/output.c @@ -296,7 +296,7 @@ struct cmd_results *cmd_output(int argc, char **argv) { char identifier[128]; bool all = strcmp(output->name, "*") == 0; for (int i = 0; i < root_container.children->length; ++i) { - struct sway_container *cont = root_container.children->items[i]; + swayc_t *cont = root_container.children->items[i]; if (cont->type != C_OUTPUT) { continue; } diff --git a/sway/commands/reload.c b/sway/commands/reload.c index 8cef789b..d54d40db 100644 --- a/sway/commands/reload.c +++ b/sway/commands/reload.c @@ -1,6 +1,6 @@ #include "sway/commands.h" #include "sway/config.h" -#include "sway/tree/layout.h" +#include "sway/layout.h" struct cmd_results *cmd_reload(int argc, char **argv) { struct cmd_results *error = NULL; diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index 8f39e5fc..fa891398 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c @@ -4,7 +4,7 @@ #include "sway/commands.h" #include "sway/config.h" #include "sway/input/seat.h" -#include "sway/tree/workspace.h" +#include "sway/workspace.h" #include "list.h" #include "log.h" #include "stringop.h" @@ -17,15 +17,15 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { int output_location = -1; - struct sway_container *current_container = config->handler_context.current_container; - struct sway_container *old_workspace = NULL, *old_output = NULL; + swayc_t *current_container = config->handler_context.current_container; + swayc_t *old_workspace = NULL, *old_output = NULL; if (current_container) { if (current_container->type == C_WORKSPACE) { old_workspace = current_container; } else { - old_workspace = container_parent(current_container, C_WORKSPACE); + old_workspace = swayc_parent_by_type(current_container, C_WORKSPACE); } - old_output = container_parent(current_container, C_OUTPUT); + old_output = swayc_parent_by_type(current_container, C_OUTPUT); } for (int i = 0; i < argc; ++i) { @@ -57,7 +57,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { if (config->reading || !config->active) { return cmd_results_new(CMD_DEFER, "workspace", NULL); } - struct sway_container *ws = NULL; + swayc_t *ws = NULL; if (strcasecmp(argv[0], "number") == 0) { if (!(ws = workspace_by_number(argv[1]))) { char *name = join_args(argv + 1, argc - 1); @@ -92,7 +92,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { workspace_switch(ws); current_container = sway_seat_get_focus(config->handler_context.seat); - struct sway_container *new_output = container_parent(current_container, C_OUTPUT); + swayc_t *new_output = swayc_parent_by_type(current_container, C_OUTPUT); if (config->mouse_warping && old_output != new_output) { // TODO: Warp mouse |