diff options
-rw-r--r-- | include/sway/tree/container.h | 1 | ||||
-rw-r--r-- | include/sway/tree/layout.h | 3 | ||||
-rw-r--r-- | sway/commands/layout.c | 15 | ||||
-rw-r--r-- | sway/ipc-json.c | 2 | ||||
-rw-r--r-- | sway/tree/container.c | 1 | ||||
-rw-r--r-- | sway/tree/layout.c | 23 | ||||
-rw-r--r-- | sway/tree/workspace.c | 1 |
7 files changed, 13 insertions, 33 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 6efda72f..5f3afdc1 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -68,7 +68,6 @@ struct sway_container { | |||
68 | enum sway_container_type type; | 68 | enum sway_container_type type; |
69 | enum sway_container_layout layout; | 69 | enum sway_container_layout layout; |
70 | enum sway_container_layout prev_layout; | 70 | enum sway_container_layout prev_layout; |
71 | enum sway_container_layout workspace_layout; | ||
72 | 71 | ||
73 | // For C_ROOT, this has no meaning | 72 | // For C_ROOT, this has no meaning |
74 | // For C_OUTPUT, this is the output position in layout coordinates | 73 | // For C_OUTPUT, this is the output position in layout coordinates |
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h index 49ae00e4..327134a5 100644 --- a/include/sway/tree/layout.h +++ b/include/sway/tree/layout.h | |||
@@ -49,9 +49,6 @@ struct sway_container *container_remove_child(struct sway_container *child); | |||
49 | struct sway_container *container_replace_child(struct sway_container *child, | 49 | struct sway_container *container_replace_child(struct sway_container *child, |
50 | struct sway_container *new_child); | 50 | struct sway_container *new_child); |
51 | 51 | ||
52 | struct sway_container *container_set_layout(struct sway_container *container, | ||
53 | enum sway_container_layout layout); | ||
54 | |||
55 | void container_move_to(struct sway_container* container, | 52 | void container_move_to(struct sway_container* container, |
56 | struct sway_container* destination); | 53 | struct sway_container* destination); |
57 | 54 | ||
diff --git a/sway/commands/layout.c b/sway/commands/layout.c index 4c49a627..ca45a6c8 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c | |||
@@ -26,9 +26,9 @@ 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 | container_set_layout(parent, parent->prev_layout); | 29 | parent->layout = parent->prev_layout; |
30 | if (parent->layout == L_NONE) { | 30 | if (parent->layout == L_NONE) { |
31 | container_set_layout(parent, container_get_default_layout(parent)); | 31 | parent->layout = container_get_default_layout(parent); |
32 | } | 32 | } |
33 | } else { | 33 | } else { |
34 | if (parent->layout != L_TABBED && parent->layout != L_STACKED) { | 34 | if (parent->layout != L_TABBED && parent->layout != L_STACKED) { |
@@ -36,15 +36,14 @@ struct cmd_results *cmd_layout(int argc, char **argv) { | |||
36 | } | 36 | } |
37 | 37 | ||
38 | if (strcasecmp(argv[0], "splith") == 0) { | 38 | if (strcasecmp(argv[0], "splith") == 0) { |
39 | container_set_layout(parent, L_HORIZ); | 39 | parent->layout = L_HORIZ; |
40 | } else if (strcasecmp(argv[0], "splitv") == 0) { | 40 | } else if (strcasecmp(argv[0], "splitv") == 0) { |
41 | container_set_layout(parent, L_VERT); | 41 | parent->layout = L_VERT; |
42 | } else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) { | 42 | } else if (strcasecmp(argv[0], "toggle") == 0 && argc == 2 && strcasecmp(argv[1], "split") == 0) { |
43 | if (parent->layout == L_HORIZ && (parent->workspace_layout == L_NONE | 43 | if (parent->layout == L_HORIZ) { |
44 | || parent->workspace_layout == L_HORIZ)) { | 44 | parent->layout = L_VERT; |
45 | container_set_layout(parent, L_VERT); | ||
46 | } else { | 45 | } else { |
47 | container_set_layout(parent, L_HORIZ); | 46 | parent->layout = L_HORIZ; |
48 | } | 47 | } |
49 | } | 48 | } |
50 | } | 49 | } |
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 6158fc29..ea7fd9ad 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -148,7 +148,7 @@ static void ipc_json_describe_workspace(struct sway_container *workspace, | |||
148 | json_object_object_add(object, "type", json_object_new_string("workspace")); | 148 | json_object_object_add(object, "type", json_object_new_string("workspace")); |
149 | json_object_object_add(object, "urgent", json_object_new_boolean(false)); | 149 | json_object_object_add(object, "urgent", json_object_new_boolean(false)); |
150 | 150 | ||
151 | const char *layout = ipc_json_layout_description(workspace->workspace_layout); | 151 | const char *layout = ipc_json_layout_description(workspace->layout); |
152 | json_object_object_add(object, "layout", json_object_new_string(layout)); | 152 | json_object_object_add(object, "layout", json_object_new_string(layout)); |
153 | } | 153 | } |
154 | 154 | ||
diff --git a/sway/tree/container.c b/sway/tree/container.c index bd9f9894..09a6b7ce 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -78,7 +78,6 @@ struct sway_container *container_create(enum sway_container_type type) { | |||
78 | } | 78 | } |
79 | c->id = next_id++; | 79 | c->id = next_id++; |
80 | c->layout = L_NONE; | 80 | c->layout = L_NONE; |
81 | c->workspace_layout = L_NONE; | ||
82 | c->type = type; | 81 | c->type = type; |
83 | c->alpha = 1.0f; | 82 | c->alpha = 1.0f; |
84 | 83 | ||
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 12af7172..a64cc9a9 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -33,19 +33,6 @@ static void output_layout_handle_change(struct wl_listener *listener, | |||
33 | arrange_windows(&root_container, layout_box->width, layout_box->height); | 33 | arrange_windows(&root_container, layout_box->width, layout_box->height); |
34 | } | 34 | } |
35 | 35 | ||
36 | struct sway_container *container_set_layout(struct sway_container *container, | ||
37 | enum sway_container_layout layout) { | ||
38 | if (container->type == C_WORKSPACE) { | ||
39 | container->workspace_layout = layout; | ||
40 | if (layout == L_HORIZ || layout == L_VERT) { | ||
41 | container->layout = layout; | ||
42 | } | ||
43 | } else { | ||
44 | container->layout = layout; | ||
45 | } | ||
46 | return container; | ||
47 | } | ||
48 | |||
49 | void layout_init(void) { | 36 | void layout_init(void) { |
50 | root_container.id = 0; // normally assigned in new_swayc() | 37 | root_container.id = 0; // normally assigned in new_swayc() |
51 | root_container.type = C_ROOT; | 38 | root_container.type = C_ROOT; |
@@ -305,8 +292,8 @@ static void workspace_rejigger(struct sway_container *ws, | |||
305 | 292 | ||
306 | int index = move_offs(move_dir); | 293 | int index = move_offs(move_dir); |
307 | container_insert_child(ws, child, index < 0 ? 0 : 1); | 294 | container_insert_child(ws, child, index < 0 ? 0 : 1); |
308 | container_set_layout(ws, | 295 | ws->layout = |
309 | move_dir == MOVE_LEFT || move_dir == MOVE_RIGHT ? L_HORIZ : L_VERT); | 296 | move_dir == MOVE_LEFT || move_dir == MOVE_RIGHT ? L_HORIZ : L_VERT; |
310 | 297 | ||
311 | container_flatten(ws); | 298 | container_flatten(ws); |
312 | container_reap_empty_recursive(original_parent); | 299 | container_reap_empty_recursive(original_parent); |
@@ -387,9 +374,9 @@ void container_move(struct sway_container *container, | |||
387 | workspace_rejigger(current, container, move_dir); | 374 | workspace_rejigger(current, container, move_dir); |
388 | } else if (current->children->length == 2) { | 375 | } else if (current->children->length == 2) { |
389 | wlr_log(L_DEBUG, "Changing workspace layout"); | 376 | wlr_log(L_DEBUG, "Changing workspace layout"); |
390 | container_set_layout(current, | 377 | current->layout = |
391 | move_dir == MOVE_LEFT || move_dir == MOVE_RIGHT ? | 378 | move_dir == MOVE_LEFT || move_dir == MOVE_RIGHT ? |
392 | L_HORIZ : L_VERT); | 379 | L_HORIZ : L_VERT; |
393 | container_insert_child(current, container, offs < 0 ? 0 : 1); | 380 | container_insert_child(current, container, offs < 0 ? 0 : 1); |
394 | arrange_windows(current, -1, -1); | 381 | arrange_windows(current, -1, -1); |
395 | } | 382 | } |
@@ -1066,7 +1053,7 @@ struct sway_container *container_split(struct sway_container *child, | |||
1066 | 1053 | ||
1067 | container_add_child(workspace, cont); | 1054 | container_add_child(workspace, cont); |
1068 | enum sway_container_layout old_layout = workspace->layout; | 1055 | enum sway_container_layout old_layout = workspace->layout; |
1069 | container_set_layout(workspace, layout); | 1056 | workspace->layout = layout; |
1070 | cont->layout = old_layout; | 1057 | cont->layout = old_layout; |
1071 | 1058 | ||
1072 | if (set_focus) { | 1059 | if (set_focus) { |
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 7f3c1903..66e1f7b9 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -57,7 +57,6 @@ struct sway_container *workspace_create(struct sway_container *output, | |||
57 | workspace->name = !name ? NULL : strdup(name); | 57 | workspace->name = !name ? NULL : strdup(name); |
58 | workspace->prev_layout = L_NONE; | 58 | workspace->prev_layout = L_NONE; |
59 | workspace->layout = container_get_default_layout(output); | 59 | workspace->layout = container_get_default_layout(output); |
60 | workspace->workspace_layout = workspace->layout; | ||
61 | 60 | ||
62 | struct sway_workspace *swayws = calloc(1, sizeof(struct sway_workspace)); | 61 | struct sway_workspace *swayws = calloc(1, sizeof(struct sway_workspace)); |
63 | if (!swayws) { | 62 | if (!swayws) { |