diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-03-29 23:41:33 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-03-29 23:41:33 -0400 |
commit | dc8c9fbeb664518c76066cc28ee29452c6c30128 (patch) | |
tree | 88c2de0d08e00b2a30cb20cdfadfa6e53f5c59b4 /sway/commands | |
parent | Merge pull request #1653 from swaywm/revert-1647-refactor-tree (diff) | |
download | sway-dc8c9fbeb664518c76066cc28ee29452c6c30128.tar.gz sway-dc8c9fbeb664518c76066cc28ee29452c6c30128.tar.zst sway-dc8c9fbeb664518c76066cc28ee29452c6c30128.zip |
Revert "Merge pull request #1653 from swaywm/revert-1647-refactor-tree"
This reverts commit 472e81f35d689d67cda241acafda91c688d61046, reversing
changes made to 6b7841b11ff4cd35f54d69dc92029855893e5ce0.
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, 28 insertions, 27 deletions
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c index 61870c51..954950e7 100644 --- a/sway/commands/exec_always.c +++ b/sway/commands/exec_always.c | |||
@@ -6,8 +6,8 @@ | |||
6 | #include <unistd.h> | 6 | #include <unistd.h> |
7 | #include "sway/commands.h" | 7 | #include "sway/commands.h" |
8 | #include "sway/config.h" | 8 | #include "sway/config.h" |
9 | #include "sway/container.h" | 9 | #include "sway/tree/container.h" |
10 | #include "sway/workspace.h" | 10 | #include "sway/tree/workspace.h" |
11 | #include "log.h" | 11 | #include "log.h" |
12 | #include "stringop.h" | 12 | #include "stringop.h" |
13 | 13 | ||
diff --git a/sway/commands/focus.c b/sway/commands/focus.c index f1a8078f..64f079f4 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c | |||
@@ -3,10 +3,11 @@ | |||
3 | #include "log.h" | 3 | #include "log.h" |
4 | #include "sway/input/input-manager.h" | 4 | #include "sway/input/input-manager.h" |
5 | #include "sway/input/seat.h" | 5 | #include "sway/input/seat.h" |
6 | #include "sway/view.h" | 6 | #include "sway/tree/view.h" |
7 | #include "sway/commands.h" | 7 | #include "sway/commands.h" |
8 | 8 | ||
9 | static bool parse_movement_direction(const char *name, enum movement_direction *out) { | 9 | static bool parse_movement_direction(const char *name, |
10 | enum movement_direction *out) { | ||
10 | if (strcasecmp(name, "left") == 0) { | 11 | if (strcasecmp(name, "left") == 0) { |
11 | *out = MOVE_LEFT; | 12 | *out = MOVE_LEFT; |
12 | } else if (strcasecmp(name, "right") == 0) { | 13 | } else if (strcasecmp(name, "right") == 0) { |
@@ -31,7 +32,7 @@ static bool parse_movement_direction(const char *name, enum movement_direction * | |||
31 | } | 32 | } |
32 | 33 | ||
33 | struct cmd_results *cmd_focus(int argc, char **argv) { | 34 | struct cmd_results *cmd_focus(int argc, char **argv) { |
34 | swayc_t *con = config->handler_context.current_container; | 35 | struct sway_container *con = config->handler_context.current_container; |
35 | struct sway_seat *seat = config->handler_context.seat; | 36 | struct sway_seat *seat = config->handler_context.seat; |
36 | if (con->type < C_WORKSPACE) { | 37 | if (con->type < C_WORKSPACE) { |
37 | return cmd_results_new(CMD_FAILURE, "focus", | 38 | return cmd_results_new(CMD_FAILURE, "focus", |
@@ -50,7 +51,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) { | |||
50 | "Expected 'focus <direction|parent|child|mode_toggle>' or 'focus output <direction|name>'"); | 51 | "Expected 'focus <direction|parent|child|mode_toggle>' or 'focus output <direction|name>'"); |
51 | } | 52 | } |
52 | 53 | ||
53 | swayc_t *next_focus = get_swayc_in_direction(con, seat, direction); | 54 | struct sway_container *next_focus = container_get_in_direction(con, seat, direction); |
54 | if (next_focus) { | 55 | if (next_focus) { |
55 | sway_seat_set_focus(seat, next_focus); | 56 | sway_seat_set_focus(seat, next_focus); |
56 | } | 57 | } |
diff --git a/sway/commands/kill.c b/sway/commands/kill.c index f408ce2a..f6774767 100644 --- a/sway/commands/kill.c +++ b/sway/commands/kill.c | |||
@@ -2,11 +2,11 @@ | |||
2 | #include "log.h" | 2 | #include "log.h" |
3 | #include "sway/input/input-manager.h" | 3 | #include "sway/input/input-manager.h" |
4 | #include "sway/input/seat.h" | 4 | #include "sway/input/seat.h" |
5 | #include "sway/view.h" | 5 | #include "sway/tree/view.h" |
6 | #include "sway/commands.h" | 6 | #include "sway/commands.h" |
7 | 7 | ||
8 | struct cmd_results *cmd_kill(int argc, char **argv) { | 8 | struct cmd_results *cmd_kill(int argc, char **argv) { |
9 | enum swayc_types type = config->handler_context.current_container->type; | 9 | enum sway_container_type type = config->handler_context.current_container->type; |
10 | if (type != C_VIEW && type != C_CONTAINER) { | 10 | if (type != C_VIEW && type != C_CONTAINER) { |
11 | return cmd_results_new(CMD_INVALID, NULL, | 11 | return cmd_results_new(CMD_INVALID, NULL, |
12 | "Can only kill views and containers with this command"); | 12 | "Can only kill views and containers with this command"); |
diff --git a/sway/commands/layout.c b/sway/commands/layout.c index b0fc5d66..ebab2a48 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c | |||
@@ -1,8 +1,8 @@ | |||
1 | #include <string.h> | 1 | #include <string.h> |
2 | #include <strings.h> | 2 | #include <strings.h> |
3 | #include "sway/commands.h" | 3 | #include "sway/commands.h" |
4 | #include "sway/container.h" | 4 | #include "sway/tree/container.h" |
5 | #include "sway/layout.h" | 5 | #include "sway/tree/layout.h" |
6 | #include "log.h" | 6 | #include "log.h" |
7 | 7 | ||
8 | struct cmd_results *cmd_layout(int argc, char **argv) { | 8 | struct cmd_results *cmd_layout(int argc, char **argv) { |
@@ -10,7 +10,7 @@ struct cmd_results *cmd_layout(int argc, char **argv) { | |||
10 | if ((error = checkarg(argc, "layout", EXPECTED_MORE_THAN, 0))) { | 10 | if ((error = checkarg(argc, "layout", EXPECTED_MORE_THAN, 0))) { |
11 | return error; | 11 | return error; |
12 | } | 12 | } |
13 | swayc_t *parent = config->handler_context.current_container; | 13 | struct sway_container *parent = config->handler_context.current_container; |
14 | 14 | ||
15 | // TODO: floating | 15 | // TODO: floating |
16 | /* | 16 | /* |
@@ -26,10 +26,10 @@ struct cmd_results *cmd_layout(int argc, char **argv) { | |||
26 | // TODO: stacks and tabs | 26 | // TODO: stacks and tabs |
27 | 27 | ||
28 | if (strcasecmp(argv[0], "default") == 0) { | 28 | if (strcasecmp(argv[0], "default") == 0) { |
29 | swayc_change_layout(parent, parent->prev_layout); | 29 | container_set_layout(parent, parent->prev_layout); |
30 | if (parent->layout == L_NONE) { | 30 | if (parent->layout == L_NONE) { |
31 | swayc_t *output = swayc_parent_by_type(parent, C_OUTPUT); | 31 | struct sway_container *output = container_parent(parent, C_OUTPUT); |
32 | swayc_change_layout(parent, default_layout(output)); | 32 | container_set_layout(parent, container_get_default_layout(output)); |
33 | } | 33 | } |
34 | } else { | 34 | } else { |
35 | if (parent->layout != L_TABBED && parent->layout != L_STACKED) { | 35 | if (parent->layout != L_TABBED && parent->layout != L_STACKED) { |
@@ -37,15 +37,15 @@ struct cmd_results *cmd_layout(int argc, char **argv) { | |||
37 | } | 37 | } |
38 | 38 | ||
39 | if (strcasecmp(argv[0], "splith") == 0) { | 39 | if (strcasecmp(argv[0], "splith") == 0) { |
40 | swayc_change_layout(parent, L_HORIZ); | 40 | container_set_layout(parent, L_HORIZ); |
41 | } else if (strcasecmp(argv[0], "splitv") == 0) { | 41 | } else if (strcasecmp(argv[0], "splitv") == 0) { |
42 | swayc_change_layout(parent, L_VERT); | 42 | container_set_layout(parent, L_VERT); |
43 | } else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) { | 43 | } else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) { |
44 | if (parent->layout == L_HORIZ && (parent->workspace_layout == L_NONE | 44 | if (parent->layout == L_HORIZ && (parent->workspace_layout == L_NONE |
45 | || parent->workspace_layout == L_HORIZ)) { | 45 | || parent->workspace_layout == L_HORIZ)) { |
46 | swayc_change_layout(parent, L_VERT); | 46 | container_set_layout(parent, L_VERT); |
47 | } else { | 47 | } else { |
48 | swayc_change_layout(parent, L_HORIZ); | 48 | container_set_layout(parent, L_HORIZ); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | } | 51 | } |
diff --git a/sway/commands/output.c b/sway/commands/output.c index 35bc8099..f7e3372c 100644 --- a/sway/commands/output.c +++ b/sway/commands/output.c | |||
@@ -296,7 +296,7 @@ struct cmd_results *cmd_output(int argc, char **argv) { | |||
296 | char identifier[128]; | 296 | char identifier[128]; |
297 | bool all = strcmp(output->name, "*") == 0; | 297 | bool all = strcmp(output->name, "*") == 0; |
298 | for (int i = 0; i < root_container.children->length; ++i) { | 298 | for (int i = 0; i < root_container.children->length; ++i) { |
299 | swayc_t *cont = root_container.children->items[i]; | 299 | struct sway_container *cont = root_container.children->items[i]; |
300 | if (cont->type != C_OUTPUT) { | 300 | if (cont->type != C_OUTPUT) { |
301 | continue; | 301 | continue; |
302 | } | 302 | } |
diff --git a/sway/commands/reload.c b/sway/commands/reload.c index d54d40db..8cef789b 100644 --- a/sway/commands/reload.c +++ b/sway/commands/reload.c | |||
@@ -1,6 +1,6 @@ | |||
1 | #include "sway/commands.h" | 1 | #include "sway/commands.h" |
2 | #include "sway/config.h" | 2 | #include "sway/config.h" |
3 | #include "sway/layout.h" | 3 | #include "sway/tree/layout.h" |
4 | 4 | ||
5 | struct cmd_results *cmd_reload(int argc, char **argv) { | 5 | struct cmd_results *cmd_reload(int argc, char **argv) { |
6 | struct cmd_results *error = NULL; | 6 | struct cmd_results *error = NULL; |
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index fa891398..8f39e5fc 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include "sway/commands.h" | 4 | #include "sway/commands.h" |
5 | #include "sway/config.h" | 5 | #include "sway/config.h" |
6 | #include "sway/input/seat.h" | 6 | #include "sway/input/seat.h" |
7 | #include "sway/workspace.h" | 7 | #include "sway/tree/workspace.h" |
8 | #include "list.h" | 8 | #include "list.h" |
9 | #include "log.h" | 9 | #include "log.h" |
10 | #include "stringop.h" | 10 | #include "stringop.h" |
@@ -17,15 +17,15 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
17 | 17 | ||
18 | int output_location = -1; | 18 | int output_location = -1; |
19 | 19 | ||
20 | swayc_t *current_container = config->handler_context.current_container; | 20 | struct sway_container *current_container = config->handler_context.current_container; |
21 | swayc_t *old_workspace = NULL, *old_output = NULL; | 21 | struct sway_container *old_workspace = NULL, *old_output = NULL; |
22 | if (current_container) { | 22 | if (current_container) { |
23 | if (current_container->type == C_WORKSPACE) { | 23 | if (current_container->type == C_WORKSPACE) { |
24 | old_workspace = current_container; | 24 | old_workspace = current_container; |
25 | } else { | 25 | } else { |
26 | old_workspace = swayc_parent_by_type(current_container, C_WORKSPACE); | 26 | old_workspace = container_parent(current_container, C_WORKSPACE); |
27 | } | 27 | } |
28 | old_output = swayc_parent_by_type(current_container, C_OUTPUT); | 28 | old_output = container_parent(current_container, C_OUTPUT); |
29 | } | 29 | } |
30 | 30 | ||
31 | for (int i = 0; i < argc; ++i) { | 31 | for (int i = 0; i < argc; ++i) { |
@@ -57,7 +57,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
57 | if (config->reading || !config->active) { | 57 | if (config->reading || !config->active) { |
58 | return cmd_results_new(CMD_DEFER, "workspace", NULL); | 58 | return cmd_results_new(CMD_DEFER, "workspace", NULL); |
59 | } | 59 | } |
60 | swayc_t *ws = NULL; | 60 | struct sway_container *ws = NULL; |
61 | if (strcasecmp(argv[0], "number") == 0) { | 61 | if (strcasecmp(argv[0], "number") == 0) { |
62 | if (!(ws = workspace_by_number(argv[1]))) { | 62 | if (!(ws = workspace_by_number(argv[1]))) { |
63 | char *name = join_args(argv + 1, argc - 1); | 63 | char *name = join_args(argv + 1, argc - 1); |
@@ -92,7 +92,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
92 | workspace_switch(ws); | 92 | workspace_switch(ws); |
93 | current_container = | 93 | current_container = |
94 | sway_seat_get_focus(config->handler_context.seat); | 94 | sway_seat_get_focus(config->handler_context.seat); |
95 | swayc_t *new_output = swayc_parent_by_type(current_container, C_OUTPUT); | 95 | struct sway_container *new_output = container_parent(current_container, C_OUTPUT); |
96 | 96 | ||
97 | if (config->mouse_warping && old_output != new_output) { | 97 | if (config->mouse_warping && old_output != new_output) { |
98 | // TODO: Warp mouse | 98 | // TODO: Warp mouse |