summaryrefslogtreecommitdiff
path: root/sway/commands/layout.c
diff options
context:
space:
mode:
authorKenny Levinsen <[email protected]>2021-02-12 23:22:51 +0100
committerTudor Brindus <[email protected]>2021-02-16 22:05:00 -0500
commita047b5ee4a2a67d30d93641ff86531d54b8e0879 (patch)
tree271666c6254e4fabf943c1153224059411a5ce56 /sway/commands/layout.c
parent28cadf558090854ace1df1a0a64f5fbc059541c0 (diff)
container: Move pending state to state struct
Pending state is currently inlined directly in the container struct, while the current state is in a state struct. A side-effect of this is that it is not immediately obvious that pending double-buffered state is accessed, nor is it obvious what state is double-buffered. Instead, use the state struct for both current and pending.
Diffstat (limited to 'sway/commands/layout.c')
-rw-r--r--sway/commands/layout.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sway/commands/layout.c b/sway/commands/layout.c
index f2af183b..2ba61b38 100644
--- a/sway/commands/layout.c
+++ b/sway/commands/layout.c
@@ -133,7 +133,7 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
// Operate on parent container, like i3.
if (container) {
- container = container->parent;
+ container = container->pending.parent;
}
// We could be working with a container OR a workspace. These are different
@@ -142,10 +142,10 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
enum sway_container_layout new_layout = L_NONE;
enum sway_container_layout old_layout = L_NONE;
if (container) {
- old_layout = container->layout;
+ old_layout = container->pending.layout;
new_layout = get_layout(argc, argv,
- container->layout, container->prev_split_layout,
- container->workspace->output);
+ container->pending.layout, container->prev_split_layout,
+ container->pending.workspace->output);
} else {
old_layout = workspace->layout;
new_layout = get_layout(argc, argv,
@@ -160,13 +160,13 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
if (old_layout != L_TABBED && old_layout != L_STACKED) {
container->prev_split_layout = old_layout;
}
- container->layout = new_layout;
+ container->pending.layout = new_layout;
container_update_representation(container);
} else if (config->handler_context.container) {
// i3 avoids changing workspace layouts with a new container
// https://github.com/i3/i3/blob/3cd1c45eba6de073bc4300eebb4e1cc1a0c4479a/src/con.c#L1817
container = workspace_wrap_children(workspace);
- container->layout = new_layout;
+ container->pending.layout = new_layout;
container_update_representation(container);
} else {
if (old_layout != L_TABBED && old_layout != L_STACKED) {